Rabindra Acharya
Rabindra Acharya

Reputation: 1928

How to get purchase status from Google Play Billing?

I have a problem with the google play billing. I have an android app consist of in-app purchase there. I maintain the SharedPreference to purchase an app status. If google gave purchase status as success then I maintain boolean value as app purchased.
Problem Scenario: I am a new user for XYZ app, I have paid for premium version. After a successful payment, the app will switch to the premium version. At the same time I go to the google play account and cancel the order. The developer gets 0 price for refunding the price, and as a new user I get a premium version without paying.

Q. How to deal with the purchase status of SKU for google play billing?

Upvotes: 7

Views: 2447

Answers (2)

JGS
JGS

Reputation: 51

Late answer, but I think the strategy is to re-check the purchase status after a grace period. For example, you can save the current time when the switch to premium version happens. After 7 days have passed (or whatever refund window you want to have), check the purchase status again and remove premium features if the result comes negative.

Edit: here is another detailed and relevant answer https://stackoverflow.com/a/34005001/4613031

Upvotes: 0

DrPower
DrPower

Reputation: 445

You should always do queryPurchases (with Billing Library) or getPurchases (with AIDL) to find the outstanding purchases. Only unlock the premium contents if you found that user has that purchase.

Upvotes: 1

Related Questions