问题
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.
回答1:
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
回答2:
Scrape the Google Console. That's what I do.
来源:https://stackoverflow.com/questions/46543008/how-to-detect-canceled-or-refunded-order-for-google-in-app-billing