/
3.4 seamless rollback transaction callback *

3.4 seamless rollback transaction callback *

Rollbacks a given transaction. Rely only on transaction_id.

Explanation

Rollback are sent if any timeouts or other issues happened with debit/credit requests or response. For instance, we send you a debit request, you handle the debit request on your side and for some reasons we don't receive a response and the game crashes. A rollback request will be sent for the debit to player receives the balance back.

Request common parameters
Query string nametype (max)descriptionmandatory
callerIdStringCaller authentication usernameY
callerPasswordStringCaller authentication passwordY
callerPrefixString2 or more letter prefix that is used internally to prefix player username for your accountN
usernameStringPlayer username (non-prefixed) created by your createPlayer callY
Rollback transaction
Query string nametype (max)descriptionmandatory
actionstringExternal service action [balance, debit, credit, rollback]Y
remote_idinteger(10)Unique player id Y
amountdouble(10,2) Amount to credit players accountN
game_idstring (32 - 40)Unique game id, see action available_gamesN
transaction_idstring (32 - 70)Id of transaction that is going to be rollbackedY
round_idstring (32 - 70)Game round id for current running game roundN
session_idstring (32 - 40)Unique game session id generated by gamehubY
keystring(40) Request validation cache keyY
gamesession_idstring (255)Enable tracking the player game sessionsY
game_id_hashstring (100)Related to introduction of id_hash from getGameList method, can be used the same way as currently is game_id usedN
currencystring(3)Players currency code. Uppercase letters
Y

Request: <REMOTE URL>/?action=rollback&callerId=test&callerPassword=12dar67890123&remote_id=1&amount=0.3&game_id =3&transaction_id=27&round_id=123&session_id=123456789012 345678901324567980abcd &key=49f749364b129d9f91d2bef7dd044a93af0fb676&new_parameter=12345&gamesession_id=98erf743arka&game_id_hash=gs_gs-texas-rangers-reward

Response: {"status":"200","balance":"300.00"}

If we get the request with the transaction_id that was already processed on our side, on a retry, the response of the transaction should be the same as on first request.

For example if transaction_id = 61385912731123 response was {"status":"200","balance":"300.00","transactionId":"362984"}, on a retry with same transaction_id it should be exactly the same response.

If customer does not have a transaction on their end, status should be 404.

Status codes

External service can respond with 4 types of status codes. 200 for success, 500 service error, 404 transaction not found and 403 for debit transaction refusal. Only status of 200 will be accepted as OK by the Xapi Platform server.

JSON keytype (max)descriptionmandatory
statusinteger(3) Status codeY
Balancedouble(10,2)Players balance (after transaction)Y
msgstring(255)Error message N

Example: {"status":"200","balance":"300.00",’transaction_id’:’123456’}, {"status":"403","balance":"0.30","msg":"Insufficient funds"}, {"status":"500","msg":"internal error"}, {"status":"404","msg":"TRANSACTION_NOT_FOUND"}

Deep dive into rollback request:
- transaction_id from the request is the transaction that is being rollbacked
- don't use the 'amount' from the request, use the amount in the transaction that is being rollbacked
- In case that you get the rollback for transaction_id that does not exists please return status 404 and some message
- Rollback should be allowed even if the round_id is null or game_id is null or amount is null or "".

Rollback flow:

Related content