0

As the title says, I'm getting this error when querying the inventory.

Failed to query inventory: IabResult: NullPointer while refreshing inventory. (response: -1008:Unknown error)

Someone knows for what this error is standing for?

shkschneider
  • 17,833
  • 13
  • 59
  • 112
Tristan G
  • 1,720
  • 2
  • 13
  • 22
  • Seems like a known bug, you need to catch Exceptions yourself: https://stackoverflow.com/a/15489975/603270 – shkschneider Jul 17 '15 at 12:37
  • Could this be relevant? http://stackoverflow.com/questions/27797663/android-in-app-billing-error-you-need-to-sign-into-your-google-account – Michal Jul 17 '15 at 12:38
  • @shkschneider: I allready included this, but still getting this error. But thx for the tip :) – Tristan G Jul 17 '15 at 12:44
  • @Michal: I'm not sure. I was able to buy the product from Google. But if I query the inventory i just get the error. But if I try to rebuy the item it says: Item allready owned, as I expected. – Tristan G Jul 17 '15 at 12:46

2 Answers2

2

If you call mHelper.launchPurchaseFlow(....) with an SKU that is registered as a subscription in your Google Developer Console it will result in the error. It means either purchaseData or dataSignature is null.

Check IabHelper.java

   if (purchaseData == null || dataSignature == null) {
                logError("BUG: either purchaseData or dataSignature is null.");
                logDebug("Extras: " + data.getExtras().toString());
                result = new IabResult(IABHELPER_UNKNOWN_ERROR, "IAB returned null purchaseData or dataSignature");
                if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);
                return true;
            }

If you have a SKU that is registered as an subscription you have to use the method: mHelper.launchSubscriptionPurchaseFlow(....)

Also check this answer: Google Play In-App Purchase returns error code -1008: null puchaseData or dataSignature

Community
  • 1
  • 1
Jitin Jassal
  • 137
  • 2
  • 13
2

I had this problem with my subscriptions because I haven't set the "itemType"

 mHelper.launchPurchaseFlow(this,
            SKU_INFINITE_GAS, IabHelper.ITEM_TYPE_SUBS,
            RC_REQUEST, mPurchaseFinishedListener, payload);
stefan
  • 1,336
  • 3
  • 21
  • 46