Home » Android » android – How to detect refund with google billingclient library

android – How to detect refund with google billingclient library

Posted by: admin May 14, 2020 Leave a comment


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 :

enter image description here

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.

How to&Answers:

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


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