store.consumePurchase()

Type Function
Return value none
Revision Release 2024.3703
Keywords Google, IAP, in-app purchases, consumePurchase
See also store.purchase()

Overview

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.

Gotchas

Syntax

This function has two alternative syntaxes

store.consumePurchase( productIdentifier )
store.consumePurchase( transaction )
productIdentifier (required)

String. String representing the product identifier of the item to consume.

transaction (required)

Table. Table containing data related to the transaction to be consumed.