Appearance
API Callbacks
INFO
There is no way to set callback URL for demo API keys.
Callback body
json
{
"type": "Callback type",
"session": {
"id": "Session id",
"playerId": "Player id (in your database)",
"gameId": "Game mame (example: Mines)",
"currency": "Currency name (in your database - created with currencyName parameter)"
},
"game": {
"id": "Unique game id",
"status": "Game status (in_progress / win / lose)",
"payout": 0.00,
"profit": 0.00,
"bet": 1.00,
"round": 1
},
"data": {
},
"time": 1663249396
}
time
Timestamp (milliseconds since January 1, 1970, 00:00:00 GMT) when this callback was sent from our server to yours.
This is used alongside with balanceUpdateDelay
to make balance updates precises. Example:
javascript
const gameInfo = {
id: 'Plinko',
balanceUpdateDelay: 3500
/* ... */
};
const callback = {
type: 'finish',
/* ... */
time: 1663249721934
}
const time = new Date().getTime();
setTimeout(() => {
// Update balance client-side
}, Math.max(time - callback.time, 0));
// If you are sending events from server to client via websockets or something else, take into account the time it was taken for client to receive the event too.
Type: start
Body
json
{
"type": "start",
"session": {},
"game": {},
"data": {
"bet": 1.0,
"allBetAmount": 3.0
},
"roundData": {}
}
bet
Bet amount.
allBetAmount
Total amount of bets made by user in current game session. For example, three bets with 1.0 amount in one session will make this value 3.0.
INFO
Value resets with each new session. Game session doesn't expire; user or you can use it in the future.
roundData
Only exists if game allows to make bets on more than one outcome (for example, Roulette).
Read more about roundData parameter
Response
TIP
This callback is used to check user balance. You can save game instance in your database here.
Return { "result": true }
to start the game or { "result": false }
to show "No balance" screen.
Type: finish
Sent to your server after game finishes: either it's status is lose
or win
.
Body
TIP
Check session
and game
fields for result information.
json
{
"type": "finish",
"session": {},
"game": {},
"data": {
"balanceUpdateDelay": 1000
}
}
Response
Return empty response: {}
.