Operator docs Get sandbox access

Guides

Wallet integration

In real mode, your Wallet holds the player’s money and we call it. You implement five endpoints, verify our signature and apply every transaction exactly once per transaction ID. This page explains how money must behave; the Wallet API reference lists every field.

Wallet API 1.0.0-draft.1Signature tag: provider-wallet-api-v1

The money model

The integration is seamless: we never keep a balance of our own. Your Wallet is the only source of truth for the player’s balance, and every movement of money is a WalletTransaction we send you. Demo GameSessions never call your Wallet.

EndpointOperationWe call it
POST /v1/wallet/balanceReport the current balanceWhen the game asks for the player’s balance, for example when it starts
POST /v1/wallet/debitsTake a stakeOnce per Round, when it starts
POST /v1/wallet/creditsPay out, or close a Round with zeroOnce per Round, when its Outcome is recorded
POST /v1/wallet/reversalsCancel a Debit in fullOnly to cancel a Round
GET /v1/wallet/transactions/{transaction_id}Report what happened to a transactionWhen we didn’t get a usable answer

Requirements for your endpoint

  • HTTPS on port 443 with a certificate from a public certificate authority, valid for the host name. We use TLS 1.2 or 1.3 and HTTP/1.1.
  • A public DNS name that resolves only to public addresses. We refuse private, loopback and other special-use ranges, and IP addresses in place of a name.
  • An optional base path: we append the fixed paths to your base URL, for example https://wallet.casino.example.com/v1/wallet/debits, or https://api.casino.example.com/provider/lucky8/v1/wallet/debits with the base path /provider/lucky8. Each segment of a base path is non-empty, isn’t . or .., and uses only ASCII letters, digits, -, ., _ and ~; no query, fragment or percent-encoding.
  • No redirects: we don’t follow them.
  • Answer fast. Our current limit is 5 seconds per attempt, which also covers our own preparation, and connecting plus the TLS handshake must finish within 2 seconds.
  • Response bodies up to 64 KiB, not compressed: no Content-Encoding, or exactly identity. We send Accept-Encoding: identity.
  • Exactly one Content-Type, with no parameters: application/json for 200, application/problem+json for errors. Many frameworks add ; charset=utf-8 by default; we treat such an answer as unusable, so turn that off.
  • On every response: Cache-Control: no-store, X-Content-Type-Options: nosniff and an X-Request-Id that’s a UUID v4. Echoing ours works.

Verify our requests

Every call carries the Wallet access token you issued to us and an Ed25519 HTTP Message Signature made with our private key. Accept a request only when both verify. The profile mirrors the Operator API profile, with its own tag.

HeaderValue
AuthorizationBearer and the Wallet access token you issued.
Content-Typeapplication/json on POST.
Content-Digestsha-256=:…: of the exact body bytes, on POST.
Signature-Inputsig1 with the covered components below and the parameters created, expires, nonce, keyid, alg="ed25519" and tag="provider-wallet-api-v1", in that order.
Signaturesig1=:, the base64 Ed25519 signature, :.
X-Request-IdA UUID v4 for this attempt. Not signed.
RequestCovered components
GET status lookup"@method" "@target-uri" "authorization"
Every POST, balance included"@method" "@target-uri" "authorization" "content-type" "content-digest"

Check in this order, and answer any failure with 401 authentication_failed and WWW-Authenticate: Bearer realm="wallet-api", without saying which check failed:

  1. The token matches one you issued to us. Refuse a request in which Authorization, Signature-Input, Signature, Content-Type or Content-Digest appears twice.
  2. Signature-Input has exactly the components and parameters above. expires is after created and at most 300 seconds later, created is at most 60 seconds ahead of your clock and expires at most 60 seconds behind it.
  3. The key ID is one of ours that you registered.
  4. The SHA-256 of the raw body equals Content-Digest. Hash the bytes as received, before parsing.
  5. The Ed25519 signature verifies over the signature base. Build @target-uri from your configured public base URL and the path we called, base path included, never from Host or forwarding headers.
  6. The pair of key ID and nonce is new. Register it atomically, in storage shared by all your instances, and keep it at least until expires plus 60 seconds.

Only then parse the JSON and process the command. wallet-request-verifier.mjs implements steps 1–5 for Node.js 22 or later, and our Wallet signing vectors let you test any implementation:

import { headersFromRaw, verifyWalletRequest, walletPublicKey } from './wallet-request-verifier.mjs';

const trust = {
  tokens: [process.env.LUCKY_WALLET_TOKEN],
  keys: new Map([['OUR_KEY_ID', walletPublicKey('OUR_PUBLIC_KEY')]]),
};

// In your HTTP handler, with the raw body bytes:
const headers = headersFromRaw(req.rawHeaders);
const check = headers && verifyWalletRequest(
  { method: req.method, targetUri: `https://wallet.casino.example.com${req.url}`, headers, body: rawBody },
  trust,
);
// nonces: a shared store with an atomic insert in production;
// MemoryNonceRegistry from the same module for development.
if (!check?.ok || !(await nonces.register(check.keyId, check.nonce, check.expires))) {
  return unauthorized(); // 401 authentication_failed, WWW-Authenticate: Bearer realm="wallet-api"
}

Your Wallet’s responses aren’t signed in v1; TLS protects them. A retry of the same transaction always arrives with a new nonce and signature, so replay protection never blocks a legitimate retry.

What a WalletTransaction contains

Debits, Credits and Reversals share one set of fields. Together they form the transaction’s identity: a repeat of the same transaction_id always carries exactly the same values.

FieldMeaning
transaction_idOur ID of this WalletTransaction. Unique forever within your integration with us.
operationdebit, credit or reversal, matching the endpoint.
brand_id, game_id, game_session_idThe Brand, Game and GameSession the money belongs to.
player_idYour External Player ID, exactly as you sent it in player.id.
round_idThe Round the money belongs to. Use it to group a Round’s Debit and Credit.
amount{"currency": "EUR", "minor_units": 100}. Money rules
reasongameplay, round_close or compensation.
round_closedA Credit with reason: "round_close" must carry true, and a Reversal repeats its Debit’s value; nothing else constrains it. Today we send true only on the zero Credit of a Round without a win, and false on every Debit, Reversal and winning Credit. It doesn’t tell you whether a Round is settled. Details
occurred_atWhen the business event happened, in UTC: 2026-10-20T12:01:00.25Z, with up to six fractional digits and no trailing zeros. It doesn’t change on retries.
original_transaction_idReversals only: the Debit being canceled.
operator_session_tokenYour Operator Session Token. Not part of the identity. Details

All IDs except player_id are lowercase UUID v4 values. Request bodies have no other fields; your receipts may add fields of your own.

Money

  • Amounts are whole numbers of the currency’s minor unit, as defined by ISO 4217: EUR 1.00 is 100.
  • minor_units ranges from 0 to 9,223,372,036,854,775,807. A Debit or Reversal is at least 1; a Credit can be 0.
  • Parse amounts without losing precision. Values above 253 are valid, and JavaScript’s Number or any floating-point type silently rounds them. Use a 64-bit integer type, or BigInt-aware JSON parsing in JavaScript.
  • The currency is always the GameSession’s currency. If your Wallet can’t hold it, reject the command with currency_unsupported.

Deduplication: the core rule

Networks lose answers, so we send the same WalletTransaction again until we get a usable receipt. Your Wallet makes that safe by deduplicating on transaction_id:

You receiveYou answer
A new transaction_idCheck the command, apply it atomically, store the receipt and return it.
A known transaction_id with the same identityThe original receipt, unchanged: the same outcome, rejection code and balance_after. No second effect.
A known transaction_id with a different identity, or on another endpoint409 transaction_conflict. The original stays as it is.
  • Look the transaction up before checking the player’s session, limits or funds. A repeat must return its original receipt even after the GameSession ended, the Operator Session Token expired or the Game was disabled.
  • Serialize concurrent requests with the same transaction_id, for example with a unique key and a row lock. Two identical requests at once still move money once.
  • A rejection is final for its ID. A Debit rejected with insufficient_funds stays rejected even after the player deposits; a new stake comes with a new ID.
  • Never expire or delete deduplication records or prevented markers: not after 24 hours, not at the end of a GameSession, not at all. Credits and Reversals can arrive late, and a purged record would let one apply twice. Changing that would need an agreed protocol change.

Balance

POST/v1/wallet/balance

{
  "brand_id": "22222222-2222-4222-8222-222222222222",
  "game_session_id": "6d1f2c7a-3b4e-4f5a-9c8d-7e6f5a4b3c2d",
  "player_id": "player-7f3a9c",
  "currency": "EUR",
  "operator_session_token": "YOUR_PLAYER_SESSION_TOKEN"
}
{
  "identity": {
    "brand_id": "22222222-2222-4222-8222-222222222222",
    "game_session_id": "6d1f2c7a-3b4e-4f5a-9c8d-7e6f5a4b3c2d",
    "player_id": "player-7f3a9c",
    "currency": "EUR"
  },
  "balance": { "currency": "EUR", "minor_units": 50000 },
  "observed_at": "2026-10-20T12:00:40Z"
}

Return the current balance in the requested currency, echoing the four identity fields. The balance is a snapshot that reserves nothing; it moves no money. If the Operator Session Token is invalid, answer with a problem response such as 403 authorization_failed: the game then shows no balance instead of a wrong one.

Debits

POST/v1/wallet/debits

{
  "transaction_id": "5f0c2a8e-1d4b-4c3e-9a7f-2b6d8e1c4a90",
  "operation": "debit",
  "brand_id": "22222222-2222-4222-8222-222222222222",
  "game_session_id": "6d1f2c7a-3b4e-4f5a-9c8d-7e6f5a4b3c2d",
  "game_id": "44444444-4444-4444-8444-444444444444",
  "player_id": "player-7f3a9c",
  "round_id": "9a3e5c1b-7d2f-4b8a-8e6c-0f1d3b5a7c9e",
  "amount": { "currency": "EUR", "minor_units": 100 },
  "reason": "gameplay",
  "round_closed": false,
  "occurred_at": "2026-10-20T12:01:00.25Z",
  "operator_session_token": "YOUR_PLAYER_SESSION_TOKEN"
}

A Debit takes a Round’s stake. When a check on a new Debit fails, reject it with the matching code:

CheckRejection code
A Reversal for this ID already arrived (see Reversals)transaction_cancelled
The Operator Session Token is valid for this playersession_invalid
The player may play now: not blocked, self-excluded or over a limitgameplay_not_allowed
The currency is one your Wallet holdscurrency_unsupported
The balance covers the amountinsufficient_funds

Then take the amount and store the receipt in the same database transaction:

{
  "identity": {
    "transaction_id": "5f0c2a8e-1d4b-4c3e-9a7f-2b6d8e1c4a90",
    "operation": "debit",
    "brand_id": "22222222-2222-4222-8222-222222222222",
    "game_session_id": "6d1f2c7a-3b4e-4f5a-9c8d-7e6f5a4b3c2d",
    "game_id": "44444444-4444-4444-8444-444444444444",
    "player_id": "player-7f3a9c",
    "round_id": "9a3e5c1b-7d2f-4b8a-8e6c-0f1d3b5a7c9e",
    "amount": { "currency": "EUR", "minor_units": 100 },
    "reason": "gameplay",
    "round_closed": false,
    "occurred_at": "2026-10-20T12:01:00.25Z"
  },
  "outcome": "succeeded",
  "processed_at": "2026-10-20T12:01:00.31Z",
  "balance_after": { "currency": "EUR", "minor_units": 49900 }
}

A rejection is a business answer, so it’s also a 200 receipt:

{
  "identity": { "…": "the same identity as above" },
  "outcome": "rejected",
  "rejection_code": "insufficient_funds",
  "processed_at": "2026-10-20T12:01:00.31Z",
  "balance_after": { "currency": "EUR", "minor_units": 50 }
}

When a Debit is rejected, the Round doesn’t start and no Credit follows.

Credits

POST/v1/wallet/credits

A Round whose Debit succeeded ends with exactly one Credit, unless it’s canceled. The Credit comes in one of two shapes:

Round resultamountreasonround_closed
A winThe gross payout, at least 1gameplayfalse
No win0round_closetrue
  • The amount is the gross payout: everything the player won, not net of the stake. The stake was taken by the Debit. A EUR 1.00 stake that wins EUR 2.50 is a Debit of 100 and a Credit of 250.
  • A zero Credit moves no money. Store it and return a receipt like any other command: it tells you the Round is over.
  • The contract also allows a positive Credit with reason: "round_close" and round_closed: true. We don’t send one today; accept it if it arrives.
  • The contract constrains round_closed in two ways only: a round_close Credit carries true, and a Reversal carries its Debit’s value. Don’t reject other combinations; they’re valid by contract even where we don’t send them today.
  • Don’t require a matching Debit to accept a Credit; our signature proves it’s ours.
A winning Credit settles the Round with round_closed: false

Despite its name, round_closed doesn’t mean “this Round is settled”. A winning Credit carries false and is still the Round’s last command: a Round has at most one Debit and one Credit, linked by round_id. Close a Round in your books on its Credit, or on the Reversal of its Debit, whatever round_closed says. Waiting for true leaves every winning Round open. Acceptance scenario 1 checks this.

Never reject a payout for a closed session

A Credit settles a Round that already happened. Accept it after the GameSession ended, after the Operator Session Token expired or was revoked, and after the player left; operator_session_token may be absent. The only rejection code a Credit can carry is currency_unsupported. A rejected Credit leaves a payout owed to the player, and the Round stays in settlement_incident; contact us when that happens.

Reversals

POST/v1/wallet/reversals

A Reversal cancels a Debit in full, and exists to cancel a Round. No current flow cancels a Round, so you may not see one yet, but your Wallet must support it. A Reversal has its own transaction_id, reason: "compensation" and its own occurred_at. It names the Debit in original_transaction_id, and its player, Brand, Game, GameSession, Round, amount, currency and round_closed equal the Debit’s. Partial Reversals and Reversals of Credits don’t exist.

Serialize Reversals and Debits on the original transaction ID, because a Reversal can arrive before its Debit. The first Reversal for a Debit decides:

State of the original DebitYour answerMoney
Succeededsucceeded, reversal_effect: "refunded"Return the Debit’s exact amount, once.
Not received yetsucceeded, reversal_effect: "prevented"Nothing. Store a permanent marker for the original ID.
Rejectedsucceeded, reversal_effect: "no_effect"Nothing.
The Debit arrives after a preventedReject the Debit with transaction_cancelledNothing.
The same Reversal againThe original Reversal receiptNothing more.
Another Reversal ID for the same Debitrejected, original_already_reversed, with first_reversal_idNothing more.
Fields that don’t match the original Debit409 transaction_conflictNothing; never move money to another player.

prevented is a promise: once you answer it, the original Debit must never take money later. A Wallet that can’t keep that marker can’t conform to v1. Like Credits, Reversals must be accepted after the GameSession or the Operator Session Token expired.

Transaction status

GET/v1/wallet/transactions/{transaction_id}

When an answer is lost, we ask what happened before we send anything again. Answer with one of three results:

State in your WalletAnswer
Processed, succeeded or rejected200 with {"status": "receipt", "transaction_id": "…", "receipt": {…}}, the original receipt
Recorded but still being processed200 with {"status": "pending", "transaction_id": "…"}
No record404 problem with code: "not_found"

A lookup reads and never creates anything. It needs no Operator Session Token and works after the GameSession ended. not_found describes this moment only: a delayed request can still arrive, and if it does, process it normally.

We count a 404 as “no record” only when it carries a complete problem body with code: "not_found". Any other 404, for example from a proxy, is a failed lookup, and a failed lookup never makes us resend.

Receipts

  • identity echoes every field of the command except operator_session_token, with exactly the same values. We compare them all; an answer whose identity doesn’t match is unusable.
  • outcome is succeeded or rejected. A rejection carries a rejection_code; a succeeded Reversal carries a reversal_effect.
  • processed_at is when you processed the command, in the same UTC format as occurred_at.
  • balance_after is the balance right after this command, in its currency. It’s optional, but send it: the game shows it to the player after each Round. On a repeat it’s the original value, not today’s balance.
  • Leave out optional fields you don’t use; never send null. You may add fields of your own; we ignore them.
Rejection codeAllowed forMeaning
insufficient_fundsDebitThe balance doesn’t cover the stake.
session_invalidDebitThe Operator Session Token isn’t valid.
gameplay_not_allowedDebitThe player may not play now.
transaction_cancelledDebitA Reversal arrived first.
currency_unsupportedAnyYour Wallet doesn’t hold this currency.
original_already_reversedReversalAnother Reversal already canceled this Debit; send its ID in first_reversal_id.

HTTP status and what we make of it

A business decision, success or rejection, is always 200 with a receipt. Every other answer is a transport problem in application/problem+json, with type, title, status, detail, code, request_id (equal to your X-Request-Id) and retryable.

StatusCodeUse it when
400malformed_requestThe request isn’t valid JSON or HTTP.
401authentication_failedOur token or signature didn’t verify.
403authorization_failedWe may not perform this request.
404not_foundStatus lookup only: no record of the transaction.
409transaction_conflictThe transaction ID is bound to a different command.
413payload_too_largeThe body is too large.
415unsupported_media_type, unsupported_content_encodingWrong media type or encoding.
422validation_failedA field breaks the schema.
429rate_limit_exceededYou’re throttling us. Add Retry-After.
500internal_errorSomething failed on your side.
503service_overloaded, dependency_unavailableTemporarily unavailable. Retry-After helps us back off.
504request_timeoutYou ran out of time.

Only a 200 receipt whose identity matches the command settles a WalletTransaction for us. A timeout, a dropped connection, a malformed body or any problem response leaves its outcome unknown, because your Wallet may have applied the command before the answer was lost. We never read an error as “no money moved”.

How we retry

  • A retry repeats the same transaction_id with the same body fields. Only the nonce, the signature, the timestamps and X-Request-Id are new. We never create a new transaction ID to work around a failure, and a timeout alone never makes us send a Reversal.
  • After an unclear answer we usually ask the status endpoint first, then resend only if your Wallet has no record.
  • Current defaults, which are configuration and can change: up to 3 attempts within about 15 seconds, then status lookups at randomized, growing intervals from about 5 minutes up to an hour, and at most 10 sends of one transaction. A Retry-After in seconds or as an HTTP date (IMF-fixdate) delays the next attempt; one beyond 24 hours holds the transaction for review on our side.
  • We stop resending a Debit after its delivery deadline, which is never later than the GameSession’s expiry; status lookups continue. Credits and Reversals have no such deadline.

The failure matrix lists each case, and Rounds and reconciliation shows how this looks in a Round.

Operator Session Token

The Operator Session Token is the value you sent in operator_session_token when you created the GameSession. It stands for the player’s session or Wallet context on your side, and its format and lifetime are yours.

  • We send it with every balance request and every Debit. Validate it there.
  • Credits and Reversals carry it when we still have it, and may come without it. Never require it there, and never reject them because it expired.
  • Repeats and status lookups don’t depend on it: check for an existing transaction first.
  • Keep it valid for as long as the player plays. When it expires mid-session, new Debits fail with session_invalid. A relaunch sends the same token again and doesn’t help: issue a new token and create a new GameSession with a new Idempotency-Key, as Relaunch and re-entry describes. Money of the old GameSession keeps settling under its original transaction IDs.

We store the token encrypted, never show it to the browser, never return it and never log it. It’s not part of the transaction identity, so it can differ between attempts.

Implementation checklist

  • All five endpoints exist on a public HTTPS origin, with the response headers above and a Content-Type without parameters.
  • Requests verify against our token, our key and the time window; nonces are registered once.
  • Amounts are parsed and stored as 64-bit integers.
  • Deduplication by transaction_id happens before any session or balance check, and its records are never deleted.
  • Credits and Reversals succeed after the GameSession and the Operator Session Token ended.
  • Reversals before Debits leave a permanent marker, and the late Debit is rejected with transaction_cancelled.
  • Receipts echo the full identity and include balance_after.
  • Your Wallet passes the acceptance scenarios.