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

Unknown message digest #305

Open imryaaan opened 4 years ago

imryaaan commented 4 years ago

Im using this app on IOS and it works perfectly but with Android the iap.validate() function is retuning 'Unknown message digest', i have validated the receipt and public key on http://iap.gracenode.org/#validate-android and all is looking good so im not sure why this error is appearing. I have <Google> test mode? true and my code goes as follows

inAppPurchase
.buy(product-here)
 .then(function (data) {
     sessionData.receipt = data.receipt;
         sessionData.sig = data.signature;
        return inAppPurchase.consume(data.productType, sessionData.receipt, sessionData.sig);
})
.then(function () {
        var iap = require('in-app-purchase');
        iap.config({ 
         googlePublicKeyStrSandBox: <key-here>,
          googlePublicKeyStrLive: <key-here>,
          test: true,
         verbose: true
             });

      var receipt = {
        "data": JSON.parse(sessionData.receipt),
        "signature": sessionData.sig
     }
      iap.validate(iap.GOOGLE, receipt, function (err, response) {
    if (err) { 
        console.log('error', err); 
    } else { 
            console.log('success', response);
    } 
    });
});
});

Any information on this would be much appreciated.

also my VERBOSE message gets to here [1582285755181][VERBOSE] <Google> Try validate against live public key: <key-here> but no further