The Cancel request is used for rejecting previous Debit request and declining possible funds withdrawn from the player's balance.
If the Cancel request fails due to a non-business problem, such as a connection timeout, unavailable resource, etc., RubyPlay will retry this Cancel request until the success to make sure that possible funds withdrawal was canceled.
The initial retry will be done a maximum 10 times with pauses for a fixed period of time equal to 1 second between attempts. If the last 10th attempt fails, the request will be retried with pauses for a fixed period of time equal to 60 seconds until successful processing without retry number limitation.
The Cancel request on the Operator side must be idempotent (see the note in the Overview section of this document). It means if several of the same Cancel requests come, the response must be with the same result and should not contain the error of duplicated transaction ID.
In case of non-determined (unpredicted) HTTP server errors with HTTP Status Code 5xx (500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511) from the wallet's side, RubyPlay will also retry this Cancel request until the success.
It is also possible to explicitly trigger the Cancel request retry apart from responding with HTTP Status Code 5xx. For this purpose, the response to the Cancel request must contain HTTP Status Code 200 "OK" and the HTTP body must contain a "code" property equal to "501" (Retry / cancel triggered).
If the Cancel request receives the response with the HTTP Status Code 200 "OK" and the response code (described in the Response Codes) is considered failed (100, 101, 102, 103, 104, 105, 106, 107), RubyPlay will not retry the Cancel request (because the Operator has already responded with the description of the problem).
API Call Sample:
- Generated server url.http://integrator-gaming-platform.io/rest/v1/api/cancel
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
http://integrator-gaming-platform.io/rest/v1/api/cancel \
-H 'Content-Type: application/json' \
-d '{
"sessionToken": "0Ja8M7KvY",
"playerId": "24681",
"promotionId": "3",
"externalCampaignId": "Promo 3",
"currencyCode": "EUR",
"gameId": "rp_12",
"country": "US",
"amount": 2,
"roundId": "444301",
"referenceTransactionId": "1005",
"gameRoundEnd": true,
"freeRound": true
}'{ "code": "0", "description": "Success", "balance": 500.45 }
Request Schema:
Login session token, provided by the Operator side. Used in all requests initiated by RubyPlay (the RGS) when invoking the Operator GP service.
Unique player ID on the Operator side.
The ID of the campaign if a free round is reported. The wallet is expected to return the promotion balance for the specified promotionId along with its status, even if the campaign is no longer available (completed or expired).
The external ID of the campaign if a free round is reported and an external ID was set during the campaign creation.
Currency used by the current player.
Unique game ID on the Operator side.
ISO 3166-1 alpha 2 country code. It corresponds to a country the played launched the game from, defined by client IP of the game init request.
The amount of the original Debit that should be refunded.
Game round ID. One game round can contain several transactions. When the last transaction is sent, the game round is being closed and no transactions can be processed within the same game round anymore.
Unique transaction ID. Can be used in the retries to send a transaction (for example, in case of failure). Transaction ID has to be idempotent during handling. It means if transaction is retried with the same transaction ID, the status of the original transaction is returned instead of creating a new one.
Flag of the end of the game round (true if the game round is over, and false otherwise). When the last transaction is sent, the game round is being closed and no transactions can be processed within the same game round anymore.
Indicates whether the round is free or paid.
Response Schema:
Response code.
Short description of the response code.
The player's balance in the currency which was sent in the currencyCode field of the Balance request.