0

I've adapted the play_billing sample in the Google extras of the Android SDK to use my own app package name and public key. I was able to purchase a managed item as well as a subscription thru the app.

However, when I call methods such as Inventory.getAllPurchases() the subscription is not returned in the user's inventory, even after restarting and reinstalling the app.

@Override
public void onQueryInventoryFinished(IabResult result, Inventory inventory)
{
    if(result.isFailure())
    {
        log.error("In-app billing inventory query failed: " + result);
        return;
    }

    for(Purchase purchase : inventory.getAllPurchases())
    {
        log.info("Purchase: " + purchase.getSku());
    }
}

Output:

Purchase: premium

The regular, single-time purchase (premium) is output as you can see, but the subscription purchase (paid_app) is not. When I try to buy the subscription again it says I've already bought it:

Error when trying to purchase the subscription

I've tried everything I know, but I can't figure this out. Since the regular item is working as intended, I don't see why the subscription isn't being returned unless I'm totally off base on how that is supposed to work.

I have the APK uploaded as a draft. I have my email address on the phone in the testers list; the email is NOT my developer email. My subscription item is Active. The phone I'm testing on has the latest version of Google Play.

Edit: Still no luck. However, here's another update in case it's relevant. When I go into Google Wallet none of the transactions show up (ostensibly because they are test transactions). And for my test user account when I go into Google Play under subscriptions, it is not listed. Yet it won't let me purchase again. So not only do the purchased subscriptions not show up when I query for them, but they also are nowhere I can cancel to test again.

Any ideas here would be greatly appreciated.

The Awnry Bear
  • 4,599
  • 3
  • 29
  • 33

1 Answers1

0

Figured it out by chance when I came across this answer and decided to try the updated code linked there.

Apparently the play_billing sample listed in the SDK manager is outdated, and all the classes in the util package need to be replaced by the util packages from this up-to-date project.

After I replaced the old util package with the new one, my subscription gets listed along with the regular premium item!!!

Purchase: paid_app
Purchase: premium
Community
  • 1
  • 1
The Awnry Bear
  • 4,599
  • 3
  • 29
  • 33