Allow players to buy items or upgrades in your game to enhance their gameplay experience.
func _ready():
var commonId = "test_product" # commonId you specified in the config file
Bridge.payments.purchase(commonId, funcref(self, "_on_purchase_completed"))
func _on_purchase_completed(success, purchase):
print(success)
func _ready():
var commonId = "test_product" # commonId you specified in the config file
Bridge.payments.purchase(commonId, Callable(self, "_on_purchase_completed"))
func _on_purchase_completed(success, purchase):
print(success)
Consumable
Consume purchased items, such as in-game currency, once they are used, to manage inventory and player progression.
func _ready():
var commonId = "test_product" # commonId you specified in the config file
Bridge.payments.consume_purchase(commonId, funcref(self, "_on_consume_completed"))
func _on_consume_completed(success):
print(success)
func _ready():
var commonId = "test_product" # commonId you specified in the config file
Bridge.payments.consume_purchase(commonId, Callable(self, "_on_consume_completed"))
func _on_consume_completed(success):
print(success)
Catalog of All Items
Retrieve a list of all available in-game items that players can purchase to display in the game store.
Retrieve a list of items that the player has purchased to manage their inventory and provide access to purchased content.
If the user loses internet connection when making an in-game purchase, the purchase might remain unprocessed. To avoid this, check for unprocessed purchases using this method (e.g., each time the game is launched).
func _ready():
Bridge.payments.get_purchases(funcref(self, "_on_get_purchases_completed"))
func _on_get_purchases_completed(success, purchases):
print(success)
for purchase in purchases:
print("Common Id: " + str(purchase.commonId))
func _ready():
Bridge.payments.get_purchases(Callable(self, "_on_get_purchases_completed"))
func _on_get_purchases_completed(success, purchases):
print(success)
for purchase in purchases:
print("Common Id: " + str(purchase.commonId))