API reference: calls you receive
Player info
We ask for the player's current balance.
POST {wallet-url}/info
- Called
- when the game refreshes the balance, when a round has no balance of its own, and by Test connection
- Timeout
- your debit timeout: 2,000 ms unless agreed otherwise (500–5,000 ms)
- Retries
- never
- Signed
- yes
Not called at launch (auth gives the opening balance). The game calls it after a failed bet request, after a bet answered without a balance, and on your page's ifc.update.balance command; each session may cause at most 6 such reads a minute. It is also used for a round whose only balance came from a 409, and for a free-bet round whose deposit is not confirmed yet. Whenever a round has no balance figure we may show and this call fails, the round is still answered as placed (code 200 on your page's ifc.make.bet.complete or ifc.cashout.complete) and its result shown, without a balance, and the game reads the balance once more.
Request#
| Field | Type | Presence | Meaning |
|---|---|---|---|
user_id | string (1–128 chars) | required | Your player reference: the user of the launch. |
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. |
currency | string | required | The session currency (the round's currency). |
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. Not used. |
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.username | string | optional | Ignored. |
data.balance | integer | required in data | The balance in units. Shown rounded down. |
data.currency | string | optional | Must equal ours if present. |
data.is_bonus_balance | boolean | optional | Updates the "Bonus" tag beside the balance. |
Examples#
Request
{
"user_id": "u_829301",
"session_token": "5f2b8c1d9e3a4f60718293a4b5c6d7e8f9012345678901234567890123456789",
"currency": "USD"
}Accepted
{
"code": 200,
"message": "ok",
"data": {
"user_id": "u_829301",
"username": "Dan",
"balance": 49992,
"currency": "USD",
"is_bonus_balance": false
}
}Refused (401)
{
"code": 401,
"message": "session not found"
}Codes and what we do#
| Code | Meaning | What we do |
|---|---|---|
200 | The balance. | Shown to the player, in the order of our balance numbering. |
401 | The session or token is not valid. | The game is told the session ended (INVALID_SESSION). |
403 | The session or token expired. | As 401. |
413 | Our signature did not verify. | The balance stays as shown; WALLET_UNAVAILABLE, and an alert. |
500 | Any other error. | The balance stays as shown; WALLET_UNAVAILABLE. |
When there is no usable answer#
An unknown outcome means the call may or may not have been applied. For info: the balance stays as shown.
| 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 |