Playgama
  • Welcome
  • 🚀Quick start
  • Submitting a game
  • Game Requirments
    • 💥Self-check
    • Technical Requirements
    • Advertising Requirements
    • User Experience Requirements
    • Content Requirements
    • Other Requirements
    • Platform-Specific Requirements
  • In-Game Purchases
    • Step-by-step IAP integration guide for Unity
  • FAQ
    • General
    • Submitting a Game
    • Game Moderation
    • Payments and Statistics
  • SDK
    • Getting started
    • Engines
      • Core (Plain JS)
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Unity
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Construct 3
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • GDevelop
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Godot
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Game Maker
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Defold
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
    • Changelog
  • For Partners
    • Getting Started
    • Embed the Widget
      • Adding Games Widget to Your WordPress Site
      • Adding Games Widget to Your Tilda Site
      • Adding Games Widget to Your Framer Site
    • Import the Game Catalog
    • Share your referral link
Powered by GitBook
On this page
  1. SDK
  2. Engines
  3. Game Maker

In-Game Purchases

PreviousAchievementsNextRemote Configuration

Last updated 26 days ago

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.

playgama_bridge_payments_is_supported()

Setup

Setup in-game purchases in the . For each product add a commonId and fill in the information for the required platforms, example for one product:

{
    ...    
    "payments": [
        {
            "commonId": "test_product",
            "yandex": {
                "id": "YANDEX_ID_HERE"
            },
            "facebook": {
                "productID": "FACEBOOK_ID_HERE"
            },
            "msn": {
                "productId": "MSN_ID_HERE"
            },
            "playgama": {
                "amount": 1 // price in Golden Fennec
            },
            "qa_tool": {
                "id": "QA_TOOL_ID_HERE",
                "amount": 1 // price in Golden Fennec
            },
            "playdeck": {
                "amount": 1, // price in Telegram Stars
                "description": "TEST PRODUCT"
            }
        }
    ]
}

Purchase

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

var commonId = "test_product" // commonId you specified in the config file
playgama_bridge_payments_purchase(commonId)

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_payments_purchase_callback" {
    if async_load[? "success"] {
        var purchase = json_parse(async_load[? "data"])
        var commonId = purchase.commonId
        // your logic here
    }
}

// callback via script
function playgama_bridge_payments_purchase_callback(success, data) {
    if success {
        var purchase = json_parse(data)
        var commonId = purchase.commonId
        // your logic here
    }
}

Consume Purchase

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

var commonId = "test_product" // commonId you specified in the config file
playgama_bridge_payments_consume_purchase(commonId)

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_payments_consume_purchase_callback" {
    if async_load[? "success"] {
        // your logic here
    }
}

// callback via script
function playgama_bridge_payments_consume_purchase_callback(success) {
    if success {
        // your logic here
    }
}

Catalog of All Items

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

playgama_bridge_payments_get_catalog()

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_payments_get_catalog_callback" {
    if async_load[? "success"] {
        var catalog = json_parse(async_load[? "data"])
        for (var i = 0; i < array_length(catalog); i += 1)
	{
	    var catalogItem = catalog[i]
            var commonId = catalogItem.commonId
            var price = catalogItem.price
            var priceCurrencyCode = catalogItem.priceCurrencyCode
            var priceValue = catalogItem.priceValue
            // your logic here
	}
    }
}

// callback via script
function playgama_bridge_payments_get_catalog_callback(success, data) {
    if success {
        var catalog = json_parse(data)
        for (var i = 0; i < array_length(catalog); i += 1)
	{
	    var catalogItem = catalog[i]
            var commonId = catalogItem.commonId
            var price = catalogItem.price
            var priceCurrencyCode = catalogItem.priceCurrencyCode
            var priceValue = catalogItem.priceValue
            // your logic here
	}
    }
}

List of Purchased Items

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

If the user loses internet connection when making an in-game purchase, the purchase might remain unprocessed. To avoid this, check for unprocessed purchases using this method (e.g., each time the game is launched).

playgama_bridge_payments_get_purchases()

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_payments_get_purchases_callback" {
    if async_load[? "success"] {
        var purchases = json_parse(async_load[? "data"])
        for (var i = 0; i < array_length(purchases); i += 1)
	{
	    var purchase = purchases[i]
            var commonId = purchase.commonId
            // your logic here
	}
    }
}

// callback via script
function playgama_bridge_payments_get_purchases_callback(success, data) {
    if success {
        var purchases = json_parse(data)
        for (var i = 0; i < array_length(purchases); i += 1)
	{
	    var purchase = purchases[i]
            var commonId = purchase.commonId
            // your logic here
	}
    }
}
config file