Why Android BillingClient v2 slow credit card test never cancels?

前端 未结 2 1050
[愿得一人]
[愿得一人] 2020-12-19 01:02

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 \"Cred

相关标签:
2条回答
  • 2020-12-19 01:20

    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

    0 讨论(0)
  • 2020-12-19 01:30

    I had the same issue. On launchBillingFlow you get a BillingResponseCode.ITEM_ALREADY_OWNED. the purchase returns PurchaseState.PENDING. If you consumeAsync immediately after, its response is BillingResponseCode.DEVELOPER_ERROR, but after a few minutes (or whatever delay the transaction takes to fail) you can consumeAsync again then it returns BillingResponseCode.ITEM_NOT_OWNED, now you are allowed to retry the launchBillingFlow again. like Lluis Felisart said create a dialog to ask the user to clear the pending,

    0 讨论(0)
提交回复
热议问题