7) seamless player balance callback *
Returns players current balance.
We recommended you to do not do any checks on balance requests or keep them to very minimal (salt check is required). Since balance requests can come without session or game_id in some cases (provider asks for balance before creating session). We suggest to save the player remote id from createPlayer response on your side and then return balance always for that id.
Query string name | type (max) | description | mandatory |
---|---|---|---|
callerId | String | Caller authentication username | Y |
callerPassword | String | Caller authentication password | Y |
callerPrefix | String | 2 or more letter prefix that is used internally to prefix player username for your account | N |
username | String | Player username (non-prefixed) created by your createPlayer call | Y |
Query string name | type (max) | description | mandatory |
---|---|---|---|
action | string | External service action [balance, debit, credit] | Y |
remote_id | integer(10) | Unique player id | Y |
game_id | string (32 - 40) | Unique game id, see action getGameList | N |
session_id | string (32 - 40) | Unique game session id generated by gamehub | Y |
key | string (40) | Request validation cache key -> sha1([SALT KEY]+[QUERY STRING]) | Y |
gamesession_id | string (255) | Enable tracking the player game sessions | N |
game_id_hash | string (100) | Related to introduction of id_hash from getGameList method, can be used the same way as currently is game_id used | N |
currency | string(3) | Players currency code. Uppercase letters | Y |
Request:
<REMOTE URL>/?action=balance&callerId=test&callerPassword=12dar67890123&remote_id=1&session_id=12345678901234567890 1324567980abcd&key=38432ff064690c9b03da519d0c685b104545 1c9e&new_parameter=12345&gamesession_id=98erf743arka&game_id_hash=gs_gs-texas-rangers-reward
Response:
{"status":"200","balance":"300.00"}
External service can respond with 2 type of status codes. 200 for success, 500 service error. Do not respond with anything else but 200 on balances if possible. They are requests of informational nature and rejecting them is a bad practice and leads to bad player experience. Only status of 200 will be accepted as OK by the Xapi Platform server.
JSON key | type (max) | description | mandatory |
---|---|---|---|
status | integer(3) | Status code | Y |
balance | double(10,2) | Players balance (after transaction) | Y |
msg | string(255) | Error message | N |
Example: {"status":"200","balance":"300.00"}, {"status":"500","msg":"internal error"}