3.4 seamless rollback transaction callback *
Rollbacks a given transaction. Rely only on transaction_id.
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.
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, rollback] | Y |
remote_id | integer(10) | Unique player id | Y |
amount | double(10,2) | Amount to credit players account | N |
game_id | string (32 - 40) | Unique game id, see action available_games | N |
transaction_id | string (32 - 70) | Id of transaction that is going to be rollbacked | Y |
round_id | string (32 - 70) | Game round id for current running game round | N |
session_id | string (32 - 40) | Unique game session id generated by gamehub | Y |
key | string(40) | Request validation cache key | Y |
gamesession_id | string (255) | Enable tracking the player game sessions | Y |
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=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.
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 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",’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: |
---|