The Scheme of User Interaction with the Game.
For the correct work of the application, it's necessary to proxy:
The example of configuration for apache::
<Location ${abx_play_folder}>
RewriteEngine On
RewriteCond %{REMOTE_HOST} (.+)
RewriteRule . - [E=RH:%1]
RequestHeader set X-Real-IP %{RH}e
ProxyPass http://static.abx-play.fun
ProxyPassReverse http://static.abx-play.fun
</Location>
<Location /${billing_uuid}/api/>
RewriteEngine On
RewriteCond %{REMOTE_HOST} (.+)
RewriteRule . - [E=RH:%1]
RequestHeader set X-Real-IP %{RH}e
ProxyPass http://data.abx-play.fun/${billing_uuid}/api/
ProxyPassReverse http://data.abx-play.fun/${billing_uuid}/api/
</Location>
The example of configuration for nginx:
location ${abx_play_folder}/
{
proxy_pass http://static.abx-play.fun/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host static.abx-play.fun;
proxy_set_header Authorization "";
}
location /${billing_uuid}/api/
{
proxy_pass http://data.abx-play.fun;
access_log /var/log/nginx/slot_api.access_log mainext;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
}
The page code should have the following:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="${abx_play_folder}/loader/loader.js"></script> //script for downloading the games
<script type="text/javascript">
window.init_loader({
currency: "${currency}", //player's currency
language: "${language}", //localization
home_page: "${home_url}" //by default "/" - url of the home page when you exit the game with the corresponding button in the game (home)
token: "${session_token}", //unque user id
billing: "${billing_uuid}", //billing ID
game: "${game_id}", //game ID, e.g.: abx_egypt_riddles, ID list is given in the configuration file with games
kf_list: [${denomination_list}], //possible denomination values, is set by an array, for example [1,10,500], by default [1,5,10,50,100,500]
bet_per_line: [${bet_per_line}], //possible bet per line values, is set by an array, for example [1,10,500], if not specified the default array will be used
kf: "${denomination}", //credit cost in foreign currency (value 1 means that 1 credit = 1 cent)
path: "${abx_play_folder}/", //proxy path, the default value - /media
});
</script>
<div id="game-content"></div> //The container with the game, ID cannot be changed
function getSlotSessionToken() {
$tokens = array($this->getUserId(), session_token_id());
$tokens[] = md5($tokens[0] . "," . $tokens[1] . ",some_secret_message");
return implode('|', $tokens);
}
During the game, the server interacts with the billing of your site via POST /.../do, to change the player’s balance as soon as it changes in the game (spin or win). The method accepts JSON with the following fields:
"session" - the identifier of the game session. The key by which billing conducts operations with the account;
"method" - "do" - what should happen/type of operation - withdrawals/replenishments;
"minus" - the withdrawal amount specified by a positive number, which means the withdrawal amount expressed in cents or dollars (regulated by the parameter on the server) or 0;
"plus" - the replenishment amount specified by a positive number, which means the replenishment amount, expressed in cents or dollars (regulated by the parameter on the server) or 0;
"trx_id" - a unique transaction number (string), in which there may be a positive number or UUID;
"sign" - a unique signature for requests from the application server to the client billing server (used optionally upon your request). Sign signature authentication must be done on the client billing side;
"tag" - the destination of the operation containing the nested structure (used optionally at your request), with the following optional fields:
//for Slots:
{
"game": "slot",
"game_id": "a_op", // The source of the game on the server is specified in the configuration file as source
"game_uuid": 254321, // spin id in the system
"lines": 1, // Number of lines in the spin
"bet": 1, // Bet
"denomination": 10 // Denomination
}
//for Egames:
{
"game": "egame",
"game_id": "turbokeno", // Game source
"game_uuid": "AA-BB-CC", // Bet ID in the system**
"bets": [ // Bets
"[0]:1000", // Bet:amount
...
],
"result": [1,2,3,4,5,6,7...] // Game result
}
//for Bets:
{
"game": "bet",
"game_id": "2023", // The source of the game on the server is specified in the configuration file as source
"game_uuid": "AA-BB-CC", // Bet id in the system
"round": 10000, // Round in the game
"bets": [ // Bid Array
"[0]:1000", // Bet:Amount
...
],
"result": [1,2,3,4,5,6,7...] // Draw result
}
All request fields must be filled out, an exception is a balance request, in which the "game_id" parameter in the field "tag" can be empty.
$str = "do::".$json['session']."::".$json['trx_id']."::".$salt;
for($i=1; $i<=45; $i++) {$str = md5($str);}
If the signature sign received from the application server does not
match the calculated string $str, then billing should
return a response: {”status”: "sign_not_found"}
The service expects one of the following answers::
If the operation is successful:
{ "status":"OK", "balance":195650, "currency": "FUN" }
If an error occurs:
{ "status":"not_enough_money", "balance":2, "currency": "FUN" } //if a player has insufficient balance.;
{ "status":"session_not_found" } //session is not found;
{ "status":"sign_not_found" } //if the sign field does not match between the application server and client billing.
{ "status":"session_limit_exceeded", "limit":60 } when a session is blocked for a set period of time, in seconds. During the specified time (limit), the session will be blocked and the user won't be able to place bets in all games.
These are all possible answers and types of errors, there cannot be any others.
The game calls this method after each event in it, which affects the player’s balance.
NOTE: If the server does not receive a response, it will make 10 more access attempts. On the side of your billing, you need to control that the balance is not withdrawn or replenished more than once for a request with the same trx_id. In case of two requests with the same trx_id, for the second request, it is necessary to return the current balance without withdrawing anything. By default, to protect against unforeseen technical problems after 10 unsuccessful requests in a row, billing is blocked for 1 minute. If you send a request, this time can be increased or you can enable unlock via api.
The simplest example of API billing implementation can be downloaded here: for PHP, for Python.
Implement this method on the billing server and pass the link to it to the manager (integration debugging must be done on test servers).
After that the manager will provide you with ${billing_uuid} – a unique identifier of the partner.
Frequency of data exchange between the server and the game:
When initiating a request (init) and with some periodicity, the game
polls our server for a change in balance and a change in a player’s
session. This is necessary to provide the client with the current
balance and verify that he has another session (to prevent the execution
of unwanted operations with the same login, but different sessions).
Interaction between the server and your billing:
The server in standby mode polls your billing once a minute, with a
change in status - with less frequency. This is done to prevent
situations in which on your side too frequent requests from the server
will be perceived as DDoS attacks.
Information on calculated bets:
The server transfers the total amount of the rates. If you need to get a
result for each bet, it’s possible to provide a calculation algorithm
(the $tag field is used for this).
NULL_REQUEST
The request is sent when opening the game every 30 seconds to obtain the
current status and balance of the session. The request is as follows:
game_uuid”:-1,“game_id”:“”,“game”:“none”.
Request example:
request: {"trx_id":"trx2_41a_18786621", "tag":{"lines":0, "game_uuid":-1, "game_id":"", "game":"none", "denomination":1, "bet":0}, "sign":"a1a0656a4f012024875dd12a33b45944", "session":"3aa4e5b570ad412095d9205e8ee50dd3", "retry":0, "plus":0, "minus":0, "method":"do"}
BET
Request to place a bet. In these requests always “minus” > 0 and “plus” = 0.
Request example in slot games:
request: {"trx_id":"trx2_41a_19130677", "tag":{"lines":45, "game_uuid":"813760047", "game_id":"ab_al", "game":"slot", "denomination":10, "bet":5}, "sign":"bc43deffd2cb222ff59ebd5a77d4ace5", "session":"c9f13180688249efa8ba70499579a67e", "retry":0, "plus":0, "minus":4.5, "method":"do", "free":{}}
BET_WIN
Request for enrollment of winnings based on the result of a round/draw. In these requests always “minus” = 0 and “plus” > 0.
Request example in slot games:
request: {"trx_id":"trx2_41a_19130716", "tag":{"lines":9, "game_uuid":"813760047", "game_id":"ab_al", "game":"slot", "denomination":10, "bet":5}, "sign":"52a059466043a470b4e3132b99b8cb9a", "session":"c9f13180688249efa8ba70499579a67e", "retry":0, "plus":5.0, "minus":0, "method":"do"}
BET_LOOSE
Request with the result of the round where the bet lost. These requests
always have “plus” and “minus” = 0. In slot games, this option is
enabled by customer_id when contacting technical support.
Note:
game_uuid in BET_WIN, BET_LOOSE requests always
corresponds to the value in the BET request.
“game_uuid”:-1.Games supporting tournaments and platform's jackpots
The tournament cannot run simultaneously with the styled jackpots; in this case, use the platform's jackpots.
Games supporting styled jackpots