Apilow GameCoin documentation
Build the bank of your game
Virtual currency, inventory and orders for web and mobile games. A ledger you can trust, packs sold in euros, and an API you call from the browser, your server, or both.
Your first call
Grant a player 100 gems. The player is ext:user-42: your own id for them, which GameCoin creates on first use. Write requests carry an Idempotency-Key, so a retry never credits twice.
- Test keys are created with your game: payments are simulated, nothing moves.
- Every change is an immutable ledger entry; balances stay exact.
- The key picks the game and the environment: your code never changes to go live.
curl -X POST "https://gamecoin.apilow.com/api/v1/players/ext%3Auser-42/wallet/grant" \
-H "Authorization: Bearer $GAMECOIN_SECRET_KEY" \
-H "Idempotency-Key: welcome-user-42" \
-H "Content-Type: application/json" \
-d '{"currency": "gems", "amount": 100, "reason": "welcome_gift"}'import { GameCoin, ext } from "@apilow/gamecoin";
const gamecoin = new GameCoin(process.env.GAMECOIN_SECRET_KEY, { baseUrl: "https://gamecoin.apilow.com" });
const { balance } = await gamecoin.wallet.grant(
ext("user-42"),
{ currency: "gems", amount: 100, reason: "welcome_gift" },
{ idempotencyKey: "welcome-user-42" },
);
console.log(balance.total); // 100import os
from gamecoin import GameCoin, ext
gamecoin = GameCoin(os.environ["GAMECOIN_SECRET_KEY"], base_url="https://gamecoin.apilow.com")
movement = gamecoin.wallet.grant(
ext("user-42"),
currency="gems",
amount=100,
reason="welcome_gift",
idempotency_key="welcome-user-42",
)
print(movement.balance.total) # 100Three ways to integrate
What changes between them is who may credit. A browser can read, spend and pay; only your server, or a paid order, can add to a balance.
What do you want to do?
SDKs for every stack
Compare the SDKs<script src="https://gamecoin.apilow.com/sdk/gamecoin-1.2.0.js">One file, no dependencyNode.js0.4.0npm install @apilow/gamecoinTypeScript types includedPython0.4.0pip install apilow-gamecoinPython 3.9+, typedPHP0.4.0composer require apilow/gamecoinPHP 8.1+Go0.4.0go get github.com/apilow/gamecoin-goStandard library onlyC# / .NET0.4.0dotnet add package Apilow.GameCoin.NET 8 and Standard 2.1The server SDKs are a pre-release and are not on the package registries yet. Each page gives the install command that will work once the package exists.
The API at a glance
About GameCoin
What GameCoin is
GameCoin is the bank of your game. It keeps the virtual currency, the inventory and the orders of a web or mobile game, so you do not build a ledger, a payment flow or VAT handling yourself.
Every change to a balance is an immutable entry in a ledger, so balances stay exact when a request is retried, sent twice, or refunded. You sell currency packs for euros through a hosted payment page, and players spend the currency on items and on anything else your game offers. You call GameCoin from the browser, from your server, or both, and a browser can never add coins to a balance, except the free coins of a gift code that you issued.
Note
The test environment is open to every studio, and payments there are simulated: no money moves. Verified studios sell for real in the live environment. See Going live.
Studio ─ Game ─ Catalog what you sell, defined once
├─ Currencies gems (paid), gold (free)
├─ Items potion (consumable), fire-sword (durable)
└─ Packs "500 gems + 50 free" for 4.99 €
Players ─ Wallet one balance per currency: paid + bonus
├ Inventory the items a player owns
└ Orders the packs a player bought, in eurosYou describe the catalog once. Your players then fill it with balances, items and orders. Each change to a balance is written in the ledger and never altered. Read Core concepts for the words used everywhere, one by one.
Three ways to integrate
| Where your code runs | Key | Good for | |
|---|---|---|---|
| Browser only | In the browser, with the SDK | Publishable key | A game with no server: itch.io, a game jam, a no-code engine |
| Server and browser | Your server holds the rules; the browser shows and spends | Secret key on the server, publishable key and a token in the browser | A game with accounts, rewards and rules to enforce |
| Server only | Your server calls the API; no GameCoin code in the game | Secret key | A backend that sells and credits, with its own client |
What changes between them is who may credit. A browser can read, spend, buy items and pay for packs, and it can never add to a balance by itself. Only your server, with the secret key, or a paid order can; the one exception is a gift code you issued, which adds free coins once per player. Security model explains why.
Choose your path
| You want to… | Start here |
|---|---|
| Have something that runs, in one file | One page: a working game |
| Try everything in ten minutes | Quickstart |
| Sell currency in a game with no server | A game without a backend |
| Reward players and run the rules from your server | A game with a backend |
| Sell packs for euros, and understand VAT and orders | Selling packs |
| Understand balances, refunds and debts | Wallets and ledger |
| Give players a ready-made shop page | The hosted shop |
| Show that shop inside your web game | Shop widget |
| Look up every call of the browser SDK | Browser SDK |
| Call the API from your own language | Server SDKs and API reference |
What you need
- A GameCoin account, and a game in the dashboard. The dashboard speaks French, English and Dutch; this documentation names the French labels where you need them.
- Your keys: the publishable key
gc_pk_test_…for the browser, and the secret keygc_sk_test_…for your server. Test keys are created with the game. - A catalog: at least one currency and one pack. Quickstart lists the steps.
How this documentation is organised
| Section | What it holds |
|---|---|
| Getting started | This page, the quickstart and the core concepts |
| Concepts | One page per subject, with the exact rules: the ledger, players, keys, idempotency, security, errors, rate limits |
| Guides | Complete walkthroughs you can run |
| Browser SDK | The reference of gamecoin.js and of the shop widget |
| Server SDKs | The SDKs for Node.js, Python, PHP, Go and C# |
| API reference | Every route, field and error |
For AI assistants
Every page is also served as plain Markdown: add .md to its address (https://gamecoin.apilow.com/docs/quickstart.md). /llms.txt lists the pages with a one-line description, and /llms-full.txt holds the whole documentation in one file. The API is also described as an OpenAPI 3.1 document at /api/v1/openapi.json.