Skip to main content

Rollback

PUT https://{PARTNER_API_URL}/payment/bet with type: 3

This request is performed when a bet cannot be completed, either due to errors during the initial Place bet call or during the control stage before final acceptance.

A Rollback may be triggered even if the Place bet request was initially accepted by your system.


Conditions for Rollback

1. Errors During Place Bet Request:

  • Your server responded with HTTP status 400 and error code 100 (System error).
  • Your server returned an HTTP status code other than 200 or 400.
  • Your system did not respond within the 5s timeout.

2. Control Stage (Before Accepting the Bet):

  • Event Completion: The event ended before the bet was finalized.
  • Odds Change: The odds changed since the request was made.
  • Event Withdrawn: The event was removed from trading.
  • Limit Exceeded: The bet failed to meet specific betting limits.

Required Actions

When you receive a Rollback request:

  1. Check that the method is PUT and the type === 3.
  2. Verify the request signature.
  3. Find the bet in your system using the transactionId.
  4. If found, cancel the bet and refund the amount back to the user.
Important

Double-check that your system never refunds the same bet twice! In event-driven architectures, a Rollback might arrive before the Place bet request is fully processed. Ensure your logic handles this race condition.


Request Details

The request data contains all common parameters for Place bet with these additions:

  • type: Value is 3.
  • errorCode: An integer specifying the exact reason for the rollback.

Rollback Error Codes:

CodeReason
8Odds have changed.
9Event has already completed.
10Request timeout on partner system.
32Event has been withdrawn from trading.
50Technical issues occurred while closing the bet.
52Technical issues on the partner’s side.
110Exceeded outcome limit for maximum bet.
111Exceeded outcome limit for win bet.
112Exceeded number of bets allowed on the event.
113Exceeded player limit for maximum bet.
114Exceeded player limit for maximum win.
115Exceeded main betting limit.

Response Example

As a response, we expect the same format as for the Place bet request:

{
"transactionId": "f067f2c2-0126-437d-b28f-df63466e482d",
"currency": "USD",
"amount": 1,
"userId": "ee84b55e-8dc3-4381-b97f-56507723e8dd",
"type": 3,
"coefficient": 1,
"token": "5caa4cabce523c2f7610c50ce9819bfc",
"requestId": "c687d8b8-5fbb-43c2-ac91-95b93f353770",
"bonusId": null,
"bonusTemplateId": null,
"gameType": "sportsbook",
"errorCode": 9,
"boosterCoefficient": 1,
"ticketType": "single",
"bonusAmount": null
}

Success Response Criteria

You should respond positively (HTTP status code 200) in the following cases:

  • Bet Not Found: If no bet is found in your system and there is no need to return funds to a user.
  • Successful Refund: If the bet was found and you have successfully returned the money back to the user.
  • Already Refunded: If the money was already returned during a previous Rollback request; in this case, the current request can be safely skipped/ignored.

Retry Mechanism for Rollback Requests

If a Rollback request fails, the system will automatically retry up to 10 times over a 6-minute period, exponentially increasing the time interval between attempts.

Retry Conditions:

A retry is triggered if the initial Rollback request fails due to:

  1. Timeout: No response received within the 5-second timeout.
  2. Invalid Status: A response with an HTTP status code other than 200 or 400.

Success Criteria:

The system will consider the Rollback request successfully processed and stop retrying only if:

  • The partner's server returns HTTP status code 200.
  • The response body follows the standard format.

Final Response Format

As a response, we are expecting the same format as for the Place bet request:

{
"transactionId": "225450d5-01bb-455e-b513-7acf4451de",
"transactionTime": "2024-09-28T17:12:04.231406Z"
}

The partner's server responds with HTTP status code 400 and a body indicating that the bet has already been processed:

{
"code": 8,
"message": "The bet has already been processed"
}

Here, code 8 signifies that the rollback request was already handled, so our system treats this as a successfully processed rollback.

This retry mechanism enhances the reliability of the Rollback process, giving multiple chances for a successful rollback even in case of transient errors or temporary unavailability of the partner’s system.