cordova-plugin-inapppurchase icon indicating copy to clipboard operation
cordova-plugin-inapppurchase copied to clipboard

buy() completes the purchase, but returns error 1003 Signature verification failed

Open Lafaa opened this issue 8 years ago • 10 comments

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.

Lafaa avatar Dec 21 '16 17:12 Lafaa

You need to install app from google play. You can't use inAppPurchase features if you didn't downloaded from google play.

centrual avatar Mar 08 '17 20:03 centrual

@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
}

Herb-sh avatar Mar 27 '17 16:03 Herb-sh

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 avatar Mar 27 '17 19:03 centrual

@centrual Thanks for the suggestion I did not know that I could retest only by clearing playstore cache. Thanks

Herb-sh avatar Mar 29 '17 01:03 Herb-sh

@centrual Thanks for the help. Works after clearing play store cache.

alairjt avatar May 01 '17 19:05 alairjt

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.

nealshail avatar May 25 '17 11:05 nealshail

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?

mpadmaraj avatar Sep 27 '17 12:09 mpadmaraj

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.

mpadmaraj avatar Sep 28 '17 02:09 mpadmaraj

Had the sane issue. Turned out I had an old play_store_key in my manifest.

arnovanoordt avatar Mar 11 '19 08:03 arnovanoordt

@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

verybluebot avatar Jul 13 '19 11:07 verybluebot