Skip to content
Skip the menu

Getting started

Core concepts

The vocabulary of GameCoin on one page, from currencies and buckets to orders, keys and environments.

View as Markdown

On this page

How the pieces fit

GameCoin stores your game's economy in two layers. You describe it once in the catalog; your players then fill it with balances, items and orders.

Studio                                    your account
└─ Game                                   one per game
   ├─ Catalog   (shared by both environments)
   │  ├─ Currencies   gems (paid) · gold (free)
   │  ├─ Items        potion (consumable) · fire-sword (durable)
   │  └─ Packs        gems-500 = 500 gems + 50 free, for 4.99 €
   └─ Environments    test · live      (players, balances and orders are separate in each)
      └─ Players
         ├─ Wallet       one balance per currency, split in paid and bonus
         ├─ Inventory    the items the player owns
         └─ Orders       the packs the player bought with euros

The catalog is created in the dashboard, which is in French for now. Everything a player does with it goes through the API or an SDK.

Currencies

A currency is a name for your game's money: gems, gold, credits. Its code has 2 to 24 characters: a lowercase letter, then lowercase letters, digits or _. A code never changes.

KindWhat it meansExample
PaidPacks can sell it for euros. The catalog flag is purchasable: true.gems
FreeOnly your game hands it out: rewards, quests, daily bonuses.gold

A paid currency can also be given for free. The two kinds differ only in what packs can sell.

Balances and buckets

A player has one balance per currency. Every balance is split in two buckets:

BucketFilled byWhy it is kept apart
paidA pack bought with eurosReal money paid for these coins: a refund takes them back
bonusA grant from your server, a reward, the free part of a packFree coins: no refund applies to them

total is paid + bonus. All amounts are positive whole numbers; there are no decimals. By default a spend takes the free coins first. The rules are on Wallets and ledger.

Items

An item is something a player owns: a potion, a skin, a sword. You sell it for a currency, never for euros.

FieldMeaning
skuIts code, for example potion. 1 to 48 characters from a-z 0-9 _ . -.
typeconsumable can be used up with consume. durable stays: a player keeps a skin or a sword.
priceAn amount in a currency, or null when the item cannot be bought with a currency.
maxOwnedThe most a player can own. A durable item defaults to 1; a consumable has no limit.
clientPurchasableWhether the browser may buy it. If false, only your server can.

Packs

A pack is what a player buys with euros. It gives currency, items, or both. A pack has a price in euros, VAT included, from 0.50 € to 500.00 €, and an optional maxPerPlayer.

Each line of grants has an amount that goes to the paid bucket and a bonus that goes to the bonus bucket. The pack gems-500 has amount: 500 and bonus: 50: the player pays for 500 gems and receives 50 more.

Orders

An order is one purchase of a pack. It freezes a copy of the pack and the VAT at the moment of purchase, so changing the catalog later never changes an order.

StatusMeaning
pendingCreated; the player has not paid yet. It expires after one hour.
fulfilledPaid and delivered: the currency and items are in the player's account.
refundedRefunded: the currency and items were taken back.
failedThe payment was declined.
expiredNobody paid within the hour.
canceled, chargebackReserved for later. You will not see them yet.
paidA passing state: payment and delivery happen together, so you read fulfilled.

The full life of an order is on Selling packs.

Players

KindHow it is namedCreated by
Your player (external)ext:<your id>, with the id your game already usesYour server, the first time it writes to that id
Anonymous player (hosted)The id GameCoin gave itThe browser SDK, for a game without a backend

A player id is a GameCoin id or ext: plus your own id, and it is URL-encoded exactly once. The details are on Players and tokens.

Keys, tokens and environments

NameLooks likeLives inCan
Secret keygc_sk_test_…Your server onlyEverything the server API offers
Publishable keygc_pk_test_…The game, in the browserRead the catalog, create an anonymous player
Player tokengc_pt_…The browser, for one hourAct as one player: read, spend, buy, consume, pay

The key also picks the environment: test (simulated payments, disposable data) or live (reserved for verified studios). The catalog is shared; players, balances, ledger and orders are separate in each. See Keys and environments.

Warning

A browser can never add to a balance by itself. Only your server (with the secret key) or a paid order can, with one exception: a gift code that you issued adds free coins, once per player. This is the rule that keeps a game without a backend safe. Read Security model.

Ledger

The ledger is the list of every change to every balance. Each entry is final: it is never edited or deleted. It says what changed in each bucket, the balance after, why, and which order or item it came from. The balance of a player always equals the sum of their entries.

Where next