简体   繁体   中英

How do you test Android in app billing with non-consumable products

So I'm building an Android app that uses the "freemium" monetization model. I'm able to make purchases with a "test card, always approves" of the "premium" upgrade non consumable product just fine. The problem I'm having is once I make that purchase, I can never test purchase the same non consumable product again. I've followed the testing recommendations here: https://developer.android.com/google/play/billing/test . I've cancelled/refunded the test purchase as outlined here: https://support.google.com/googleplay/android-developer/answer/2741495 . I got a confirmation e-mail from google about the order cancellation on the e-mail address associated with the test card. The google play console under order management confirms the test purchase is refunded. However, BillingClient.launchBillingFlow() now consistently returns BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED now. I've tried this on multiple Android devices associated with the same test card google account. I do have code in place to acknowledge a purchase with BillingClient.acknowledgePurchase() in PurchasesUpdatedListener.onPurchasesUpdated(), so I believe my in app purchasing code is complete, flow wise. I'd really like to do more testing before release and this problem is certainly making that harder. Is there a way to revoke the product's owned status? The order/refund cancel procedure google provides in their documentation apparently doesn't work. I'd rather avoid having to make many google accounts for no other reason that using each one just once to make a test purchase. Any thoughts?

Thanks, Omri

If you want to buy the same test product again, you just call billingClient.consumeAsync (); and then you can buy it again, this will obviously only be valid for your tests.

Google does not distinguish whether an in-app product is consumable or not, it is your code that decides to consume it or not.

If you are talking about subscription, then you can simply go to Play store with your email that purchased the product and under subscriptions section cancel the purchased subscription by giving any reason. Woila you are done. Now you can again purchase same product.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM