eikuh
eikuh

Reputation: 697

In App Billing: Verify "Already Owned" Result

I want that my app can restore in app purchases that were made before or with another device (but the same account). So, if getPurchases() is not up-to-date, then at latest when the user tries to buy again, the item should automatically be available again in the app.

There are two cases where BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED can be returned:

  1. Directly from getBuyIntent(). This happens when the local Play Store (cached) already knows that the item is already purchased. In this case getPurchases() also reports the item to have been purchased.

  2. In handleActivityResult(). This happens when the purchase was made with a second device and the first device still does not know. In this case, the Google Play server is contacted and the server reports that the item has been already purchased.

The problem with (2.) is that no purchseData and no dataSignature is returned so the info cannot be validated.

I have two possibilities:

I am not happy with either possibility. Is there a good way?

Upvotes: 0

Views: 312

Answers (1)

sergej shafarenka
sergej shafarenka

Reputation: 20426

I would suggest to request all products with their states anew and validate them. This is what I do in my app after receiving ALREADY_OWNED response.

As an idea, you can even accept ALREADY_OWNED response as it is (without validation) and enable extended functions to the user. If that was a fraud response, you will still be able to validate it again on a new application launch. If you detect that the item is not owned, you will disable extended functions back.

Upvotes: 1

Related Questions