Appearance
Create template
This method helps create a new bonus template.
NOTE: This method is optional. The PartnerBoard is the most reasonable way to create new templates.
POST https://{S2S_API_URL}/bonuses/templates/add
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 = [
"name" => "Bonus freebet",
"type" => "freebet_standart",
"enable" => true,
"betCount" => 1,
"cid" => "fbet",
"stage" => 1,
"fromTime" => 1608664515,
"toTime" => 1608833444,
"daysToUse" => 1,
"betAmount" => 5,
"maxWin" => 4,
"currency" => "USD",
"minSelection" => 1,
"maxSelection" => 2,
"minOdd" => 1,
"maxOdd" => 3,
"disciplines" => [
"csgo"
],
"maxWinCurrency" => "USD",
//availableCountries:["UA", "US"],
//availableTournaments: ["123123", "2313132"],
];
$jwtParts = explode('.', JWT::encode($payload, $PARTNER_SECRET, 'HS256'));
$signature = implode('.', [$jwtParts[0], '', $jwtParts[2]]);
// x-sign-jws=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..u9GyBh2rywlZb1arI76ffSq_hcrOkSqTZG4SXFQ0yhw
echo "x-sign-jws=$signature";
// send the request
$body = json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$url = 'https://{S2S_API_URL}/bonuses/templates/add';
$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 |
|---|---|---|
| name | string | Name of the bonus (assigned by the Partner and displayed in the Partnerboard in the template list). Max length 255. |
| type | string | Bonus template type (freebet_standart). |
| enable | boolean | Indicator of the fact that the template is enabled when giving bonuses to users. |
| betCount | integer | The number of bonuses that can be given to one player by the current bonus template. Max number 1000. |
| cid | string | Partner API Key. |
| stage | integer | Stage of bet: 1 - prematch 2 - live 3 - prematch and live |
| fromTime | integer | Timestamp in Unix Time defines the start date of the template to issue bonuses. |
| toTime | integer | Timestamp in Unix Time defines the end date of the template to issue bonuses. After this date, it will not be possible to use the bonus: the apply method will cause an error. |
| daysToUse | integer | The number of days after the bonus activation when the player has to use the bonus.Max number days 201. |
| betAmount | float | The bet amount of bonuses can be issued per player according to the bonus template. |
| currency | string | Currency code. Sets the template’s currency. |
| maxWin | float | The maximum possible amount of winnings in the currency specified in the maxWinCurrency value. maxWin = (betAmount*coefficient) - betAmount |
| minSelection | integer | A minimum number of ticket (regular or combined) outcomes for one freebet issued on the current template. |
| maxSelection | integer | A maximum outcomes number in the ticket (regular or combined) per one freebet issued on the current template. |
| minOdd | float | Minimum odds of the outcome to use the freebet. |
| maxOdd | float | Maximum odds of the outcome to use the freebet. |
| disciplines | array of string | List of allowed disciplines. Use discipline id from Available Disciplines |
| maxWinCurrency | string | Currency code for the maxWin value. Optional value, default USD |
| availableCountries | array of string | List of allowed countries ISO 3166-1 alpha-2. Use the ISO countries if you want to limit the bonus to players from these countries only |
| availableTournaments | array of string | List of allowed tournaments. Use tournament id from Available tournaments |
A response examples:
HTTP status code: 200
json
{
"id":1,
"name":"Bonus freebet",
"isEnable":true,
"type":"freebet_standart",
"cid":"fbet",
"stage":2,
"fromTime":1607558400,
"toTime":1639094400,
"daysToUse":5,
"disciplines":[
"csgo"
],
"freebetData":{
"minSelection":1,
"maxSelection":2,
"minOdd":1.01,"maxOdd":3,
"betAmount":5,
"betCount":5,
"maxWin":100,
"currency":"USD",
"maxWinCurrency": "USD"
},
"availableCountries": null,
"availableTournaments": null
}