-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Check parsed JSON receipt if it contains the purchaseToken field for Google Play #319
base: develop
Are you sure you want to change the base?
Conversation
Also ran into this, please consider merging |
I also ran into this, please merge! |
Hello, I used google play service to validate receipt, but I got the following error. {"error":{},"status":498,"message":"Invalid Purchase Token"} |
Just so anyone following this sees, I was able to get around this by using the client email and private key option for google instead without any errors. Of course, it would still be nice to use a public key instead of this option, and the docs don't necessarily guide anyone to do this, but it works! |
Thanks for your reply, I solved the problem by removing JSON.stringify(). |
Currently, to determine if the platform type of the receipt is Google Play, there are two cases:
iap.validate
is an object, then the code checks ifreceipt.signature
orreceipt.purchaseToken
exists.iap.validate
is a string, then the code first parses the receipt into an object (calledparsed
), then it is supposed to check ifparsed.signature
orparsed.purchaseToken
exists.However, for the second condition the code never checks
parsed.purchaseToken
, instead checking whetherreceipt.purchaseToken
exists twice.As a result, when a Google Play receipt string that uses service account for validation is passed into
iap.validate
, the package interprets it as an Amazon receipt since the receipt will not containparsed.signature
. It only containsparsed.purchaseToken
, which is never checked.