Settle
PUT https://{PARTNER_API_URL}/payment/bet with type: 2
This request will be performed when our system calculates result and payout for previously placed bet. When you receive a request you should perform the following actions on your side:
- Check that the method is PUT and the type === 2.
- Verify request signature.
- If the request data contains field "resultType": "cashout" — you must verify user token. In other cases there is no requirement for token to be validated because other requests will be initiated not by a user but by our system.
- Find the bet in your system by transactionId (this id initially was sent with place bet request).
- Update the user balance and perform payout based on the amount and currency fields.
- amount === 0 — means lose, do nothing with balance.
- amount > 0 — meaning win/refund/cashout. You should add the amount value to the user balance.
- Respond to a request informing us about operation results.
Resettle
Settle endpoint could be requested several times in case of result changes or if the previous settle request was failed. If this happens you should check corresponding transactionId state and perform the actions (including user balance update) to ensure that our systems are back in sync.
The resettling of the bet happens in the following cases:
- There was a timeout or unexpected error during our previous request. So we re-trying the request with the same data one more time.
- The event’s result was incorrect and therefore depending bets should be recalculated.
- The event was canceled, and it is necessary to return the event’s bets.
To correctly process resettlement request:
- Re-check previously applied bet settlement (use transactionId). If everything is matching — just respond with success.
- If the bet payout (amount value from the previous Settle request) on your side differs — revert the previous assessment.
- Make a new payment based on the new amount received from the Settle request.
Blocking bet resettlement
If you received a request to change bet result but your system rules does not allow this, you can respond with HTTP status code 400 and code: 20 in the body:
{
"code": 20,
"message": "Recalculation transaction is blocked"
}
Request Examples
The request data contains all common parameters for Place bet with the following additions:
- type: The value is 2.
- amount: This field now holds the amount that should be paid out to a user (do not confuse with the bet amount from the Place bet request).
- resultType: A new field informing about the bet settlement result. Possible values:
'won' | 'lost' | 'refund' | 'cashout'. - token: Included only for cashout requests. These requests are issued by the user and therefore must be re-authenticated.
{
"token": "5caa4cabce523c2f7610c50ce9819bfb",
"type": 2,
"transactionId": "b26153f9-ef3a-4768-b6c8-0861acdecb7a",
"userId": "1999",
"coefficient": 1.2,
"amount": 12.12,
"currency": "USD",
"resultType": "won",
"bonusId": 10,
"bonusTemplateId": 2,
"gameType": "sportsbook",
"requestId": "d9195aef-9492-43dd-88d0-dc1732a37f4e",
"ticketType": "single",
"boosterCoefficient": 1
}
Response examples
{
"transactionId": "b26153f9-ef3a-4768-b6c8-0861acdecb7a",
"transactionTime": "2020-01-16T12:07:23.596Z"
}
The table below describes the response:
| Parameter | Type | Validation | Description |
|---|---|---|---|
| transactionId | string | 10-36 | A unique identifier for the bet. |
| transactionTime | datetime | ISO 8601 | Transaction UTC time in ISO 8601 format. |