Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use case of new Voided Purchases API

Tags:

android

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?

like image 571
Cheok Yan Cheng Avatar asked Dec 24 '22 20:12

Cheok Yan Cheng


2 Answers

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.

like image 87
Brian P. Hamachek Avatar answered Jan 14 '23 11:01

Brian P. Hamachek


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
onQueryInventoryFinished
on that webpage but it is apparent that they won't work.
like image 35
Gaurav Anand Avatar answered Jan 14 '23 13:01

Gaurav Anand