voltrue2 / in-app-purchase

A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
http://iap.gracenode.org
Other
1.04k stars 287 forks source link

String receipts for Google Service Accounts not interpreted correctly in getService #304

Open blaur opened 4 years ago

blaur commented 4 years ago

When providing a string receipt with following elements: {"packageName":"com.hehe","productId":"com.hehe.subscription","purchaseToken":"TOOOOKEN","subscription":true}

It wont properly understand it is google because of the below looks at the original string and not the parsed receipt: image

The receipt.purchaseToken should be parsed.purchaseToken otherwise it will be set to Amazon.

0x80 commented 4 years ago

@blaur Where did you find this code? I think I ran into this issue as well, but if I search for receipt.purchaseToken in the codebase nothing turns up in the master or develop branches.

blaur commented 4 years ago

@0x80 You can find it here: https://github.com/voltrue2/in-app-purchase/blob/develop/index.js

On line 107 you can see that it says receipt.purchaseToken but it should be looking at the parsed token. I've highlighted it below.

image