I was wondering how to detect a refund, or any type of cancelation of an in-app purchase(not a subscription and not a consumable).
I'm currently making my test and when I refund a test in google like that :
The purchase is still present in billingClient.queryPurchaseHistoryAsync()
(even in queryPurchase()
).
How can I detect such changes and how can I disable my app for refunded users?
Thanks in advance.
I do understand your concern regarding refunded items.
If you offer in-app products, you can use the Voided Purchases API to request a list of voided purchases for your in-app products. When a user requests a refund for in-app purchases, you can see what was purchased and take back the refunded digital goods from that user.
To protect you app from refund abuse please use the Protect your apps from refund abuse help guide, for the best practises in protecting your app’s in-app products.
Have to tried this function
PurchasesUpdatedListener
Listener interface for purchase updates which happen when, for example, the user buys something within the app or by initiating a purchase from Google Play Store.
void onPurchasesUpdated (int responseCode,
List<Purchase> purchases)
Implement this method to get notifications for purchases updates. Both purchases initiated by your app and the ones initiated by Play Store will be reported here.
OnPurchasesUpdated on developer.android