Google just launch Voided Purchases API
The Google Play Voided Purchases API allows you to revoke access to in-app products that are associated with purchases that a user has voided. The user can void a purchase in the following ways:
- The user requests a refund for their order.
- The user cancels their order.
- An order is charged back.
But, I am confused with the use case.
Currently, I have an app with non consumable in-app purchase item (One-time purchase).
Whenever my app starts, I will check whether user has purchased the item, by using the following code.
https://github.com/googlesamples/android-play-billing/blob/master/TrivialDrive/app/src/main/java/com/example/android/trivialdrivesample/MainActivity.java#L243
I expect inventory.getPurchase
will return null during next app startup, if user has decided to cancel their purchase order.
So, how does Voided Purchases API
fit in "user has decided to cancel their purchase order" case?
I thought by using onQueryInventoryFinished
, we can determine what item is currently owned by user?
The Voided Purchases API is intended to be used by applications which utilize a back-end server for the purchase fulfillment. For example: a special item in a multiplayer game, a virtual currency, or an upgraded membership level.
In these scenarios, the server would otherwise have no knowledge that a previously fulfilled purchase was no longer valid. This new API allows the server to query for voided purchases and then revoke whatever item/currency/membership was already fulfilled.
In the client-only scenario that you described, this API would be of no use.
The Voided Purchases API fetches a list of purchases that were cancelled, refunded or charged back.
To use it, you need to make an HTTP request which returns a list of voided purchases.
GET https://www.googleapis.com/androidpublisher/v2/applications/packageName/purchases/voidedpurchases
If the item you want to check for is present in this list then it means that item has been cancelled/refunded/charged back.
Have a look at this page.
There is no mention of
inventory.getPurchase()or
onQueryInventoryFinishedon that webpage but it is apparent that they won't work.
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