Skip to content Skip to sidebar Skip to footer

Android In-app Purchase: How To Consume?

I've implemented Google In-App Billing V3 in my app and i did my first test purchase. Now, as seen that i want it consumable, but if i click the 'Purchase' button again i receive a

Solution 1:

As stated in the official documentetion: https://developer.android.com/google/play/billing/billing_reference.html

The response intent to the purchase includes several fields, one of them being:

INAPP_PURCHASE_DATA A String in JSON format that contains details about the purchase order. See table 4 for a description of the JSON fields.

Inside that JSON, you have several fields, also explained in that page, the one you are looking for is:

purchaseToken A token that uniquely identifies a purchase for a given item and user pair.

All these is quite easy to follow from the official sample application, which I recommend you to download and try out, also to check the code.

Solution 2:

Ok, i solved. Instead of using:

int response = mService.consumePurchase(3, getPackageName(), token); 

follow this thread:

mService.consumePurchase(3, packageName, purchaseToken) always returns RESULT_DEVELOPER_ERROR = 5 - invalid arguments provided to the API

Post a Comment for "Android In-app Purchase: How To Consume?"