j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 537 forks source link

Cannot verify auto-renewable subscription #112

Closed flyingsky closed 9 years ago

flyingsky commented 9 years ago

I always get this issue in verify auto-renewable subscription:

{"code":6778001,"message":"The shared secret you provided does not match the shared secret on file for your account."}

Why?

flyingsky commented 9 years ago

I have to use my own server validator, as described in this issue #68. So don't use the validator url provided in the doc, http://store.fovea.cc:1980/check-purchase or https://store.fovea.cc:1982/check-purchase. Actually it's easy to use nodejs module https://github.com/pcrawfor/iap_verifier to implement the server side check. Note you have to make sure below call:

var transaction = req.param('transaction'); var receipt = transaction.transactionReceipt; client.verifyAutoRenewReceipt(receipt, true, function(valid, msg, data) {}) // or below code for non auto renew receipt // client.verifyReceipt(receipt, true, function(valid, msg, data) {})

because the receipt from this plugin is encoded in base64.

flyingsky commented 9 years ago

You can find detail code here https://github.com/flyingsky/node-in-app-purchase-check