Enable players to purchase items, upgrades, or currency within your game to enhance their experience and generate revenue.
There are two types of purchases — permanent (e.g., ad removal) and consumable (e.g., in-game coins).
Support
Check if in-game purchases are supported to offer items or upgrades within the game.
bridge.payments.is_supported()
Check if getting catalog is supported.
bridge.payments.is_get_catalog_supported()
Check if getting purchases list is supported.
bridge.payments.is_get_purchases_supported()
Check if purchase consuming is supported.
bridge.payments.is_consume_purchase_supported()
Purchase
Allow players to buy items or upgrades in your game to enhance their gameplay experience.
local bridge = require("bridge.bridge")
function init(self)
local options = {
yandex = {
id = "PRODUCT_ID"
},
facebook = {
productID = "PRODUCT_ID"
},
playdeck = {
amount = 1,
description = "DESCRIPTION",
externalId = "EXTERNAL_ORDER_ID" -- Unique order identifier in your system, which you can use to check in postback that payment was successful
}
}
bridge.payments.purchase(options, function (_, data)
-- success
end, function ()
-- error
end)
end
Consume Purchase
Consume purchased items, such as in-game currency, once they are used, to manage inventory and player progression.
local bridge = require("bridge.bridge")
function init(self)
local options = {
yandex = {
purchaseToken = "PURCHASE_TOKEN"
},
facebook = {
purchaseToken = "PURCHASE_TOKEN"
}
}
bridge.payments.consume_purchase(options, function ()
-- success
end, function ()
-- error
end)
end
Catalog of All Items
Retrieve a list of all available in-game items that players can purchase to display in the game store.
local bridge = require("bridge.bridge")
function init(self)
bridge.payments.get_catalog(function (_, data)
-- success
end, function ()
-- error
end)
end
List of Purchased Items
Retrieve a list of items that the player has purchased to manage their inventory and provide access to purchased content.
local bridge = require("bridge.bridge")
function init(self)
bridge.payments.get_purchases(function (_, data)
-- success
end, function ()
-- error
end)
end