Refunds
A refund returns a cancelled bet to the player. There is nothing for you to call. A refund arrives at the same callback_url as bets and wins, as a signed POST with transaction_type: "refund". Your wallet applies it and answers with the new balance.
This guide covers what is specific to refunds. The shared rules are on Callbacks, Request signatures and Free rounds.
The one rule that matters most: apply each refund once, and return only what your ledger shows for the original bet.
When your wallet receives a refund
Section titled “When your wallet receives a refund”In real play, a game studio starts every refund. It cancels a bet because it got no clear answer to that bet, or because the round was voided. Aggregator.gg checks the cancellation against the original operation, then calls your wallet. The studio waits for your answer.
Game studio -> Aggregator.gg -> Your walletcancels a bet checks the applies it once, original answers with the balanceWhat follows from this:
- No endpoint. The API has no call that creates or cancels a refund.
- Its own identity. A refund has its own
transaction_id. The operation it reverses is named in two other fields, the reference pair. - Often after a failure. A cancelled bet is often one whose callback to you timed out or failed. Expect refunds for bets you are not sure you applied.
- Not every cancellation reaches you. If the original needed no wallet call, for example a zero stake, we close the cancellation ourselves.
- Readiness check. The cabinet readiness check sends refunds too. It refunds a probe bet, repeats that refund, and refunds two bets of one round at once.
The request
Section titled “The request”A refund uses the same headers as every wallet callback:
| Header | Value |
|---|---|
Content-Type |
application/json |
X-SIGNATURE |
Lowercase hex HMAC-SHA256 of the raw body, keyed with your callback_secret |
Verify the signature over the raw body bytes before you parse the body or move money. The algorithm and code are on Request signatures. A request can also carry X-Request-Id. It is not signed; quote it when you write to support.
Example: the refund of a 1.50 EUR bet whose callback had transaction_id: "bet-123".
{ "action": "ROLLBACK", "transaction_type": "refund", "transaction_id": "rollback:bet-123", "rollback_transaction_id": "bet-123", "amount": 150, "currency": "EUR", "player_id": "player-123", "provider_code": "apparat", "game_id": "550e8400-e29b-41d4-a716-446655440000", "session_id": "a1b2c3d4-e5f6-4890-abcd-ef1234567890", "reference_transaction_id": "bet-123", "reference_transaction_type": "bet"}| Field | Type | Meaning in a refund |
|---|---|---|
transaction_type |
string |
Always "refund". This is the field you branch on. |
action |
string |
The studio’s own label, for example "REFUND", "ROLLBACK" or "CANCEL". Never branch on it or validate it. |
transaction_id |
string |
The refund’s own id, as opaque text. It is never the original’s id, even when it contains that id. |
reference_transaction_id |
string, optional |
The transaction_id of the original bet, exactly as your wallet received it. |
reference_transaction_type |
string, optional |
"bet": the type of the original as your wallet received it. |
amount |
integer |
The amount in minor units: the stake to return. Use the value in the request. |
currency |
string |
The currency of the refund. Your answer must repeat it exactly. |
player_id |
string |
The player the refund belongs to. |
provider_code |
string |
The studio. Part of the identity of the refund and of the original. |
session_id |
string |
The session the cancellation came through. It can differ from the original’s session, so never use it to find or refuse the original. |
game_id |
string |
UUID of the game in the catalog. Can be empty. |
round_id, finished, game, is_free, free_round_grant_id |
Not in every refund. Never require them. |
Studios can add fields of their own, such as rollback_transaction_id or bet_id. Ignore the fields you do not use.
The reference pair
Section titled “The reference pair”The pair tells you which earlier operation the refund reverses.
reference_transaction_idis the original’stransaction_id, character for character, as it arrived in its own callback. Look it up as text.- Search in the same scope as any callback identity: your integration (and brand, on a shared platform wallet), then
provider_code, then the id. - It is not the refund’s own
transaction_id, not around_id, and not an id from your ledger. reference_transaction_typeis"bet". A free bet is also"bet".- The two fields come together or not at all. You never receive one without the other.
When the pair is absent, the refund does not name its original. For SpinGO, bet_id can identify it instead: it equals the bet_id of SpinGO’s bet callback in the same session. If nothing identifies exactly one debit, handle the refund as one whose original you do not have. Never pick a debit by round_id, amount or time: one round can hold several bets.
What to do with the money
Section titled “What to do with the money”We check the original before we send a refund, but only your ledger knows what you took. Look the original up every time.
| Your ledger shows, for the original | Movement |
|---|---|
| A paid bet that you debited | Credit amount once. |
A paid bet that you already returned for an earlier refund with another transaction_id |
None. A bet is returned once. Refuse this refund with a 4xx. |
A free bet (is_free: true), or a bet you declined |
None. You took no real money, so there is nothing to return. |
| No such operation | None. See below. |
No such operation in your ledger. This is a normal case. A bet callback can time out or fail before your wallet commits it, and the studio then cancels the bet. It also happens when your callback URL changed after the bet.
- Move no money, and store the refund under its own identity together with the reference.
- If the original reaches you later, do not debit it. Refuse it with a
4xx. - Answer HTTP
200with the unchanged balance if you have recorded the cancellation and can prevent a late debit. If you refuse with a4xx, store the response and return it if the same refund arrives again. A refusal does not confirm the player’s balance. If the original bet’s outcome is uncertain, reconcile it with support. - Do not answer
5xx. That only asks for another delivery.
Step check: send your handler a refund for a free bet, and one for a bet you declined. The balance does not change in either case.
How to answer
Section titled “How to answer”Answer inside the same time window as any callback. When the refund is applied, or your ledger shows there is nothing to return, send HTTP 200 with the balance after it:
{ "balance": 10000, "currency": "EUR", "player_id": "player-123"}| Field | Type | Rule |
|---|---|---|
balance |
integer |
Required. The balance after the refund, in minor units. A JSON integer, not a string, a float or a boolean. |
currency |
string |
Required. The same code as in the request, in the same letter case. |
player_id |
string |
Optional. Echo the request’s player_id. |
status |
integer |
Optional. If you send it, it must be 200. |
To decline a refund, move no money and store HTTP 402 and its response body under the refund’s identity. On an exact repeat, return that same status and body without crediting the player.
Say no with the HTTP status, never inside a 200. Callbacks allows the body marker "status": 402 for a declined bet. Do not use it for a refund.
How we read your answer
Section titled “How we read your answer”| Your answer | We treat it as | What happens next |
|---|---|---|
HTTP 200, a JSON object with an integer balance and the request currency |
Accepted | The refund is complete. |
HTTP 402 |
Declined | On first delivery, the standard callback flow records a final decline for this refund. The same refund can still reach your wallet again. |
HTTP 200 with any other body, or any other 2xx such as 201 or 204 |
Unknown | We cannot tell whether you applied it. Check your ledger before taking any further action. |
Any 3xx, or a 4xx other than 402 |
Refused | This delivery was refused. The same refund can arrive again. |
A 5xx, a timeout, a connection error |
Not delivered | Usually sent again, see Re-delivery. |
The rules that trip integrators:
balancemust be a JSON integer."10000",10000.0andtrueare not accepted.currencymust equal the request currency exactly."eur"does not match"EUR".statusis optional, but"status": nullor any value other than200is not accepted.error,errorType,codeandmessagemust be absent ornull. A200with"message": "OK","message": ""or"error": falseis not accepted.- Only HTTP
200confirms a refund.201and204do not, whatever the body says. - Send one plain JSON object in UTF-8, uncompressed, under 64 KB, with no repeated keys. We do not follow redirects.
When the refund is still open, look up the refund and original debit in your wallet ledger. For example, if refund-42 references bet-17, check whether you debited bet-17 and whether you already credited refund-42. Give support both IDs and the recorded outcome for each. Preserve the stored response for an exact repeat. Agree any manual adjustment with support before moving money.
Idempotency
Section titled “Idempotency”The same refund can reach you more than once. Apply it once.
- Identity. A refund is identified like every callback: your integration (and brand),
provider_code,transaction_id. See Callbacks. - One database transaction. Commit three things together: the balance change, the refund record with its reference, and the status and body you return.
- Exact repeat. Same identity, same
transaction_type,amount,currencyandplayer_id, and the same reference pair if there is one. Return the stored status and body. Move nothing. The balance in the answer is the stored one. - Different values. Same identity, but one of those values differs. Move nothing and answer
4xx. - Compare parsed fields, not bytes. A re-delivery can order the keys differently.
Three more points for refunds:
- Never key on
round_id, alone or withaction. Two bets of one round are refunded by two refunds, and each must be credited. - Lock per player. Two refunds for one player can arrive at the same moment. Each needs its own credit and the balance after it.
- Replay the stored answer. Only return
409on an exact repeat if that was your original response.
The Idempotency-Key header on Idempotency protects your own API requests. It plays no part in callbacks.
Step check: send the same refund twice, then two refunds of one round in parallel. The first pair moves the balance once and returns the same body twice. The second pair credits both amounts.
Re-delivery
Section titled “Re-delivery”We or the studio can retry a refund. A repeat carries the same transaction_id and the same money values, so it is an exact repeat for your wallet.
- Our standard retry queue makes up to six more attempts after a
5xx, a timeout or a connection error, spread over a little more than an hour. The waits are under Retry behaviour. - The studio can repeat the cancellation itself, at its own pace; Apparat and BubbleGaming do. We forward the repeat with the same
transaction_id, unless your earlier answer was unknown.
For 2J ordinary wallets, a refund can be delivered again after a 402 or another unconfirmed response, on a separate retry schedule. SpinGO refunds reach your wallet once.
Before each attempt from the standard queue we check the refund against its original again. A queued refund is never sent to a new callback URL.
When scheduled attempts run out, the refund still needs reconciliation:
- The queue stops sending that refund. A studio can still repeat its cancellation.
- It does not mean that the player was credited.
- It does not mean that you should credit the player by hand.
- Contact support with the
transaction_id.GET /v1/transactionsshows how we recorded your answers:status,operator_status,operator_responseanderror_message.
A timeout or an error is not permission to credit twice:
- If your wallet applied the refund and the answer was lost, the next delivery is an exact repeat. Return the stored result.
- If you declined it, return the stored decline. If your wallet has no recorded decision, check the original bet and process the refund once.
- Do not credit the player under another id while another delivery can arrive. If you must act by hand, agree it with support first.
Step check: answer a refund with 500 before moving money, then deliver it again. The second delivery credits once and returns 200. A third returns the same body.
Differences by studio
Section titled “Differences by studio”Whatever the studio, the fields of the request are the contract. Branch on transaction_type, find the original with the reference pair, and let your ledger decide the movement. These studios add rules of their own:
| Studio | action |
The original can be | What else differs |
|---|---|---|---|
| Apparat | ROLLBACK |
A paid bet | Adds rollback_transaction_id, equal to reference_transaction_id. Repeats a failed cancellation itself. |
| SpinGO | REFUND |
A paid bet | Adds bet_id. The reference pair can be absent. amount is SpinGO’s own figure. Sent once. |
| BubbleGaming | REFUND |
A bet, including a free bet | A referenced free bet took no real money, so credit nothing for it. Repeats a failed cancellation itself. |
| EBAKA | ROLLBACK, or EBAKA’s own spelling |
A paid bet | The reference pair is always there. EBAKA’s rollback carries no amount of its own, so amount is the whole stake of the bet it names. |
Checklist
Section titled “Checklist”- Your handler branches on
transaction_type: "refund"and ignoresaction. - It finds the original by
reference_transaction_idinside your integration andprovider_code. - It credits only a debit your ledger recorded, and credits nothing for a free bet.
- It returns a bet once, even when a second refund under another
transaction_idnames it. - It handles a refund whose original is missing, and refuses an original that arrives after it.
- It stores the answer with the balance change and replays it for an exact repeat.
- It answers
200with an integerbalanceand the requestcurrency, or declines with HTTP402. - Two refunds of one round, sent in parallel, are both credited.