Rollback — type: "rollback"
POST{base}/transactionReturns a stake and always names the movement it reverses.
| We send one when | |
|---|---|
| We took the stake and could not record the bet | The ticket never existed. Arrives seconds after the debit. |
| The event was voided or the bet cancelled | The stake goes back; there is no payout. |
| A settlement is corrected | The wrong movement is reversed before the right one is applied. |
Same {base}/transaction address as Debit, same response shape,
same duplicate protection.
Request
| Field | Sent | Rule |
|---|---|---|
type | always | rollback. |
amount | always | What goes back, positive. The amount of the movement being reversed. |
currency | always | ISO 4217. |
reference | always | Your idempotency key, unique to this rollback. |
parentReference | always | The reference of the movement being undone. Without it a rollback is an unexplained credit in your ledger. |
playerId | on service-key calls | Your externalId. |
simulation | connection test only | true marks a connection test: ignore it, answer success, move no money. |
bet | always | The ticket being unwound — the shape Debit defines. On a voided ticket status is REFUND and payout is the stake going back; on the refund of a bet we could not record, id is still null and status still PENDING, exactly as the debit sent it. |
Never
- Never answer
402. A rollback returns money; there is no balance to lack. - Never apply twice. The same
referencereplays the stored result. Twice hands the player a stake they never placed. - Never error on an unknown
parentReference. If you have no record of the movement — you were unreachable, we timed out — answer200with the current balance. Nothing to undo is not a failure, and erroring makes us retry a movement that never happened.
POST {base}/transaction
Authorization: Bearer <player token | your service key>
Content-Type: application/json
{
"type": "rollback",
"amount": 10.00,
"currency": "USD",
"reference": "rb_5c8e2f90",
"parentReference": "bet_9f2c1e4a",
"playerId": "10",
"bet": {
"id": "68a0f1c2d3e4f5a6b7c8d9e0",
"kind": "SINGLE",
"status": "REFUND",
"stake": 10.00,
"totalStake": 10.00,
"totalOdds": 2.10,
"potentialPayout": 21.00,
"payout": 10.00,
"system": null,
"placedAt": "2026-08-16T15:04:05.000Z",
"settledAt": "2026-08-16T21:52:10.000Z",
"selections": [
{
"fixture": {
"id": "11223344",
"name": "Real Madrid vs Barcelona",
"startDate": "2026-08-16T19:00:00.000Z"
},
"sport": { "id": "6046", "name": "Football" },
"league": { "id": "38", "name": "LaLiga" },
"market": { "id": "1", "name": "1X2" },
"selection": { "id": "271", "name": "Real Madrid", "line": null },
"price": 2.10,
"status": "REFUND"
}
]
}
}
curl -s -X POST "https://casino.example.com/api/sportsbook/transaction" \
-H "Authorization: Bearer <your service key>" \
-H "Content-Type: application/json" \
-d '{
"type": "rollback",
"amount": 10.00,
"currency": "USD",
"reference": "rb_5c8e2f90",
"parentReference": "bet_9f2c1e4a",
"playerId": "10",
"bet": {
"id": "68a0f1c2d3e4f5a6b7c8d9e0",
"kind": "SINGLE",
"status": "REFUND",
"stake": 10.00,
"totalStake": 10.00,
"totalOdds": 2.10,
"potentialPayout": 21.00,
"payout": 10.00,
"system": null,
"placedAt": "2026-08-16T15:04:05.000Z",
"settledAt": "2026-08-16T21:52:10.000Z",
"selections": [
{
"fixture": {
"id": "11223344",
"name": "Real Madrid vs Barcelona",
"startDate": "2026-08-16T19:00:00.000Z"
},
"sport": { "id": "6046", "name": "Football" },
"league": { "id": "38", "name": "LaLiga" },
"market": { "id": "1", "name": "1X2" },
"selection": { "id": "271", "name": "Real Madrid", "line": null },
"price": 2.10,
"status": "REFUND"
}
]
}
}'