Frank Junior
Frank Junior

Reputation: 585

In-App Billing v3 restore purchase

Right now I'm using inapp purchase v3, and I am able to buy an item.

But when I've bought it, and I uninstall the app, clear Google Play data and remove the account (and then I log in again with same account), when I install that app again, my purchase history is empty. How do I restore it in v3?

If I look at the code in IabHelper there is a function queryPurchases:

Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(),
                itemType, continueToken);

but the first time, continueToken is null. Might that be the problem?

Upvotes: 1

Views: 1710

Answers (1)

siddharthsn
siddharthsn

Reputation: 1709

While trying to restore purchases, make sure that you don't test it using the `STATIC PRODUCT IDs(android.test.purchased , android.test.refunded.... ) . The purchases made using static IDs will not be added to your purchase history. So you will not be able to retrieve it. You may, however, use the test Product IDs that you created for your In-app Product testing.

Your previous purchases should be listed fine, if you query using proper Package name, Purchase type and Product ID. Also, be sure to use the Google Account that you used to make the purchase. The continuation token is usually null. It is just a parameter to indicate that you have more purchases that couldn't be accommodated in the first response to your getPurchases call.

Upvotes: 2

Related Questions