In-Game Purchases

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.

Setup

Setup in-game purchases in the config file. For each product add an id and fill in the information for the required platforms, example for one product:

{
    ...    
    "payments": [
        {
            "id": "test_product",
            "playgama": {
                "amount": 1 // int price in Golden Fennec
            },
            "playdeck": {
                "amount": 1, // int price in Telegram Stars
                "description": "TEST PRODUCT"
            }
        }
    ]
}

Purchase

Allow players to buy items or upgrades in your game to enhance their gameplay experience.

Copy This Example
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"payments-purchase","objectClass":"PlaygamaBridge","parameters":{"id":"\"test_product\""}}]},{"eventType":"block","conditions":[{"id":"on-payments-purchase-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Purchase completed, id: \" & PlaygamaBridge.PaymentsLastPurchasePropertyValue(\"id\")"}}]}]}]}

Consume Purchase

Consume purchased items, such as in-game currency, once they are used, to manage inventory and player progression.

Copy This Example
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"payments-consume-purchase","objectClass":"PlaygamaBridge","parameters":{"id":"\"test_product\""}}]},{"eventType":"block","conditions":[{"id":"on-payments-consume-purchase-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Consume completed, id: \" & PlaygamaBridge.PaymentsLastPurchasePropertyValue(\"id\")"}}]}]}]}

Catalog of All Items

Retrieve a list of all available in-game items that players can purchase to display in the game store.

Copy Example
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"payments-get-catalog","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-payments-get-catalog-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PaymentsCatalogItemsCount","comparison":4,"second-value":"0"}}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"items\"","start-index":"0","end-index":"PlaygamaBridge.PaymentsCatalogItemsCount - 1"}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"ID: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"id\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Price: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"price\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Price Currency Code: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"priceCurrencyCode\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Price Value: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"priceValue\")"}}]}]}]}]}

List of Purchased Items

Retrieve a list of items that the player has purchased to manage their inventory and provide access to purchased content.

Copy This Example
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"payments-get-purchases","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-payments-get-purchases-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PaymentsPurchasesCount","comparison":4,"second-value":"0"}}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"purchases\"","start-index":"0","end-index":"PlaygamaBridge.PaymentsPurchasesCount - 1"}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"ID: \" & PlaygamaBridge.PaymentsPurchasePropertyValue(loopindex(\"purchases\"), \"id\")"}}]}]}]}]}

Last updated