Why Android BillingClient v2 slow credit card test never cancels?

ぐ巨炮叔叔 提交于 2020-07-03 02:15:22

问题


I am implementing the new BillingClient library (v2.1.0) for a non-consumable in-app purchase. I am testing pending transactions with a test user. It works fine with "Credit card approves after a few minutes", but with "Slow credit card, rejects after a few minutes" the purchase state is always pending (Waited for hours after it shows as canceled on Play Console).

In order to retrieve purchae status, I am calling to mBillingClient.queryPurchases(BillingClient.SkuType.INAPP) as states in the documentation

Has anybody come across this issue before? Is it a development environment problem or does it happen for final users as well?

Thanks!


回答1:


I also discovered that in my tests, although I also remember that using the deprecated AIDL a user of my app took 24 hours to validate the purchase. I have considered the case of the refused slow card taking hours may occur and I have done the following:

If purchase.getPurchaseState() == Purchase.PurchaseState.PENDING then I show a dialog that says: Waiting for purchase validation. Sometimes it can last several hours

If the user tries to buy the item again and billingResult.getResponseCode() == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED then I show a dialog that says: Cannot buy the item. You already own it or a previous purchase is still pending for validation

Hope it will help



来源:https://stackoverflow.com/questions/59347726/why-android-billingclient-v2-slow-credit-card-test-never-cancels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!