Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do refunded managed items need to be consumed?

In my app I provide a Premium upgrade through a managed purchase (it can only be bought once) - not a subscription.

When a purchase is re-funded, the user doesn't seem to be able to re-purchase the upgrade:

int billingFlowResponseCode = billingClient.launchBillingFlow(activity, flowParams); returns ITEM_ALREADY_OWNED.

This question here seems to suggest that after about 24 hours the user should be able to purchase the item. However more than 36 hours have passed and no luck.

My question is: For a managed item that was refunded or cancelled, do I need to consume it in order to be able to purchase it again?

Or do I need to wait for more time..?

like image 801
Minas Mina Avatar asked Mar 28 '26 23:03

Minas Mina


1 Answers

Okay, I have found the way...

What needs to be done is:

  1. The client queries the user's purchases (I use the app-billing library).
  2. The client contacts the server with the purchase tokens in order to find out which purchases are still valid.
  3. The server calls the GET purchase endpoint of the Google's API (https://developers.google.com/android-publisher/api-ref/purchases/products/get), checks if the purchase needs to consumed and returns this information to the client. (A purchase needs to be consumed if purchase.purchaseState == 1 && purchase.consumptionState == 0).
  4. For those purchases that need to be consumed, the client calls BillingClient::consume().

It would have been much easier if there was an option in the Play Console to mark items as "consumable" or not - so that there wouldn't be a need to manually consume items if they were "non-consumable" in the first place.

like image 109
Minas Mina Avatar answered Mar 31 '26 05:03

Minas Mina



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!