Skip to content
Skip the menu

API reference

API objects

The shape of every object the GameCoin API returns, with its fields, its possible values and a real example.

View as Markdown

On this page

This page describes the objects that the operations of the API reference return. Every example below is a real response from the test environment.

Conventions. Field names are in camelCase. A type written string or null is always present and is null when there is no value: a field is never missing. Dates are ISO 8601 strings in UTC, with milliseconds. Amounts are integers: virtual currencies in their smallest unit, euro prices in cents. Ids are 24 hexadecimal characters. Unknown fields may be added to a response in the future: ignore the ones you do not know.

Player

A person who plays your game.

FieldTypeDescription
idstringThe GameCoin player id.
externalIdstring or nullYour own id for the player, without the ext: prefix. null for an anonymous player.
kindstringexternal for a player created by your backend, hosted for an anonymous player created by the client API.
displayNamestring or nullThe name shown in your game.
countrystring or nullThe ISO 3166-1 alpha-2 country, such as BE.
blockedbooleantrue when the player is blocked: they are refused on every client route and on wallet and inventory writes.
createdAtstringWhen the player was created.

The e-mail address and the birth year you may store with Create or update a player are never returned.

JSON
{
  "id": "665f1c2e8a3b4d5e6f708192",
  "externalId": "user-42",
  "kind": "external",
  "displayName": "Alice",
  "country": "BE",
  "blocked": false,
  "createdAt": "2026-10-05T22:14:34.808Z"
}

Balance

The balance of a player in one currency, split in two parts.

FieldTypeDescription
currencystringThe currency code.
paidintegerUnits bought with real money. This is the part a refund takes back.
bonusintegerUnits granted or earned for free.
totalintegerpaid plus bonus.

paid and total can be negative after a refund of coins that were already spent: see Refund an order.

JSON
{ "currency": "gems", "paid": 0, "bonus": 100, "total": 100 }

Wallet

All the balances of a player.

FieldTypeDescription
playerIdstringThe player's id.
balancesarray of BalanceOne balance per active currency, zeros included.
JSON
{
  "playerId": "665f1c2e8a3b4d5e6f708192",
  "balances": [
    { "currency": "gems", "paid": 0, "bonus": 70, "total": 70 },
    { "currency": "gold", "paid": 0, "bonus": 0, "total": 0 }
  ]
}

LedgerEntry

One immutable line of a player's ledger: what changed a balance, and the balance right after.

FieldTypeDescription
idstringThe entry id. Ids sort by creation time.
typestringWhat produced the entry: see Ledger entry types.
currencystringThe currency code.
paidDeltaintegerThe change of the paid part: negative when coins are taken.
bonusDeltaintegerThe change of the bonus part: negative when coins are taken.
balanceAfterobjectThe balance right after the entry: paid, bonus and total.
reasonstring or nullThe reason you gave, if any.
metadataobjectThe metadata you gave: string to string pairs, {} when none. A paid order sets pack, the sku of the pack.
refobjectWhat the entry relates to: orderId for an entry caused by an order, itemSku for the purchase of an item. {} when it relates to nothing.
createdAtstringWhen the entry was written.

A grant, with its reason and metadata:

JSON
{
  "id": "6ac4214bae33663917ec0ca6",
  "type": "grant",
  "currency": "gems",
  "paidDelta": 0,
  "bonusDelta": 100,
  "balanceAfter": { "paid": 0, "bonus": 100, "total": 100 },
  "reason": "level_up",
  "metadata": { "level": "5" },
  "ref": {},
  "createdAt": "2026-10-05T22:14:35.965Z"
}

The delivery of a pack, written when the order was paid:

JSON
{
  "id": "6ac4214aad31ce32f56b16e4",
  "type": "purchase_credit",
  "currency": "gems",
  "paidDelta": 500,
  "bonusDelta": 50,
  "balanceAfter": { "paid": 500, "bonus": 50, "total": 550 },
  "reason": null,
  "metadata": { "pack": "gems-500" },
  "ref": { "orderId": "665f1c2e8a3b4d5e6f7081b4" },
  "createdAt": "2026-10-05T22:14:34.070Z"
}

Ledger entry types

typeWritten whenpaidDelta / bonusDelta
grantYour backend grants currencybonusDelta positive (a debt is repaid first)
spendCurrency is spent, or an item is bought (ref.itemSku)Negative
purchase_creditAn order is paid and its pack delivered (ref.orderId)paidDelta is the pack's amount, bonusDelta its bonus
refund_clawbackAn order is refunded (ref.orderId)Negative
chargeback_clawbackThe cardholder disputes the payment of an order (ref.orderId)Negative
adjustmentA manual correction made by the studioEither sign
gift_codeA player redeems a gift code (metadata.code is the code)bonusDelta positive: gift codes only give free coins

InventoryItem

A quantity of an item that a player owns.

FieldTypeDescription
skustringThe sku of the item.
quantityintegerUnits owned. 0 is possible right after a consumption, never in an inventory list.
updatedAtstringWhen the quantity last changed.
JSON
{ "sku": "potion", "quantity": 3, "updatedAt": "2026-10-05T22:14:37.251Z" }

Currency

A currency of the game.

FieldTypeDescription
codestringThe currency code: lowercase letters, digits and _, such as gems.
namestringThe display name.
purchasablebooleantrue when packs can sell this currency for real money. Its balances then have a paid part.
JSON
{ "code": "gems", "name": "Gems", "purchasable": true }

Item

An item of the game: something a player can own.

FieldTypeDescription
skustringThe sku of the item.
namestringThe display name.
descriptionstring or nullThe display description.
typestringconsumable (can be consumed) or durable (cannot).
priceobject or nullThe price in a currency: currency and amount. null when the item cannot be bought with currency.
maxOwnedinteger or nullThe most units a player can own. null for no limit.
clientPurchasablebooleantrue when the client API may sell the item.
metadataobjectFree string to string pairs set on the item in the dashboard.
JSON
{
  "sku": "potion",
  "name": "Potion",
  "description": null,
  "type": "consumable",
  "price": { "currency": "gems", "amount": 20 },
  "maxOwned": null,
  "clientPurchasable": true,
  "metadata": {}
}

Pack

A bundle of currency and items sold for real money.

FieldTypeDescription
skustringThe sku of the pack.
namestringThe display name.
descriptionstring or nullThe display description.
priceCentsintegerThe price in euro cents, VAT included.
currencystringAlways EUR.
grantsarrayThe currency delivered: currency, amount (credited to paid) and bonus (credited to bonus).
itemsarrayThe items delivered: sku and quantity.
badgestring or nullA short label such as "Best value".
maxPerPlayerinteger or nullThe most paid orders a player can have for this pack. null for no limit.
availabilityPackAvailability or nullThe sale window, the stock left and the founder flag. null for an ordinary pack, always on sale without limit.
JSON
{
  "sku": "starter",
  "name": "Starter pack",
  "description": null,
  "priceCents": 99,
  "currency": "EUR",
  "grants": [{ "currency": "gems", "amount": 100, "bonus": 20 }],
  "items": [{ "sku": "potion", "quantity": 1 }],
  "badge": null,
  "maxPerPlayer": 1,
  "availability": null
}

PackAvailability

When a pack is sold during a window, in limited quantity, or as a founder pack. See Founder packs.

FieldTypeDescription
startsAtstring or nullWhen the sale starts (included), an ISO 8601 date in UTC. null when the pack is on sale from the start.
endsAtstring or nullWhen the sale ends (excluded). null when it has no end.
remaininginteger or nullThe units still on sale in the environment of your key: the total stock minus the orders that are delivered, paid or pending. Never below 0. null for an unlimited stock.
founderbooleantrue for a founder pack: sold before the launch of the game, shown with a badge and a public counter.
JSON
{ "startsAt": "2026-10-01T00:00:00.000Z", "endsAt": "2026-12-01T00:00:00.000Z", "remaining": 312, "founder": true }

Catalog

The active currencies, items and packs of the game. Archived and draft entries are left out.

FieldTypeDescription
currenciesarray of CurrencyThe currencies.
itemsarray of ItemThe items.
packsarray of PackThe packs.
prelaunchbooleantrue while the game is not launched: a shop presents purchases as pre-orders.
launchAtstring or nullThe announced launch date of the game, an ISO 8601 date in UTC. null when it is not announced.

A complete catalog is shown in Get the catalog.

Order

The purchase of a pack with real money, created by a checkout.

FieldTypeDescription
idstringThe order id.
playerIdstringThe player who ordered.
statusstringWhere the order stands: see Order statuses.
packobjectThe pack as it was sold: sku and name at the time of the order.
amountCentsintegerThe amount in euro cents, VAT included.
currencystringAlways EUR.
countrystringThe buyer's country (ISO 3166-1 alpha-2), which decided the VAT.
vatRateBpintegerThe VAT rate in basis points: 2100 is 21 %.
vatCentsintegerThe VAT included in amountCents.
netCentsintegeramountCents minus vatCents.
createdAtstringWhen the order was created.
paidAtstring or nullWhen the payment succeeded.
fulfilledAtstring or nullWhen the coins and items were delivered.
refundedAtstring or nullWhen the order was refunded.
creatorCodeobject or nullThe creator code the buyer used: code and creatorName. The bonus and commission rates are never shown. null when no code was used.
JSON
{
  "id": "665f1c2e8a3b4d5e6f7081b4",
  "playerId": "665f1c2e8a3b4d5e6f708192",
  "status": "fulfilled",
  "pack": { "sku": "gems-500", "name": "Bag of gems" },
  "amountCents": 499,
  "currency": "EUR",
  "country": "BE",
  "vatRateBp": 2100,
  "vatCents": 87,
  "netCents": 412,
  "createdAt": "2026-10-05T22:14:32.995Z",
  "paidAt": "2026-10-05T22:14:34.054Z",
  "fulfilledAt": "2026-10-05T22:14:34.054Z",
  "refundedAt": null,
  "creatorCode": null
}
pending → paid → fulfilled → refunded
                           → chargeback
pending → failed | canceled | expired
statusMeaningFinal
pendingThe order is created and waits for the payment. It becomes expired after one hour.No
paidThe payment is confirmed and the delivery is under way. It is a step of a moment, not a state you wait in.No
fulfilledThe payment succeeded and the coins and items are delivered.Until a refund
refundedThe order was refunded and the coins and items were taken back.Yes
chargebackThe cardholder disputed the payment.Yes
failedThe payment was refused.Yes
canceledThe order was canceled before payment.Yes
expiredThe order was not paid within one hour.Yes

Player token

A short-lived credential that lets one player act on their own wallet and inventory through the client API. Returned by Issue a player token and Get a new player token.

FieldTypeDescription
tokenstringThe token, gc_pt_…, sent as Authorization: Bearer. An opaque string: do not parse it.
expiresAtstringWhen it stops working: one hour after it was issued.
JSON
{ "token": "gc_pt_…", "expiresAt": "2026-10-05T23:14:35.000Z" }

Create an anonymous player returns a token with the new player and their playerSecret:

JSON
{
  "player": {
    "id": "665f1c2e8a3b4d5e6f7081c6",
    "externalId": null,
    "kind": "hosted",
    "displayName": "Guest",
    "country": null,
    "blocked": false,
    "createdAt": "2026-10-05T22:14:41.141Z"
  },
  "playerSecret": "bD7QMp…",
  "token": "gc_pt_…",
  "expiresAt": "2026-10-05T23:14:41.000Z"
}

Responses that combine objects

NameReturned byFields
MovementGrant currency, Spend currencyentry (LedgerEntry), balance (Balance)
PurchaseBuy an item with currencyentry, balance, item (InventoryItem)
CheckoutOrder a currency packorder (Order), checkoutUrl (string)
RedemptionRedeem a gift codegrants (array of currency, amount, balance), items (array of sku, quantity), skipped (array of sku, quantity)
Ledger pageList ledger entriesentries (array of LedgerEntry), nextCursor (string or null)
InventoryList the inventoryitems (array of InventoryItem)
Inventory changeGrant an item, Consume an itemitem (InventoryItem)
MeGet the token playerplayer, wallet, inventory (array of InventoryItem)
Anonymous playerCreate an anonymous playerplayer, playerSecret, token, expiresAt

Error

Every response that is not a success has this body, with the HTTP status of the error.

FieldTypeDescription
error.codestringThe stable code of the error: test this one. The codes are listed in Errors.
error.messagestringAn English message for developers, not for your players.
error.detailsobjectOptional. required and available for INSUFFICIENT_FUNDS; fieldErrors for VALIDATION_FAILED: a field name (or _ for the whole body) mapped to messages or codes such as COUNTRY_NOT_SELLABLE, CURSOR_INVALID, PLAYER_REF_INVALID, URL_INVALID, URL_SCHEME_NOT_ALLOWED or ORIGIN_MISMATCH. Meant to be read, not parsed.
JSON
{
  "error": {
    "code": "INSUFFICIENT_FUNDS",
    "message": "Insufficient funds",
    "details": { "required": 5000, "available": 70 }
  }
}