Payments
You are reading the documentation for Bridge SDK v2. If you need the obsolete v1 documentation, see Documentation (v1).
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.
After granting in-game items for a consumable purchase, always call consumePurchase(id). Otherwise the purchase remains "active" and purchase(id) calls for the same product will fail.
Support
Check this before showing the store or purchase buttons. If payments are unsupported, hide the IAP UI or use a non-payment fallback.
bridge.payments.isSupportedBridge.payments.isSupportedUse 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.
Bridge.payments.is_supportedplaygama_bridge_payments_is_supported()bridge.payments.is_supported()bridge.payments.isSupportedPlatform support · 11 of 26 platforms
Supports: crazy_games, discord, facebook, huawei, microsoft_store, msn, playdeck, playgama, portal, reddit, yandex
Does not support: dlightek, game_distribution, gamepush, gamesnacks, jio_games, lagged, ok, poki, samsung, telegram, tiktok, vk, xiaomi, y8, youtube
Setup
Configure products in the config under the payments key. Add an id for each product (you reference it in code) and fill in platform-specific price data under each platform key. Example for one 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.
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.
If the player loses connection during a purchase, it can remain unprocessed. Check purchases on every launch and grant or consume any pending items.
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