API reference: calls you receive
Rollback
We undo a withdraw that failed or whose outcome is unknown. Sent until you accept it; may come up to three times for a withdraw you never saw.
POST {wallet-url}/rollback
- Called
- for a withdraw that ended without a clear success or refusal; for each bet of a void Crash round
- Timeout
- your credit timeout: 5,000 ms unless agreed otherwise (1,000–10,000 ms)
- Retries
- until accepted, as deposit; one extra after a 408 (below)
- Idempotency key
provider_tx_id
Return the stake of the withdraw named in rollback_provider_tx_id. Only a withdraw is ever rolled back; there is no call that takes a win back. Accept a rollback whatever the state of the token or the session.
Request#
| Field | Type | Presence | Meaning |
|---|---|---|---|
user_id | string (1–128 chars) | required | Your player reference: the user of the launch. |
currency | string | required | The session currency (the round's currency). |
amount | integer (≥ 1) | required | The stake being returned, in units. |
provider | string | required | Our provider key. |
rollback_provider_tx_id | string | required | The withdraw to undo, <roundId>:debit. |
provider_tx_id | string | required | This rollback's own id, <roundId>:rollback: a string, not a number. The same on every attempt. |
game | "dice" | "limbo" | "mines" | "plinko" | "crash" | "chicken" | "keno" | "tower" | "hilo" | required | The game identifier. |
session_token | string | required | Our token for this game session: 64 lower-case hex characters, made at launch and sent in every later call of the session, also after it ended. It is not a credential. |
action | "bet" | required | Always bet. |
action_id | string | required | The id of the bet being undone, <roundId>. |
The ids we send#
| Field | Value | Length |
|---|---|---|
provider_tx_id | <roundId>:rollback | 45 characters |
rollback_provider_tx_id | <roundId>:debit | 42 characters |
action_id | <roundId> | 36 characters |
Every id is a JSON string, never a number. <roundId> is a UUID written as 36 characters: lower-case hex digits (0–9, a–f) and four hyphens. A suffix is a colon and lower-case letters, so each id always has the length shown. The longest id we send in any call is <roundId>:rollback, 45 characters. Store our ids as strings of at least 45 characters and compare them exactly: a numeric column, or a shorter one, cannot hold them.
Answer#
| Field | Type | Presence | Meaning |
|---|---|---|---|
code | integer | required | The outcome: see the codes. Always answer with HTTP status 200. |
message | string | optional | A short text for people. We do not read it, except on a 412 to withdraw. |
data | object | required with code 200 | The result. Required with code 200 (and, on a money method, with 409). |
data.user_id | string | optional | Must equal ours if present. |
data.operator_tx_id | any JSON | optional | Your transaction id, any JSON value. We keep it for support. |
data.provider | string | optional | Ignored. |
data.provider_tx_id | string | optional | Our provider_tx_id. Must equal ours if present; required on a 409, where it shows that the stored transaction is ours. |
data.old_balance | integer | optional | The balance before the call, in units. Checked to be an integer, not used. |
data.new_balance | integer | required in data | The balance after the call, in units. Shown rounded down. From a 409 it is not used as a figure: it may be older than the balance already shown. |
data.currency | string | optional | Must equal ours if present. |
Examples#
Request
{
"user_id": "u_829301",
"currency": "USD",
"amount": 5320,
"provider": "banzaro",
"rollback_provider_tx_id": "0192f3c1-7a5b-7cc3-9d2e-1f2a3b4c5d6e:debit",
"provider_tx_id": "0192f3c1-7a5b-7cc3-9d2e-1f2a3b4c5d6e:rollback",
"game": "dice",
"session_token": "5f2b8c1d9e3a4f60718293a4b5c6d7e8f9012345678901234567890123456789",
"action": "bet",
"action_id": "0192f3c1-7a5b-7cc3-9d2e-1f2a3b4c5d6e"
}Accepted
{
"code": 200,
"message": "ok",
"data": {
"user_id": "u_829301",
"operator_tx_id": "561",
"provider": "banzaro",
"provider_tx_id": "0192f3c1-7a5b-7cc3-9d2e-1f2a3b4c5d6e:rollback",
"old_balance": 44672,
"new_balance": 49992,
"currency": "USD"
}
}Already processed (409)
{
"code": 409,
"message": "already processed",
"data": {
"user_id": "u_829301",
"operator_tx_id": "561",
"provider": "banzaro",
"provider_tx_id": "0192f3c1-7a5b-7cc3-9d2e-1f2a3b4c5d6e:rollback",
"old_balance": 44672,
"new_balance": 49992,
"currency": "USD"
}
}Not found (408)
{
"code": 408,
"message": "transaction not found"
}Codes and what we do#
| Code | Meaning | What we do |
|---|---|---|
200 | Returned. | The bet is void. |
401 | Invalid token. | Sent again: a rollback must be accepted whatever the token's state. An alert after 10 attempts. |
403 | Expired token. | As 401. |
408 | You have no such withdraw. | Nothing to undo: the bet is void. After a withdraw that got no answer from you, the first 408 is not final: we send the rollback again 30 seconds later and, after a second 408, once more 5 minutes after that; only a third 408 is final. Remember the id (rule 2 below, recommended). |
409 | Already processed. | With our provider_tx_id in data: the bet is void. Without it: an unknown outcome, sent again, and an alert. |
413 | Our signature did not verify. | Sent again, and an alert. |
500 | Any other error. | Sent again. |
When there is no usable answer#
An unknown outcome means the call may or may not have been applied. For rollback: we send it again, with the same provider_tx_id.
| What arrived | Read as |
|---|---|
| No answer within the timeout, a network error, a redirect (never followed) | unknown outcome |
| HTTP status 500 or higher, whatever the body says | unknown outcome |
HTTP status below 500 with a JSON body and an integer code | the code counts, whatever the HTTP status |
A body that is not JSON, has no integer code, or has code 200 without the required data fields of the right type (amounts by the integer rule) | unknown outcome |
Code 200 whose data.provider_tx_id, data.user_id or data.currency differs from ours | unknown outcome |
A money method answered 409 without our provider_tx_id in data | unknown outcome, and an alert on our side |
| A code this method does not list | read as 500 |
The second rollback#
A withdraw we gave up on may still be on its way to you. If it arrives after you answered 408 to its rollback, the stake would be taken for a void bet. So when a withdraw got no answer from you (nothing in time, a network error, an HTTP 5xx, or a body without an integer code), we send its rollback a second time 30 seconds after your first 408 and, if you answer that one 408 too, a third time 5 minutes after the second. If the withdraw arrived in between, answer that rollback 200 and return the stake. For a withdraw that arrives later still, rule 2 (recommended) applies: refuse it.