Lancelot Lancelot - 14 days ago 10
Android Question

Google In App Billing v3 Handle Cancel Managed Product

My app has allows user purchases an item, it will be tracked on my server and, finally consumed, so the user can purchase again the same item.

I am using this IAB SDK to handle IAB. However, I am having a hard time checking the status of the purchase of a managed consumable product (not subscription). I need to know whether or not the payment got cancelled for any reason. Noted: the product is not yet consumed.

There is a section explaining handle canceled subscriptions but not for managed products.

I have tried calling

loadOwnedPurchasesFromGoogle
and
getPurchaseTransactionDetails(PRODUCT_ID).purchaseInfo.purchaseData.purchaseState
The state is always successful even I already cancelled the order in the Google Payment Center.
Then if I want to consume this already-cancelled order, it'll give me item not owned error.

Answer

After some additional testing, I discovered it might just take some time for the client to get the updated status on the transaction.

I tried calling bp.isPurchased(PRODUCT_ID); again and got it returned false. It might not be real time report, but better than nothing.