in-app-purchase icon indicating copy to clipboard operation
in-app-purchase copied to clipboard

Google Service Account

Open spedalilama opened this issue 6 years ago • 2 comments

I am trouble validating for Google with a Google Service Account was wondering if in index.js (line 107) the check for receipt.purchaseToken should be parsed.purchasedToken (code snipet from index.js below)

try { // receipt could be either Google, Amazon, or Unity (Apple or Google or Amazon) var parsed = JSON.parse(receipt); if (isUnityReceipt(parsed)) { return module.exports.UNITY; } if (parsed.signature) { return module.exports.GOOGLE; } else if (receipt.purchaseToken) { return module.exports.GOOGLE; } else { return module.exports.AMAZON; } }

spedalilama avatar Sep 09 '19 18:09 spedalilama

I don't know if the answer to your question is yes, but for google service account, I pass the receipt as an object (not a string) (thus the code you see will work).

                receipt = {
                    packageName: developerNotification.packageName,
                    productId: developerNotification.subscriptionNotification.subscriptionId,
                    purchaseToken: developerNotification.subscriptionNotification.purchaseToken,
                    subscription: true
                };

                await processPurchaseReceipt({
                    receipt: receipt,
                    userId: null
                });

chr4ss1 avatar Dec 05 '19 14:12 chr4ss1

Can you please let me know where I can get the following information from?

googleServiceAccount: { clientEmail: 'xxxxxxxxxxxxxxxxxx, privateKey: 'xxxxxxxxxxxxxxxxxx' },

famictech2000 avatar Jul 04 '21 04:07 famictech2000