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.isSupported
Check if getting catalog is supported.
Bridge.payments.isGetCatalogSupported
Check if getting purchases list is supported.
Bridge.payments.isGetPurchasesSupported
Check if purchase consuming is supported.
Bridge.payments.isConsumePurchaseSupported
Purchase
Allow players to buy items or upgrades in your game to enhance their gameplay experience.
privatevoidStart(){var options =newDictionary<string,object>();switch (Bridge.platform.id) {case"yandex":options.Add("id","PRODUCT_ID");break;case"facebook":options.Add("productID","PRODUCT_ID");break;case"playdeck":options.Add("amount",1); // integeroptions.Add("description","DESCRIPTION");options.Add("externalId","EXTERNAL_ORDER_ID"); // Unique order identifier in your system, which you can use to check in postback that payment was successfulbreak; }Bridge.payments.Purchase(options, OnPurchaseCompleted);}privatevoidOnPurchaseCompleted(bool success,Dictionary<string,string> purchase){Debug.Log($"OnPurchaseCompleted, success: {success}");if (success) {switch (Bridge.platform.id) {case"yandex":Debug.Log("Product ID: "+purchase["productID"]);Debug.Log("Purchase Token: "+purchase["purchaseToken"]);break;case"facebook":Debug.Log("Product ID: "+purchase["productID"]);Debug.Log("Purchase Token: "+purchase["purchaseToken"]);break;case"playdeck":Debug.Log("Purchase Status: "+purchase["status"]);break; } }}
Consume Purchase
Consume purchased items, such as in-game currency, once they are used, to manage inventory and player progression.