Search code examples
androidin-app-purchasegoogle-playin-app-billing

GooglePlay: The item you requested is not available for purchase


I am getting the following from the Google Play IAB API;

The item you requested is not available for purchase

I have however successfully tested against static responses, and in addition, the following code returns myProductId in the list of available products;

ArrayList<String> skuList = new ArrayList<String> ();
skuList.add("myProductId");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
Bundle skuDetails = service.getSkuDetails(3, activity.getPackageName(), "inapp", querySkus);

In addition I have;

  • Published a beta APK
  • Added a test user to the beta and opted in via the URL
  • Logged on the device with the test user (gmail account)
  • Pushed a signed APK with the same versioncode to the device
  • Activated the product

The purchasing code I am using is;

Bundle buyIntentBundle = service.getBuyIntent(3, activity.getPackageName(), "myProductId", "inapp", "payload");
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
activity.startIntentSenderForResult(pendingIntent.getIntentSender(), 1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));

Finally, logcat shows the following;

D/Finsky: [1] PurchaseFragment.onStateChange: Error: PurchaseError{type=3 subtype=0}
D/Finsky: [1] PurchaseFragment.onStateChange: Purchase failed: PurchaseError{type=3 subtype=0}

Whilst there are other questions related to this issue, none of them solve it for me;

  1. the item you requested is not available for purchase
    • Product is active
  2. The item you have requested is not available for purchase
    • Testing with Static Responses is successful for product android.test.purchased
  3. Android In App Purchase “Item that you have requested is not available for purchase” Error
    • Test user logged in

Solution

  • 12 hours after my last test this was mysteriously working. The symptoms were:

    • Purchase unavailable if the application was installed to the device via ADB (release & signed)
    • Purchase available as normal if the application was installed via Google Play (download)

    What exactly fixed this i'm unsure. Prior to waiting 12 hours I;

    • Switched from using IInAppBillingService directly to using Google's IABHelper. The immediate effect was still product unavailable for purchase, however the text was now displayed in red rather than black (what?) and the DFinsky error changed to subtype 4; PurchaseError{type=3 subtype=4}. I also note that i was not using base64EncodedKey when using IInAppBillingService directly.
    • Switched to multiple APKs (probably red-herring)
    • Started an alpha test (was previously using a beta test only)
    • Created a new gmail account and added it to testers

    Even after all these changes, the issue was still occurring, so I went to bed, woke up this morning and with no further changes it just worked. FML.