How a round works
Every game round flows through three actors: your operator backend, Aggregator.gg, and the game provider. The player sees only the game iframe. You own the wallet: Aggregator.gg never holds player funds, so paid bets and wins settle in your ledger. Grant-funded bets preserve cash, and refunds reverse a recorded debit once.
Round lifecycle
Section titled “Round lifecycle”Player Operator Aggregator.gg Provider | | | | |-- open game --->| | | | |-- POST /v1/sessions -->| | | | (Idempotency-Key) |-- create session ->| | | |<-- session URL ----| | |<-- session_id, --------| | | | game_url | | |<-- redirect ----| | | |-- plays the game ------------------------------------------->| | | |<-- bet ------------| | |<-- POST callback_url --| | | | (bet, X-SIGNATURE) | | | |--- 200 { balance } --->|-- confirmed ------>| | | |<-- win ------------| | |<-- POST callback_url --| | | | (win, X-SIGNATURE) | | | |--- 200 { balance } --->|-- confirmed ------>| |-- closes game ->| | |Three rules govern the whole flow:
- You own the wallet. Paid bets debit and wins credit your ledger; free bets do not debit cash.
- Callbacks are synchronous. The provider waits for your response before showing the result to the player. Your callback endpoint must respond within 5 seconds.
- Idempotency is required on both legs. Session and free-round creation require a stable
Idempotency-Key; callbacks can repeat and use a separate scoped identity: trusted integration/organization context,provider_codeandtransaction_id.
Session launch
Section titled “Session launch”Create a session with POST /v1/sessions. Persist a unique AGGREGATOR_OPERATION_ID for this launch and reuse it with the same body only on retries. Send the game, player, balance, currency, and country; platforms also select their brand:
curl -X POST "https://api.aggregator.gg/v1/sessions" <<EOF \ --header @- \ -H "Idempotency-Key: ${AGGREGATOR_OPERATION_ID:?Set a persisted unique ID for this launch; reuse only for its retries}" \ -H "Content-Type: application/json" \ -d '{ "game_id": "d4f7a2b1-3c8e-4f5a-9b6d-1e2f3a4b5c6d", "player_id": "player_42", "balance": 10000, "currency": "EUR", "country": "DE", "lang": "de", "return_url": "https://your-casino.com/lobby" }'Authorization: Bearer ${AGGREGATOR_API_KEY:?Set the issued key in the protected environment}EOF{ "session_id": "8c8e8c8e-8c8e-4c8e-8c8e-8c8e8c8e8c8e", "game_url": "https://games.aggregator.gg/launch/8c8e8c8e-8c8e-4c8e-8c8e-8c8e8c8e8c8e", "provider_session_uid": "tl_session_abc"}Details that matter here:
game_idis the Aggregator.gg catalog UUID, theidreturned byGET /v1/games. It is not the provider’s own game code.balanceis an integer in the currency’s minor units:10000means 100.00 EUR. Sessionbalance, normalized callbackamountand callback responsebalanceuse minor units. Free-roundbet_amountand stake metadata have their own documented representation; do not apply a universal conversion across endpoints.game_urlis a private session credential. Open it promptly and keep it out of logs or shared caches. Expiry and reuse behavior depend on the provider.countrydrives jurisdiction rules. A game blocked in the player’s country returns403.client_ipanduser_agentcarry the player’s public IP and browserUser-Agent. Some providers need them and refuse the launch with400E3010when a field they require is missing, orE3009when a value they need is unusable.
Step check: the response carries session_id and game_url, and opening the private game_url in a browser loads the expected game. Do not infer wallet acceptance from the page rendering.
Wallet callbacks
Section titled “Wallet callbacks”Each spin triggers HMAC-signed callbacks to the callback URL you configured in the cabinet. A bet arrives first; when the spin resolves with a payout, a win follows.
For every callback you receive:
- Verify the
X-SIGNATUREheader against the raw request body. See Request signatures. - Deduplicate by trusted integration/organization context,
provider_codeandtransaction_id; for a repeat with the sametransaction_type,amount,currencyandplayer_id, replay the stored original status and body even if another field such astimestampchanged, and for a repeat where one of those differs, for example anotheramount, move no money and answer a4xx. Commit movement and response atomically before success. - Branch on
transaction_type, not onaction(a provider-specific label):
transaction_type |
Meaning | Your action |
|---|---|---|
bet |
Player placed a bet | Debit a paid bet; preserve cash when is_free: true |
win |
Player won | Credit amount to the player’s balance |
refund |
A previous bet was reversed | Reverse the original recorded debit once; a free bet has no cash debit to refund |
- Respond
200with a JSON body carryingbalanceandcurrency(both required), echoingplayer_id.
The callback amount and your response balance are integers in the same minor units: a bet of 500 at balance 10000 returns balance 9500 with no unit conversion anywhere. For a bet the player cannot afford, respond 402; the bet is not placed.
Step check: after one spin, your ledger records the expected paid/free movements without duplicates, and your endpoint answered each callback within 5 seconds.
Settlement
Section titled “Settlement”Some zero cash legs are completed inside Aggregator.gg without a wallet callback. This is not a rule to discard every zero amount: free-round wins can be delivered with amount: 0, including win-only settlement. Reconcile each recorded leg against its expected movement and delivery evidence; finished and transaction IDs have different roles.
Sessions expire automatically. When the player reopens the game after expiry, call POST /v1/sessions for the same player_id with a new Idempotency-Key, then open the returned game_url. If a launch request times out, retry that launch with its original key and body. A replay can return the previous launch response. Session idempotency
Betting windows depend on the game. For new ordinary and US Sweepstakes sessions using CPAPI, the window for new bets is 24 hours from the operator’s launch. A relaunch opens a session for new bets. Keep accepted movements on the original session and process outstanding settlements under their original transaction identities. If a callback was already applied, return the saved result without moving money again. CPAPI session expiry
Step check: GET /v1/transactions lists every leg of your test rounds, and the expected paid/free/reversal effects agree with your ledger. Platforms arrange brand-level evidence separately; the machine transactions feed is not a consolidated brand feed.
Failure recovery
Section titled “Failure recovery”- Timeout, connection failure or HTTP 5xx: we usually retry it on the schedule in Callbacks; some free-round settlements are sent once. Preserve the same scoped transaction identity.
- HTTP 3xx/4xx: terminal delivery responses; fix the cause and investigate safe recovery. A recognized 402 is a business decline.
- Malformed HTTP 200 or another 2xx: delivery is unknown; automatic redelivery stops. Reconcile the original outcome before recovery.
- Callbacks arrive out of order: validate trusted session and player context and the provider-specific lifecycle; do not assume one bet/win pair or credit arbitrary unmatched events. Free-round win-only settlement is explicitly supported.
- Launch outcome is unclear: retry the same session operation key and body within the response-cache contract. Reconcile before making a fresh operation; creating another session is not proof that the first failed.