简体   繁体   中英

How to consume all products using Flutter's in_app_purchase for Android on startup

I'm not sure if there is a way to consume products on the server side.

I have an android app and if a user's purchase goes through instantly, the server is notified and the user receives the goods, and it is consumed by the client. But if the user closes the app while the purchase is pending, the server is notified by RTDN after the purchase completes and the user receives the goods, BUT the product is not consumed. Without consuming, the user can not purchase the same product again.

Is there a way of checking for unconsumed products when the user opens the app and consume all of them?

Ok I figured it out by calling

await InAppPurchase.restorePurchases();

after the in app billing fully loads. The listener for your purchases will then process the unconsumed products.

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