Type Function Return value none Revision Release 2024.3703 Keywords Google, IAP, in-app purchases, consumePurchase See also store.purchase()
This function “consumes” purchases and makes the item(s) available for purchase again. In Google IAP, once a product is purchased, it is considered “owned” and it cannot be purchased again. Thus, you must use this function to revert “owned” products to “unowned” products so they become available for purchase again.
Note that some items are designed to be purchased only once and you should not consume them. For example, if a purchase unlocks a new world within a game, it should be ineligible for future consumption. Alternatively, some items can be purchased multiple times, for example energy packs and gems — these type of items must be consumed before they can be purchased again. For further information, please see Google’s documentation.
Consuming purchases is not instantaneous. It’s recommended that you wait a few minutes after calling store.consumePurchase()
, then verify that the consumption actually happened.
Consuming products also discards their previous purchase data.
When a product is consumed, the transaction state will be "consumed"
. There are no callbacks for invalid products.
This function has two alternative syntaxes
store.consumePurchase( productIdentifier ) store.consumePurchase( transaction )
String. String representing the product identifier of the item to consume.
Table. Table containing data related to the transaction to be consumed.