7
votes

I have red a lot of posts and Google documents, but am still not clear how to tell an in-app purchase has been refunded. I have red carefully In-App Billing v3 - Don't detect refund and Does Google Play In-App Billing Version 3 support refunds?.

I believe that I took the following notes from an official Google document a while ago by copy & paste:

purchaseState: The purchase state of the order. Possible values are 0 (purchased), 1 (canceled), or 2 (refunded).

Now, the official document has the following:

-> purchaseState: The purchase state of the order. It always returns 0-

(purchased).

More specifically, if an IAB purchase is refunded or canceled, is that still in the user's inventory obtained by mHelper.queryInventoryAsync(mGotInventoryListener)? If so, how can one tell the purchase has been canceled or refunded?

Update [2019-12-12]:

I have tested many times and confirmed the following:

If an order is canceled after refunding, it will disappear from the results returned by getPurchasesList. The time it takes for this to happen varies. It could be minutes to over 10 hours. I think this depends on when Google Play refreshes its cache. It seems that one can open Google Play to refresh its cache. In one case, getPurchasesList still returned a refunded purchase more than 10 hours after refunding, but it stopped returning it as soon as Google Play is opened.

2
Did you ever get any more info on this? After refunding an order I still see purchaseState as 0.Flyview
@Flyview No unfortunately. I think one way to deal with this is downloading all the voided orders to your own server, then check the order number against the data. developers.google.com/android-publisher/voided-purchases It is quite some work. I have not done it yet.Hong
That's so strange. Why can't they just make it automatic like they do for subscriptions and just not return that the user has that purchase?Flyview
@Flyview I remember that Google offers downloading all orders, but I am unable to find the API now. I will ask them tomorrow. There are quite some fake IAB purchases (check out this video among many hacks: youtu.be/3Zww3s8_A5g). Checking against the downloaded transactions would be a way to deal with these fake purchases.Hong
@JosephMcDermott The cache problem of Google Play has been a chronic headache.Hong

2 Answers

5
votes

Have you checked out the voided purchase list API? It returns a list of cancelled, refunded or charged-back purchases.

https://developers.google.com/android-publisher/api-ref/purchases/voidedpurchases/list

-1
votes

Scrape the Google Console. That's what I do.