Appearance
Apply batch bonuses
With this method, you can issue bonuses to users. The method returns:
- A list of player’s bonuses in case of successful processing.
- A list of errors in case of unsuccessful processing.
NOTE: This method is optional. The PartnerBoard is the most reasonable way to issue bonuses to users.
NOTE: One application can contain not more than 1000 players. If the number of players exceeds 1000, divide the list. The bonus can be applied to a player for one templateId only once.
POST https://{S2S_API_URL}/bonuses/bonus/applyBatch
A request examples:
An example using firebase/php-jwt and guzzlehttp/guzzle packages:
php
use Firebase\JWT\JWT;
use GuzzleHttp\Client;
$PARTNER_SECRET = 'testdemo';
$payload = [
'cid' => 'fbet',
"templateId" => 56,
"playersData" => [[
"userId" => "6",
"currency" => "USD",
"betAmount" => 5,
"betCount" => 4,
"forceActivated" => true,
]]
];
$jwtParts = explode('.', JWT::encode($payload, $PARTNER_SECRET, 'HS256'));
$signature = implode('.', [$jwtParts[0], '', $jwtParts[2]]);
// x-sign-jws=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..TOOyqyW6vv3RMKxMFr1LVPyIF0WTaE0UNG5efBLATTU
echo "x-sign-jws=$signature";
// send the request
$body = json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$url = 'https://{S2S_API_URL}/bonuses/bonus/applyBatch';
$client = new Client();
$response = $client->request('POST', $url, [
'body' => $body,
'headers' => [
"Content-type" => "application/json",
"x-sign-jws" => $signature
]
]);
echo $response->getBody()->getContents();The table below describes the following parameters:
| Parameter | Type | Description |
|---|---|---|
| cid | string | Partner API Key. |
| templateId | integer | A unique bonus template identifier assigned by Sportsbook. |
| playersData | List of <PlayerDataItem> | An array containing information about players who need to be given a bonus. Max numbers of items in list 1000. |
The table below describes the PlayerDataItem: Parameter Type Description userId string A unique player identifier assigned by the Partner. currency string Currency code. betAmount float The amount of the Freebet, which will be given to the player. betCount integer The total number of issued bonuses per player. forceActivated boolean If the value is True, the bonus will be assigned an active status.
| Parameter | Type | Description |
|---|---|---|
| userId | string | A unique player identifier assigned by the Partner. |
| currency | string | Currency code. |
| betAmount | float | The amount of the Freebet, which will be given to the player. |
| betCount | integer | The total number of issued bonuses per player. Max number 1000. |
| forceActivated | boolean | If the value is True, the bonus will be assigned an active status. |
A response examples:
HTTP status code: 200
json
{
"items":{
"1243":{
"id":1243,
"templateId":359,
"name":"Bonus freebet",
"type":"freebet_standart",
"userId":"6",
"cid":"fbet",
"stage":3,
"disciplines":[
"csgo"
],
"activationDate":1707749397,
"endingDate":null,
"status":"active",
"fromTime":1707609600,
"toTime":1708041600,
"freebetData":{
"betAmount":5,
"betCount":4,
"availableBetCount":4,
"maxWin":100,
"currency":"USD",
"minSelection":1,
"maxSelection":2,
"minOdd":1,
"maxOdd":5
},
"availableCountries": null,
"availableTournaments": null
}
},
"errorItems":[]
}The table below describes the following parameters:
| Parameter | Type | Description |
|---|---|---|
| items | List of <PlayerBonusItem> | The array contains information about the players who need to be given a bonus. |
| errorItems | List of <ErrorApplyBonus> | The array contains information about errors. |