Google Play In app billing

We have setup some in-app purchasable products through google’s in-app billing plugin (plugin.google.iap.billing) in our app. We have both consumable and non-consumable products. We have been struggling with restoring products and refunds.

After rigorous testing, we found the plugin would restore the recently bought consumable product if the restore function is called immediately after buying. However, it will only restore the consumable product once. We have a restore option for users who have reinstalled the app and want to get their non-consumable entitlements back. Moreover, sometimes the consumable products start behaving like a one-time purchase or non-consumeable products even though we call the consumePurchase function when such product is purchased.

The second problem is with refunds. There’s a refund state for transactions in the plugin, but it doesn’t get triggered ever in my testing. I refunded the products from the google play console and the refund takes place almost instantly, but the state is not triggered when debugging in our program. We want to avoid users exploiting the system by making a purchase and then requesting a refund as this has been happening lately on one of our apps.

I am sure many of the devs here have encountered these issues and have probably found the solution, we would be very grateful if anyone can share their solution.

Are you doing store.consumePurchase on the consumable items once they’re used?

And as for refunds, it’s not going to push the notification to your app. But if you do a restorePurchase call again, those transaction should come through with a state of refund. If you need immediate notification of a refund, you’ll need to use Google’s Pub/Sub service where they send you receipts to your server and you deal with them there.

There’s a discussion in this thread that might be applicable to your issue with consumables sometimes acting like one-time purchases:

Yes, I have been using consumePurchase function on consumable products. And restore doesn’t trigger refund state instead it fires the purchase state(the docs also states the same). I have tested it many times the transition.state never gets “consumed” and “refunded” string.

thanks for directing to the thread but I had already given the solution a try by making the consumePurchase call when the state is failed.

Earlier there used to be a distinction on google play console while making new products, there used to be an option to make consumable and non-consumable but now they seem to have removed that option. This makes me think-- how will the plugin know if this item is consumable or not.

Can you please give more insights on how you fixed the problem? I am getting “you already own this item” error 7.

@vlads can you please look into why this plugin is failing for so many devs here?

1 Like

For me, adding a consumePurchase call to getting a failed state worked.

I’ve been using my updated version of IAP Badger with the new Google billing API since the end of October. Income is essentially the same as for the previous period, and I haven’t had a single customer complaint.