如何检测 Google 应用内结算的取消或退款订单?

How to detect canceled or refunded order for Google in-app billing?

我刷了很多帖子和 Google 文件,但我仍然不清楚如何判断应用内购买已退款。我有红仔细In-App Billing v3 - Don't detect refund and Does Google Play In-App Billing Version 3 support refunds?.

我相信我不久前通过复制和粘贴从官方 Google 文档中获取了以下笔记:

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

现在,the official document 有以下内容:

->purchaseState:订单的购买状态。它总是 returns 0-

(purchased).

更具体地说,如果 IAB 购买被退款或取消,那么它是否仍在 mHelper.queryInventoryAsync(mGotInventoryListener) 获得的用户库存中? 如果是这样,如何判断购买已取消或退款?

更新[2019-12-12]:

我测试了很多次,确认如下:

如果订单在退款后被取消,它会从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返回的结果中消失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退款后10个多小时仍然退回已退款的购买,但Google立即停止退货] 播放打开。

你查过作废的购买清单吗API?它 returns 已取消、已退款或退款的购买列表。

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

抓取 Google 控制台。我就是这么做的。