Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Product state is always "invalid" (using Cordova Plugin Purchase)

I'm using Cordova Plugin Purchase to use in-app billing in my Android app. However, using the alert with the JSON-stringified product, the product's state is always "invalid". Here is a sample of my code around this issue:

store.register({
    id:    'test_walker_01',
    alias: 'walker',
    type:   store.CONSUMABLE
});

item_walker = store.get("test_walker_01");

store.when("product").updated(function (product) {
    alert(JSON.stringify(product));
});

store.refresh();

My problem: I cannot access my product's information from Google Play.

After much searching on Google and Stack Overflow, here are the steps I already did/verified to find a solution:

  • I triple checked that the ID is the same than on Developer Console, and the type is "managed".
  • The product is activated in Developer Console.
  • I uploaded the exact same APK on my test phone than uploaded in the Developer Console, in Alpha testing.
  • I'm using a different Google account than the one in the Developer Console.
  • I have added this (different) account in the list of authorized test Gmail accounts.
  • The APK that I am signing and uploading is the release (not debug) version.
  • As far as I know, I am only using one key to sign all my APKs (referring to this SO question). I'm unsure how using many keys could happen.
  • I even uninstalled the app completely, rebooted my phone and reinstalled it.

Thank you for your help!

like image 828
karyann Avatar asked Oct 20 '22 06:10

karyann


1 Answers

After much searching, I found my answer in the last few comments in this issue on the Plugin's Github: You have to publish your application (in Alpha mode) on Google Play for it to actually work.

Publishing in Alpha mode only lets people in your test group access the application, so no worries about it being public. Just fill the mandatory fields with temporary information.

like image 173
karyann Avatar answered Nov 03 '22 05:11

karyann