I am trying to implement in-app billing in my app, everything works great except for when it comes to refunds. I have been banging my head against this for the past few days and it seems unbelievable that there is no way to know, form the app side, if a user requested a refund. I would like to be able to revoke access to a one-time managed product (remove ads) after the user has been refunded. I am not using a backend so I am relying on Google Play APIs.
What I have tried is querying the Google Play APIs with queryPurchaseHistoryAsync
which returns a list of recent purchases made by the user. This does not seem to work as the purchases are still there after asking for a refund (been waiting for one day before writing this).
Here's what I did:
- Install the app on a real device
- Buy the in-app content
- Verify that app unlocks the content
- Go to my Google Play order history and ask for refund for the in-app product
- 10 minutes later the transaction got refunded (without me as a developer being involved at all)
- App still provides the paid content
- Cleaning Play Store App data & cache
- App still provides the paid content
So any user can buy my in-app product and then immediately go to his Google Play page and ask for a refund? Is it me missing something obvious or this API is a nightmare?
The PurchaseState
enum is
public @interface PurchaseState {
// Purchase with unknown state.
int UNSPECIFIED_STATE = 0;
// Purchase is completed.
int PURCHASED = 1;
// Purchase is waiting for payment completion.
int PENDING = 2;
}
I do not see anything related to refunded here, This seems to me a pretty normal use case, so I'm still thinking that I am missing some key piece of information, how do I do this?
Thanks for any help