'Unable to set up backend for In app purchases
I have written the cloud functions as per this https://codelabs.developers.google.com/codelabs/flutter-in-app-purchases#0. In the section 10, to verify the purchases a 3rd party Javascript called node-apple-receipt-verify is used. I have added this package in the package.json like this
"dependencies": {
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.14.1",
"node-apple-receipt-verify": "^1.9.3"
},
"devDependencies": {
"@types/node-apple-receipt-verify": "^1.7.0",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.8.0",
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"firebase-functions-test": "^0.2.0",
"typescript": "^3.8.0"
},
Also added the package in the package-lock.json file
In dependencies
"@types/node-apple-receipt-verify": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@types/node-apple-receipt-verify/-/node-apple-receipt-verify-1.7.0.tgz",
"integrity": "sha512-hjFcvGgA4h14V3M6XPrp5kJU1HHnIsMamME7Bz3TK7w8IcQrEc9b4wm5/p3Tng38oCwxMvDsozVnLEvitvXlkw==",
"dev": true
},
But I am getting this error
src/app-store.purchase-handler.ts:3:37 - error TS2307: Cannot find module 'node-apple-receipt-
verify' or its corresponding type declarations.
3 import * as appleReceiptVerify from "node-apple-receipt-verify";
src/app-store.purchase-handler.ts:10:16 - error TS2664: Invalid module name in augmentation,
module 'node-apple-receipt-verify' cannot be found.
10 declare module "node-apple-receipt-verify" {
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Solution 1:[1]
You need to install the node.js package here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | jbryanh |