In-Game Purchases
Last updated
Last updated
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).
Check if in-game purchases are supported to offer items or upgrades within the game.
Check if getting catalog is supported
Check if getting purchases list is supported.
Check if purchase consuming is supported.
Allow players to buy items or upgrades in your game to enhance their gameplay experience.
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"yandex\""}}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"id\"","value":"\"PRODUCT_ID\""}}]},{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"facebook\""}}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"productID\"","value":"\"PRODUCT_ID\""}}]},{"eventType":"block","conditions":[],"actions":[{"id":"payments-purchase","objectClass":"PlaygamaBridge"}]}]},{"eventType":"block","conditions":[{"id":"on-payments-purchase-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"}],"actions":[{"type":"comment","text":"success"}]}]}]}
Consume purchased items, such as in-game currency, once they are used, to manage inventory and player progression.
To consume a purchase, you need to pass its token. The token can be obtained using the action Get Purchases
.
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"yandex\""}}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"purchaseToken\"","value":"\"PURCHASE_TOKEN\""}}]},{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"facebook\""}}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"purchaseToken\"","value":"\"PURCHASE_TOKEN\""}}]},{"eventType":"block","conditions":[],"actions":[{"id":"payments-consume-purchase","objectClass":"PlaygamaBridge"}]}]},{"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":[{"type":"comment","text":"success"}]}]}]}
Retrieve a list of all available in-game items that players can purchase to display in the game store.
{"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":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"yandex\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"ID: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"id\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Title: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"title\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Description: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"description\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Image URI: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"imageURI\")"}},{"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 Currency Image: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"priceCurrencyImage\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Price Value: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"priceValue\")"}}]},{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"facebook\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"ID: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"productID\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Title: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"title\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Description: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"description\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Image URI: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"imageURI\")"}},{"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 Currency Image: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"priceCurrencyImage\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Price Amount: \" & PlaygamaBridge.PaymentsCatalogItemPropertyValue(loopindex(\"items\"), \"priceAmount\")"}}]}]}]}]}]}
Retrieve a list of items that the player has purchased to manage their inventory and provide access to purchased content.
This action is used to get purchase tokens. The token of the required purchase must be saved independently so that the required token can be passed to the Consume
action in the future.
{"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":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"yandex\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Product ID: \" & PlaygamaBridge.PaymentsPurchasePropertyValue(loopindex(\"purchases\"), \"productID\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Purchase Token: \" & PlaygamaBridge.PaymentsPurchasePropertyValue(loopindex(\"purchases\"), \"purchaseToken\")"}}]},{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"facebook\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Product ID: \" & PlaygamaBridge.PaymentsPurchasePropertyValue(loopindex(\"purchases\"), \"productID\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Purchase Token: \" & PlaygamaBridge.PaymentsPurchasePropertyValue(loopindex(\"purchases\"), \"purchaseToken\")"}}]}]}]}]}]}