Google consumable in-apps

Can someone clear up for me how to implement consumable in-apps for Google Play?

Several years ago Google dropped unmanaged products and now you are supposed to call consumeAsync() to consume a product and make it purchasable again.
https://developer.android.com/reference/com/android/billingclient/api/BillingClient.html#consumeasync

How that translated to Defold? There is only iap.finish(), but it’s supposed to be called for both consumables and non-consumables. So I am a bit lost here.

Google Play

If you want to have a non-consumable purchase just don’t finish it. Turn-off Auto Finish checkbox in game.project and don’t call iap.finish()

For using a consumable purchase just finish your purchase. If you have both types in your app or you want to manually finish them (because you have a server validation, for example), then turn-off Auto Finish checkbox in game.project and finish it manually using iap.finish().

App Store

Here you have the option Non-consumable when you create a purchase. That means you need to finish all purchases when you provide the product to your user. You can do it automatically using Auto Finish checkbox in game.project or manually (if you want to do that after server validation, for example) using iap.finish()

5 Likes

Thanks. Initially finishing a transaction was used to make sure the user gets the product if for instance the app crashes after receiving transaction, but before unlocking paid content. In that case when the app starts again it receives all unfinished transactions.
I see that with Defold that logic is different now, I guess that should be noted in the docs.

Exactly. If you don’t finish a transaction then a user did not consume it. It could be possible in two different cases:

  • this is a non-consumable purchase. A user just can’t consume it. For example “Turn-off ads” - you can override this flag every time when you receive the transaction from the store.
  • you didn’t finish it because of technical issues as you describe. In this case, you receive it again after start application and have the possibility to provide a product to your user and then finish it.
2 Likes