Troll BINGO — Platform Integration Guide
For: the operator's platform team. Version: 2.0, 22 September 2026.
Troll BINGO is the game; your platform keeps the player and the money. Five server-to-server calls connect them: you call us once to open the game, and we call you four times to charge, report results, refund and read the balance.
| File | What it is |
|---|---|
troll-bingo-platform-api.swagger.yaml |
The exact contract for all five calls (OpenAPI 3.1) |
mock-platform/server.mjs |
A working example of your side: charge, round result, refund, balance, daily report |
mock-platform/conformance.mjs |
20 tests your sandbox must pass before we connect |
mock-game/server.mjs + try-create-link.mjs |
Our side of the game-link call, to test the call you make |
1. The five calls
| Call | Who calls | When | What happens |
|---|---|---|---|
POST /v1/game-links |
You → us | The player clicks Troll BINGO | You send player ID, name, balance, bonus, currency. We create or update the player and return a link with a one-time token (60 s) |
POST /charge |
Us → you | Every purchase of cards or a package | You approve and return the new balance and bonus, and how much came from real money and bonus. Or decline with a message we show the player as is |
POST /round-result |
Us → you | End of every round, once per player | Every card of the player, won or not, prize, level, ball and amount; you credit totalWin |
POST /refund |
Us → you | A round cancelled for missing players, or a charge whose answer never came | You give the charge back to where it came from |
POST /balance |
Us → you | The player comes back to the screen, and before each purchase | Balance, bonus, account status |
A daily report (GET /reports/transactions?date=) lets us check every transaction against yours each night.
2. Opening the game
- Your server calls
POST /v1/game-linkswith the player. - You open the returned
launchUrlin a new tab or an iframe, adding the room you want:…/room?room=R-000023&token=…. Room codes come from the back office and fromGET /v1/rooms. It works once and expires after 60 seconds. - The player plays. Names are shown to other players as first name and initial ("Amiram T.").
3. Rules your side must follow
transactionIdis our idempotency key. Same ID and body: return the first answer withreplayed: true, move no money. Same ID, different body:409 TRANSACTION_MISMATCH.- No negative balances. A charge above balance plus bonus:
402 INSUFFICIENT_FUNDSwith a message for the player; nothing changes. - Results always land. Accept a round result (and refund) for any existing player, even blocked.
- Refunds are safe to repeat. Refunding a charge you never received returns
ORIGINAL_NOT_FOUND, moves no money, and blocks that charge ID forever (409 TRANSACTION_REFUNDED). - Answer within 3 seconds. A charge without an answer is cancelled with a refund (
CHARGE_UNKNOWN) and the player is told nothing was charged. Results and refunds are retried until you confirm. totalWinequals the sum of the winning cards. Reject it if not.
4. What we do with your answer
| Your answer | Charge | Round result or refund |
|---|---|---|
200 OK |
Issue the cards | Mark confirmed |
402, 403 |
Show your message, issue nothing | Not expected |
401, 404, 409 |
Show a general error, alert our team | Alert our team, keep retrying |
5xx or no answer in 3 s |
Refund with CHARGE_UNKNOWN, tell the player nothing was charged |
Retry after 5 s, 30 s, 2 min, then every 10 min for 24 h |
Every call in both directions is stored in our BO Platform log with its full request and response.
5. Signing
Headers on every request and response: X-TB-Key (key ID), X-TB-Timestamp (Unix seconds), X-TB-Signature = hex HMAC-SHA256 of timestamp.METHOD.path.body with the shared secret. Responses use RESPONSE as the method. Reject anything older than 300 seconds; compare in constant time.
import { createHmac } from 'node:crypto';
const sign = (secret, ts, method, path, body) => createHmac('sha256', secret).update(`${ts}.${method}.${path}.${body}`).digest('hex');
$signature = hash_hmac('sha256', "$timestamp.$method.$path.$rawBody", $secret);
6. Your sandbox and go-live
Your sandbox needs players test-player-1, test-player-2 (active) and test-player-blocked (blocked), in USD, and POST /test/players/balance {playerId, balance, bonus}.
cd mock-platform && node conformance.mjs # against the mock
TB_BASE=https://sandbox.operator.com/troll-bingo/v1 TB_KEY_ID=… TB_SECRET=… node conformance.mjs
- ☐ 20 of 20 conformance tests pass against your sandbox
- ☐ Your create-link call works against
mock-game, then against our sandbox - ☐ Keys and IP allow-lists exchanged for sandbox and production
- ☐ Your cashier link and the page a player returns to sent to us
- ☐ Daily report available
- ☐ One real round in production: open, buy, win, refund