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.