I have followed the steps for in app billing:
Although I CAN buy the item, there is a curious warning "item not found" that I have to dismiss before I can go to the buy screen.
AND this log error:
E/Volley(1384): [157] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/details?doc=subs:com.testorooney.testo:sword_001
If you haven't received an in-app item you bought, try closing and restarting the app or game you're using. Tap Apps or Manage applications (depending on your device, this may be different). Tap the app you used to make your in-app purchase.
If you experience trouble making a purchase, follow the steps below: Make sure in-app purchase options are set correctly on your device. Play Store > Payment Methods. Close the game from the background and restart it.
In-app billing refers to in-app purchases that are made directly from within a mobile application on Google's Android platform.
This is NOT a server side bug. The bug is in the onClick for the Purchase button in the Dungeons class of the sample application.
The supplied method has a bug in the if {} else if {} statement where it causes the mBillingService.requestPurchase to be called twice, when the selected item is not a subscription item (mManagedType != Managed.SUBSCRIPTION). So the same item will be requested twice, once with an item type of "inapp" (which is the valid request) and immediately after that with an item type of "subs" (which is incorrect and it shows "item not found").
Here is the buggy code:
if (mManagedType != Managed.SUBSCRIPTION &&
!mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_INAPP, mPayloadContents)) {
showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);
} else if (!mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_SUBSCRIPTION, mPayloadContents)) {
// Note: mManagedType == Managed.SUBSCRIPTION
showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);
}
To fix this, add mManagedType == Managed.SUBSCRIPTION to the else if above.
Here is how the function should look:
@Override
public void onClick(View v) {
if (v == mBuyButton) {
if (Consts.DEBUG) {
Log.d(TAG, "buying: " + mItemName + " sku: " + mSku);
}
if (mManagedType != Managed.SUBSCRIPTION &&
!mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_INAPP, mPayloadContents)) {
showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);
} else if (mManagedType == Managed.SUBSCRIPTION && !mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_SUBSCRIPTION, mPayloadContents)) {
// Note: mManagedType == Managed.SUBSCRIPTION
showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);
}
} else if (v == mEditPayloadButton) {
showPayloadEditDialog();
} else if (v == mEditSubscriptionsButton) {
editSubscriptions();
}
}
i have this same error when installing the dungeons example and also when applying the code sample to my project. I noticed that if i go to makerequestbundle and change the API_VERSION to 1 then i can do inapp managed purchases without this error.
The other thing i noticed is that subscriptions execute without this error if left on API_VERSION 2.
Im wondering if this is a server side bug as i've looked at the code and cant find the issue. My product IDs are all matching etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With