cordova-plugin-inapppurchase
cordova-plugin-inapppurchase copied to clipboard
buy() completes the purchase, but returns error 1003 Signature verification failed
I'm trying to implement the in-app purchase on an Android device as shown in the readme file, and it seems to work since google confirms that the purchase has been accepted. But the data returned from the buy() function are the following: ""response":-1003,"message":"Could not complete purchase","text":"Signature verification failed for sku premium.subscription (response: -1003:Purchase signature verification failed)","code":-6"
I have the latest version of the framework and i'm trying on different android version, getting the same results. Google is also taking the money, so i really don't get why it doesn't give me an okay...
NOTE: i installed the app from the SDK, not from google play.
You need to install app from google play. You can't use inAppPurchase features if you didn't downloaded from google play.
@centrual Check the last list item https://alexdisler.com/2016/04/04/testing-cordova-in-app-purchases-on-ios-android/ it mentions "You don't have to upload a new apk each time just to test the purchases" . I have also tried to upload the app as an alpha version and downloaded it from store and still get the same error!
{
"code": -e,
"message": "could not complete purchase",
"text": "Signature verification failed for sku android.test.purchase(response: -1003:Purchase signature verification failed)",
"response": -1003,
"errorCode": -6
}
Open settings, find application manager. Select all on tabs. Find playstore. Stop it. Delete cache. Flush app data. Open playstore, login. Check your app, if it is not working reinstall your app.
@centrual Thanks for the suggestion I did not know that I could retest only by clearing playstore cache. Thanks
@centrual Thanks for the help. Works after clearing play store cache.
Thanks for your help with this.. I was also experiencing this issue building with Ionic. I then realised the play_store_key
in www/manifest.json
was being overwritten at build time. For ionic it should go in src/manifest.json
instead. After updating this and using the steps above purchases worked fine.
I'm having issue with making inapppurchase work in Ionic. I was testing with "android.test.purchased". Code is pretty straight forward:
this.iap
.getProducts(['android.test.purchased'])
.then((products) => {
console.log(JSON.stringify(products));
this.iap
.buy('android.test.purchased')
.then((data)=> {
console.log(JSON.stringify(data));
})
.catch((err)=> {
console.log(JSON.stringify(err));
});
})
.catch((err) => {
console.log(JSON.stringify(err));
});
I do have the play_store_key
in src/manifest.json
. I installed the app from google play store. Still keep getting:
{
"code": -e,
"message": "could not complete purchase",
"text": "Signature verification failed for sku android.test.purchase(response: -1003:Purchase signature verification failed)",
"response": -1003,
"errorCode": -6
}
Do we need to install the "Google Billing Play Library" in SDK manager? I didn't see this library in my SDK Tools....Or is there something else that I'm missing?
One thing I found was that with same set up if I buy actual product (one that I set up for my app), it works as expected. Only with the reserved products it has problem.
Had the sane issue. Turned out I had an old play_store_key in my manifest.
@mpadmaraj I have the same issue exactly, found this old SO post from 6 years ago, seems still relevant in 2019.. Any one had any success with this?? how the heck do you test IAP on Android
EDIT:
After wasting some time on this I ended up doing an ugly hack:
in YOUR_PROJECT_NAME/platforms/android/app/src/main/java/com/alexdisler/inapppurchases/IabHelper.java
I added false
to always fail the if statement:
// Verify signature
if (!skipPurchaseVerification) {
// TODO: this is ugly hack for testing REMOVE
if (!Security.verifyPurchase(mSignatureBase64, purchaseData, dataSignature) && false) {
logError("Purchase signature verification FAILED for sku " + sku);
result = new IabResult(IABHELPER_VERIFICATION_FAILED, "Signature verification failed for sku " + sku);
if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, purchase);
return true;
}
logDebug("Purchase signature successfully verified.");
}
note the && false
.. its so ugly I want to die but honestly I don't want to waste any more time on it.. if anyone found any better solution Im all ears
NOTE2: this not cordova-plugin-inapppurchase
fault this is google issue the hack is within this library so mite be a useful information here (See also the SO link at the start for the native hack)
Hope this helps anyone