Skip to Content
Operator wallet

Operator wallet

The player’s money stays in your wallet, and we hold none of it. Every time it has to move, we call your wallet: a debit before we accept a stake, a credit when a position pays out, closes or is refunded, and a rollback when a debit did not become a position. Our ledger records positions and the same moves beside them, so the two sides can be matched call by call.

This page is the contract your wallet answers. We build the tables and the examples from the contract itself at every build, so they cannot drift from what we send. There is no OpenAPI document for the wallet.

A lost bet causes no call. You learn of it from the position.settled webhook. Webhooks stay notices; they never move money.

Your wallet address and secret

Each mode has its own wallet. Register a wallet_url for test mode and one for live mode on the settings screen of the tenant portal, and rotate the wallet_secret of each mode on the same screen. We show a new secret once. It is never your webhook secret, and rotating one never touches the other.

Test calls go to the test wallet_url with livemode: false in the body, live calls to the live one with livemode: true. Check livemode anyway, as you do for webhooks.

An account goes live only with the live wallet_url and wallet_secret both set. Without a configured wallet, a mode takes no bet: opens, limit order placements and balance reads answer 503 wallet_unavailable with details.reason set to not_configured.

When you rotate a secret, your wallet rejects our signature until it has the new one. We treat those answers as unknown: opens and placements fail with wallet_unavailable, and credits and rollbacks are retried until the new secret is in place. No money is lost, but trading pauses, so rotate at a time you agree with our team and rehearse it in test mode first.

Where our calls come from

Our wallet calls leave from fixed addresses, so you can allow only these in front of your wallet:

  • stage: 164.92.255.47
  • production: not open yet. We announce its addresses before go-live.

The four calls

Each call is an HTTPS POST of a JSON body to a path under your wallet_url, and the answer is JSON too.

CallRequest bodySuccessDefinitive refusals
POST {wallet_url}/balancecommon fields only{status: "ok", balance, currency, version}unknown_player
POST {wallet_url}/debitamount; reason (position_open | order_placement | resettlement | reversal); position_id or order_id (exactly one: order_id for order_placement, position_id otherwise); market_slug; outcome_id; related_transaction_id (optional: the opening debit, on resettlement and reversal); request_key (optional: the Idempotency-Key of the POST /v1/positions or POST /v1/orders request that caused the debit){status: "ok", operator_transaction_id, balance, version}insufficient_funds, player_suspended, limit_reached, risk_rejected, invalid_session, unknown_player, currency_mismatch, debit_rejected. A refusal is allowed for position_open and order_placement only. A resettlement or reversal debit must answer ok, also when the player lacks the funds: the operator may then absorb the difference on its side.
POST {wallet_url}/creditamount; reason (settlement | position_close | void_refund | resettlement | reversal); position_id; related_transaction_id (the opening debit of the position); market_slug; outcome_id{status: "ok", operator_transaction_id, balance, version}none: a credit must answer ok
POST {wallet_url}/rollbacktransaction_id is the id of the debit to undo; amount (the debit's amount); reason (open_failed | order_cancelled | order_expired | order_rejected){status: "ok"}, also for a debit the operator never saw. It then keeps a tombstone for that id and refuses a later debit with it.none: a rollback must answer ok

Headers

HeaderValue
Content-Typeapplication/json
X-Wallet-Signaturesha256=<hex HMAC-SHA256 of the raw request body, keyed with the wallet_secret of the calling mode>
Idempotency-Keythe transaction_id of the body, so the operator can de-duplicate before it parses
X-Wallet-Api-Version1
X-Request-Iduuid v7 of our request or job that made the call, for support; a retry carries the id of the attempt

Fields on every call

FieldTypeNote
transaction_idstring (uuid)Our UUIDv7 id of this call. It is the idempotency key. A rollback carries the id of the debit it undoes.
external_user_idstringThe operator's own user id, as in PUT /v1/users/{external_user_id}.
currencystringThe player's ISO 4217 code, users.currency. Every amount is in it.
livemodebooleantrue on a call of live mode, false on one of test mode. Each mode calls its own wallet_url; check it anyway.
occurred_atstring (RFC 3339 UTC)When we created the call. A retry resends the stored body, so it does not move.
session_refstringOptional. The operator's reference to the player's session. On the widget path it comes from the token's session_ref claim, set at the widget session mint. With the tenant API key it comes from the optional session_ref of the POST /v1/positions or POST /v1/orders body. Sent on position_open and order_placement debits only, and omitted when its source has none.

A field that has no value is left out of the body, never sent as null. Ignore any field you do not know.

Response fields

FieldTypeNote
statusstringok, or one of the refusal statuses of the call. duplicate_mismatch may answer any call.
balancestring (decimal)The player's balance after the call, in the request's currency. Display only.
currencystringOn the balance call: the currency of balance.
versionintegerThe operator's version of the player's wallet, higher after every change of it. We keep the newest figure for display.
operator_transaction_idstringThe operator's own id of the money move. We store it on the call row and print it beside ours on the reconciliation statement.

Verify the signature

X-Wallet-Signature is the webhook scheme with the wallet secret: sha256= and the hex HMAC-SHA256 of the raw request body. Verify it before you act, and answer a failed check with a status other than 200.

  1. Keep the raw body as bytes. Do not parse the JSON and write it again.
  2. Compute HMAC-SHA256 over those bytes with the wallet_secret of the mode.
  3. Compare sha256= and the hex value with X-Wallet-Signature in constant time.
import { createHmac, timingSafeEqual } from 'node:crypto'; export function verifyWalletCall(rawBody, signatureHeader, walletSecret) { const expected = 'sha256=' + createHmac('sha256', walletSecret).update(rawBody).digest('hex'); const a = Buffer.from(expected); const b = Buffer.from(signatureHeader ?? ''); return a.length === b.length && timingSafeEqual(a, b); }

There is no timestamp. A replayed request carries a transaction_id you already answered, so it is a duplicate and moves nothing. We store each body and resend the same bytes on every retry, signed again with the secret current at that moment.

Idempotency and rollbacks

transaction_id is our id of the call and its idempotency key, and Idempotency-Key carries the same value so you can drop a duplicate before you parse the body. Answer a repeated id with the identical first answer, at any age.

A rollback carries the transaction_id of the debit it undoes. Answer it ok also when you never saw that debit, and keep a tombstone for the id: a debit that arrives later with it must be refused with debit_rejected. That covers a debit and its rollback crossing on the network.

Amounts

Amounts are decimal strings in the player’s currency, the one its first user sync set, and every call names it in currency. They are written at the currency’s minor units: "10.00" in EUR, "1000" in JPY. Keep each player’s balance in that currency. If your wallet holds the player in another currency, refuse the debit with currency_mismatch: the open is refused with 409 wallet_rejected, and a retry cannot cure it, because the player’s currency never changes. A stake with more digits than the currency allows is refused before anything is recorded. A credit is rounded half to even at the minor units, and a credit that rounds to zero is recorded and not sent.

Partial sale credits

A user can sell part of an open position and keep the rest (Selling part of a position). Each sale is a credit with reason position_close, like a full close, with two more fields: partial, the boolean true, and remaining_stake, the stake the position keeps after the sale, at your currency’s minor units. A full close carries neither field, so its body is the same as before. The credit.partial-close example below shows one.

Each sale is its own call with its own transaction_id, and its related_transaction_id names the opening debit of the position, as on every credit. One position can therefore get several credits: one per sale, then one for what ends the rest (its close, a win or a void refund), or none when the rest loses. Answer every one of them ok, and do not close the bet on a credit that carries partial.

The widget offers partial sales only after you switch on its partial_close card option, which is off by default. A wallet written before these fields ignores them and may close the bet on the first credit, so switch the option on only once your wallet handles several credits for one position. Your server can sell part of a position with your API key at any time, whatever the option says.

Definitive and unknown answers

Only HTTP 200 with a status that the call lists is definitive. ok is success, and a listed refusal of a debit is final and needs no rollback. A refusal is allowed only on the debit of an open or a limit order placement: a credit, a rollback and a resettlement or reversal debit must answer ok, also when the player lacks the funds for a resettlement debit. You may absorb that difference on your side.

Everything else is unknown: another HTTP status, a timeout, a connection error, a body that does not parse, a status the call does not list, and internal_error. After an unknown debit of an open we send a rollback, with no status query. An unknown credit or rollback is retried until it is ok. duplicate_mismatch, an id you hold with another body, stops that call until our team resolves it.

How a debit refusal reaches the caller of POST /v1/positions or POST /v1/orders: insufficient_funds answers would_overdraw, player_suspended answers user_blocked, and every other refusal answers 409 wallet_rejected. An unknown debit, a wallet that keeps failing and a paused wallet path answer 503 wallet_unavailable with Retry-After.

Timeouts and retries

We wait this long for each answer:

  • debit: 2 s
  • balance: 1.5 s
  • credit, rollback, resettlement: 10 s per attempt

The debit timeout is short because we call your wallet inside the open request. Keep the p95 of a wallet round trip at or below 400 ms, and do not lock the player’s wallet around your own POST /v1/positions or POST /v1/orders call.

Calls that must end ok are retried on this schedule:

  • 1 s, 5 s, 30 s, 2 m, 10 m, 1 h, then every hour; each wait jittered within [0.5x, 1.5x]. A rollback continues the schedule of the debit it undoes, so its first retry waits 5 s or more, never 1 s.
  • Credits, rollbacks, resettlement and reversal debits; a position_open or order_placement debit is never retried, it is rolled back.

A rollback is not a new call: it continues the retry schedule of the debit it undoes, so its first retry comes 5 seconds or more after the failure, never after 1 second. We send the calls of one player in the order we committed them, and the next one waits until the one before it is ok. A call is never dropped. If a credit stays unanswered for more than an hour, your account’s owner and finance members get an email, and our team sees it too.

Each of our API servers keeps its own count. When five debits of your account fail within 30 seconds on one server, that server stops debiting for 30 seconds and then tries one. With several servers running, up to five failed debits per server can reach your wallet before every server has paused. While a server’s pause lasts, the opens and placements it handles answer 503 wallet_unavailable at once. Credits and rollbacks are never held back by it.

What you agree to

The operator agreement asks your wallet to:

  1. De-duplicate by transaction_id and answer a repeated id with the identical response, at any age.
  2. Keep a tombstone for every rolled-back id and refuse a later debit with it (debit_rejected).
  3. Accept every credit, every rollback and every resettlement or reversal debit with ok.
  4. Do not lock the player's wallet around its own POST /v1/positions or POST /v1/orders call, because we call {wallet_url}/debit inside that request.
  5. Verify X-Wallet-Signature before acting.

Versioning

Every call carries X-Wallet-Api-Version: 1. Under version 1 we only add: new optional request fields, new reasons and new statuses. Ignore what you do not know. A breaking change would be version 2, with an opt-in per account, and none is planned.

Reconciliation

Our reconciliation checks every wallet call against our ledger and looks for calls that stay unanswered. To check your side, match your wallet log against the reconciliation_statement report, which lists each wallet call with our transaction_id and your operator_transaction_id. Reconciliation has the details.

Examples

One request and its answer per call and case, from our wallet contract fixtures. Our own client is tested against them, and so is the reference wallet that our demo operator sites run, which keeps each player’s balance in the player’s currency, so you can test your wallet against the same files. {{signature}} and {{request_id}} change on every call. The other values are fixed fake values that match nothing real.

balance.success

POST {wallet_url}/balance Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000001 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000001", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z" }
HTTP 200 { "status": "ok", "balance": "100.00", "currency": "EUR", "version": 41 }

balance.unknown-player

POST {wallet_url}/balance Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000002 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000002", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z" }
HTTP 200 { "status": "unknown_player" }

credit.partial-close

POST {wallet_url}/credit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000022 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000022", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "amount": "5.40", "reason": "position_close", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "related_transaction_id": "0193a1b2-0000-7000-8000-000000000010", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1", "partial": true, "remaining_stake": "6.00" }
HTTP 200 { "status": "ok", "operator_transaction_id": "op-tx-000022", "balance": "105.40", "version": 42 }

credit.replay

POST {wallet_url}/credit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000021 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000021", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "amount": "18.18", "reason": "settlement", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "related_transaction_id": "0193a1b2-0000-7000-8000-000000000010", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1" }
HTTP 200 { "status": "ok", "operator_transaction_id": "op-tx-000020", "balance": "108.18", "version": 43 }

credit.success

POST {wallet_url}/credit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000020 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000020", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "amount": "18.18", "reason": "settlement", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "related_transaction_id": "0193a1b2-0000-7000-8000-000000000010", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1" }
HTTP 200 { "status": "ok", "operator_transaction_id": "op-tx-000020", "balance": "108.18", "version": 43 }

debit.after-rollback

POST {wallet_url}/debit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000015 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000015", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "session_ref": "sess-ref-example", "amount": "10.00", "reason": "position_open", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1", "request_key": "9f0c2a4e-0000-4000-8000-000000000001" }
HTTP 200 { "status": "debit_rejected" }

debit.insufficient-funds

POST {wallet_url}/debit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000012 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000012", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "session_ref": "sess-ref-example", "amount": "500.00", "reason": "position_open", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1", "request_key": "9f0c2a4e-0000-4000-8000-000000000001" }
HTTP 200 { "status": "insufficient_funds" }

debit.limit-reached

POST {wallet_url}/debit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000014 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000014", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "session_ref": "sess-ref-example", "amount": "25.00", "reason": "order_placement", "order_id": "0193a1b2-0000-7000-8000-0000000000b1", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1", "request_key": "9f0c2a4e-0000-4000-8000-000000000002" }
HTTP 200 { "status": "limit_reached" }

debit.player-suspended

POST {wallet_url}/debit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000013 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000013", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "session_ref": "sess-ref-example", "amount": "10.00", "reason": "position_open", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1", "request_key": "9f0c2a4e-0000-4000-8000-000000000001" }
HTTP 200 { "status": "player_suspended" }

debit.replay

POST {wallet_url}/debit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000011 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000011", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "session_ref": "sess-ref-example", "amount": "10.00", "reason": "position_open", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1", "request_key": "9f0c2a4e-0000-4000-8000-000000000001" }
HTTP 200 { "status": "ok", "operator_transaction_id": "op-tx-000001", "balance": "90.00", "version": 42 }

debit.resettlement-no-funds

POST {wallet_url}/debit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000016 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000016", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "amount": "4.00", "reason": "resettlement", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "related_transaction_id": "0193a1b2-0000-7000-8000-000000000010", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1" }
HTTP 200 { "status": "ok", "operator_transaction_id": "op-tx-000016", "balance": "0.00", "version": 57 }

debit.success

POST {wallet_url}/debit Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000010 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000010", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "session_ref": "sess-ref-example", "amount": "10.00", "reason": "position_open", "position_id": "0193a1b2-0000-7000-8000-0000000000a1", "market_slug": "fixture-market-2026", "outcome_id": "0193a1b2-0000-7000-8000-0000000000c1", "request_key": "9f0c2a4e-0000-4000-8000-000000000001" }
HTTP 200 { "status": "ok", "operator_transaction_id": "op-tx-000001", "balance": "90.00", "version": 42 }

rollback.success

POST {wallet_url}/rollback Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000030 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000030", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "amount": "10.00", "reason": "open_failed" }
HTTP 200 { "status": "ok" }

rollback.unknown-debit

POST {wallet_url}/rollback Content-Type: application/json X-Wallet-Signature: sha256={{signature}} Idempotency-Key: 0193a1b2-0000-7000-8000-000000000031 X-Wallet-Api-Version: 1 X-Request-Id: {{request_id}} { "transaction_id": "0193a1b2-0000-7000-8000-000000000031", "external_user_id": "player-0001", "currency": "EUR", "livemode": false, "occurred_at": "2026-11-10T12:00:00Z", "amount": "25.00", "reason": "order_cancelled" }
HTTP 200 { "status": "ok" }
Last updated on