Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Android BillingClient v2 slow credit card test never cancels?

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!

like image 214
Spirrow Avatar asked Dec 15 '19 20:12

Spirrow


Video Answer


1 Answers

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

like image 112
from56 Avatar answered Oct 14 '22 20:10

from56