Payments
In-game purchases let players buy items, upgrades, or currency. Often the highest-revenue feature for games that fit the IAP model. Enable payments only after ads, storage, and the core game loop are stable.
Two product types
Consumable
Coins, gems, energy
Bought, granted, then must be consumed with consumePurchase(id). Until consumed it sits in the purchases list.
Support
Check this before showing the store or purchase buttons. If payments are unsupported, hide the IAP UI or use a non-payment fallback.
Use the PlaygamaBridge Is Payments Supported condition before showing the store or purchase buttons.
Use the PlaygamaBridge Is Payments Supported condition before showing the store or purchase buttons.
Setup
Setting up a product takes two steps.
1. List the product ids in the config under the payments key. Each entry needs only an id — the identifier you reference in code:
2. Describe the products in each platform's dashboard. Prices, titles, descriptions, and other product data are not stored in the config — fill them in the developer dashboard of every platform you publish on (Playgama, Yandex, etc.), using the same ids.
If a platform requires a product id that differs from the one in your config, add the platform override next to the product:
Purchase
Start a purchase flow for the product ID from your config. Call this only from a direct player action, such as pressing a buy button.
In the event sheet:
On a trigger (e.g. Button → On clicked), optionally add extra options with Add Action Parameter, then add the Payments Purchase action (parameter: ID).
Add the On Payments Purchase Completed condition. Inside it, when Is Last Action Completed Successfully, read fields with the
PlaygamaBridge.PaymentsLastPurchasePropertyValue("id")expression.
In the events sheet:
On a trigger (e.g. Button is clicked), optionally add extra options with Add Action Parameter, then add the Payments Purchase action (parameter: Id).
Add the On Payments Purchase Completed condition. Inside it, when Is Last Action Completed Successfully, read fields with the
PlaygamaBridge::PaymentsLastPurchasePropertyValue("id")expression.
Each platform returns its own purchase fields. Check the target platform documentation before depending on platform-specific properties.
Use the returned purchase data for backend verification before granting valuable items. Playgama API verification currently supports only playgama, msn, and microsoft_store.
Consume Purchase
Mark a consumable purchase as used after you grant the in-game item. Do not call this for permanent products.
In the event sheet:
On a trigger (e.g. Button → On clicked), add the Payments Consume Purchase action (parameter: ID).
Add the On Payments Consume Purchase Completed condition. Inside it, check Is Last Action Completed Successfully.
In the events sheet:
On a trigger (e.g. Button is clicked), add the Payments Consume Purchase action (parameter: Id).
Add the On Payments Consume Purchase Completed condition. Inside it, check Is Last Action Completed Successfully.
Catalog of All Items
Load the product catalog before showing your store. Use it for localized prices, currency codes, and platform-specific product metadata.
In the event sheet:
On a trigger (e.g. Button → On clicked), add the Payments Get Catalog action.
Add the On Payments Get Catalog Completed condition. Inside it, when
PlaygamaBridge.PaymentsCatalogItemsCount > 0, loop with System → For from0toPaymentsCatalogItemsCount - 1and read each field withPaymentsCatalogItemPropertyValue(index, "id" / "price" / "priceCurrencyCode" / "priceValue").
In the events sheet:
On a trigger (e.g. Button is clicked), add the Payments Get Catalog action.
Add the On Payments Get Catalog Completed condition. Inside it, Repeat
PlaygamaBridge::PaymentsCatalogItemsCount()times and read each field withPaymentsCatalogItemPropertyValue(index, "id" / "price" / "priceCurrencyCode" / "priceValue").
List of Purchased Items
Load the player's active purchases on startup and after reconnecting. Use this for permanent ownership checks and unprocessed consumables.
In the event sheet:
On a trigger (e.g. Button → On clicked), add the Payments Get Purchases action.
Add the On Payments Get Purchases Completed condition. Inside it, when
PlaygamaBridge.PaymentsPurchasesCount > 0, loop with System → For from0toPaymentsPurchasesCount - 1and read each purchase withPaymentsPurchasePropertyValue(index, "id").
In the events sheet:
On a trigger (e.g. Button is clicked), add the Payments Get Purchases action.
Add the On Payments Get Purchases Completed condition. Inside it, Repeat
PlaygamaBridge::PaymentsPurchasesCount()times and read each purchase withPaymentsPurchasePropertyValue(index, "id").
Last updated