voltrue2 / in-app-purchase

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

Unity iAP google subscription validation failure #254

Open galeksic90 opened 5 years ago

galeksic90 commented 5 years ago

Hello,

We have implemented Unity iAP validation and everything works fine except google subscriptions. It always back the same Error: Status 400, 'Invalid Value'.

We are testing in sandbox mode, and here is our module configuration.

requestDefaults: ,

appleExcludeOldTransactions: true,
applePassword: '32a70*************',

googleServiceAccount: {
    clientEmail: 'node-js-iap-validation@api-**********.iam.gserviceaccount.com',
    privateKey: "-----BEGIN PRIVATE KEY-----\*******\n-----END PRIVATE KEY-----\n"
},

googlePublicKeyStrSandBox: 'MIIBIj*****', // same as StrLive
googlePublicKeyStrLive: 'MIIBIj*****',
googleAccToken: '4/NgERjTIWqGYQ8L-*****',
googleRefToken: '1/YrZFI***',
googleClientID: '730559190070-****',
googleClientSecret: 'h-5z****',

test: true,
verbose: true

And here is a log output as well.

Apr 30 16:19:44 staging INFO [1556641184102][VERBOSE] GOOGLE API Validation URL: https://www.googleapis.com/androidpublisher/v3/applications/com.horagames.cryptominer/purchases/products/gold_membership/tokens/leoldkpnklflpkjhopifcing.AO-J1OxAZ3FTBZIlsLw4QFKRJAcPPKCbcwxOpmJ571zO-t71cd-pPStySd0T6FnfdMhY3HGNZvfikWSqlrrLAWEgFKQx4jht9hDvD-JNWDaqIqzC8r-DbCjaSevjHI_lfHyAC2sr_93v?access_token=ya29.c.Elr7BldQIrbxPoPynsvKsP0pANt2Mz23w_NwzfN1NsI6mXmO7OWrWR8tmR6EXM0q7ZnsxBro02Y1pmn73Wh3raYq1IUU3CkRiCZGOmV7sBFDrvX5tEznWZfomfw
Apr 30 16:19:44 staging INFO [1556641184274][VERBOSE] GOOGLE API Validation failed: 400 { error: { errors: [ [Object] ], code: 400, message: 'Invalid Value' } }
Apr 30 16:19:44 staging ERROR app:iap d3x73r  Error: Status:400 - {
Apr 30 16:19:44 staging ERROR   "error": {
Apr 30 16:19:44 staging ERROR     "errors": [
Apr 30 16:19:44 staging ERROR       {
Apr 30 16:19:44 staging ERROR         "domain": "global",
Apr 30 16:19:44 staging ERROR         "reason": "invalid",
Apr 30 16:19:44 staging ERROR         "message": "Invalid Value"
Apr 30 16:19:44 staging ERROR       }
Apr 30 16:19:44 staging ERROR     ],
Apr 30 16:19:44 staging ERROR     "code": 400,
Apr 30 16:19:44 staging ERROR     "message": "Invalid Value"
Apr 30 16:19:44 staging ERROR   }
Apr 30 16:19:44 staging ERROR }
Apr 30 16:19:44 staging ERROR     at Request._callback (/home/node/app/node_modules/in-app-purchase/lib/googleAPI.js:115:27)
Apr 30 16:19:44 staging ERROR     at Request.self.callback (/home/node/app/node_modules/request/request.js:185:22)
Apr 30 16:19:44 staging ERROR     at emitTwo (events.js:126:13)
Apr 30 16:19:44 staging ERROR     at Request.emit (events.js:214:7)
Apr 30 16:19:44 staging ERROR     at Request.<anonymous> (/home/node/app/node_modules/request/request.js:1161:10)
Apr 30 16:19:44 staging ERROR     at emitOne (events.js:116:13)
Apr 30 16:19:44 staging ERROR     at Request.emit (events.js:211:7)
Apr 30 16:19:44 staging ERROR     at IncomingMessage.<anonymous> (/home/node/app/node_modules/request/request.js:1083:12)
Apr 30 16:19:44 staging ERROR     at Object.onceWrapper (events.js:313:30)
Apr 30 16:19:44 staging ERROR     at emitNone (events.js:111:20)
Apr 30 16:19:44 staging ERROR     at IncomingMessage.emit (events.js:208:7)
Apr 30 16:19:44 staging ERROR     at endReadableNT (_stream_readable.js:1064:12)
Apr 30 16:19:44 staging ERROR     at _combinedTickCallback (internal/process/next_tick.js:139:11)
Apr 30 16:19:44 staging ERROR     at process._tickDomainCallback (internal/process/next_tick.js:219:9) +2h
voltrue2 commented 5 years ago

Hi, apologies for getting back to you late. Do you get the same error if you validate the Google Play as is? Looks like the error object isn’t printing all in verbose mode. I will make a change so that we see the error at least. Cheets

galeksic90 commented 5 years ago

Hi, how do you mean if we validate the Google Play as is?

The non-renewable (consuming) products are working fine, the problem is only with subscription.

voltrue2 commented 5 years ago

Hi, what I meant by try validating as is was to use the receipt from Google Play instead of Unity receipt. It should not change the way validation works but I just wanted to see if the issue comes from Unity receipt or not. Cheers

bit-crafter commented 5 years ago

@voltrue2 in the googleAPI.js file _getValidationUrl checks receipt.subscription and now that parameter is not available so instead of checking subscription it checks a product which causes HTTP error.

voltrue2 commented 5 years ago

I see. Thanks for pointing it out. I’ll havd a look at it!

Cheers!

galeksic90 commented 5 years ago

Hey @voltrue2

Any news about the issue?

voltrue2 commented 5 years ago

Hello

I’m still in the process of going through issues. Maybe it’s time for me to ask for help and support from the community as issues are piling up recently. Anyways, I should be able to get to this later this week or early next week.

Cheers

galeksic90 commented 5 years ago

@voltrue2

Thanks for response. I would like to help, but i am not nodejs developer. Please let me know when it is fixed.

Regards

Baskerville42 commented 5 years ago

@voltrue2 I have the same problem one-time purchases always validated well, but subscriptions are not as I know, the problem can be with purchaseToken but I'm not sure what is the difference between purchaseToken for subscription and product

Baskerville42 commented 5 years ago

oh, I missed it https://github.com/voltrue2/in-app-purchase#google-play-using-google-service-account sorry for my fault :)

galeksic90 commented 5 years ago

@voltrue2 Any update on this?

grubstarstar commented 2 years ago

Was there a solution for this? I am getting the same issue now

grubstarstar commented 2 years ago

I'm guessing this isn't maintained anymore?