Web integration API 1.8
BetGames.TV Partner API
API process flow.
Game communication processes:
- Iframe game client sends requests to BetGames.TV server;
- BetGames.TV server communicates with Partner API to withdraw / deposit players money.
In order to integrate BetGames.TV game client, partner (you) is obliged to implement simple XML-based API described in this document.
Integration involves these steps:
- Implementation of Partner API in Partner testing environment;
- Passing all the test procedures with BetGames.TV engineer (note: before testing procedures please provide a test token page);
- Customization of html iframe client in compliance with Partner web-portal design (note: please check "Proper Way to Present Betgames.tv on your website.pdf");
- Launching in a production environment.
This document describes Partner API.
Token system
On game initialization Partner server generates alphanumeric string called Token and passes it to the client javascript code. This string should satisfy these requirements:
- Contain both letters and digits;
- Be minimum 10 symbols and maximum 100 symbols lenght;
- Be unique for each player;
- Expire after a short period of time (should be configurable, by default 1 minute, but for production has to be changed to 60 minutes).
Important: each successful API method call refreshes token lifetime.
Partner is responsible for implementing token logic.
Token correctness is being tested by BetGames.TV side during testing procedure.
Security check
In order to check the validity of the requests and responses, all the xml packets are being signed. Packets contain “signature” and “time” parameters. Before the request is being proceeded, API should perform validity check of the signature. And perform the validity check of the request creation time. Responses are being signed and checked the same way.
Time parameter
All the requests and responses should contain time parameter. It is equal to the number of seconds since Unix Epoch (January 1 1970 00:00:00 GMT). In PHP there is a method time(), which returns this value. Other programming languages also have similar methods. During XML packet validation, this value should also be checked. If the time of XML packet creation till this validation is more than 60 seconds, this packet is considered to be expired and invalid. The proper error should be returned.
Request example:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>ping</method>
<token>-</token>
<signature>6094dc0397895ee55c93b01f54477527</signature>
<time>1423124661</time>
<params></params>
</root>
Example of successful response:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>ping</method>
<token>-</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423124663</time>
<params></params>
<signature>dee0dda6b4adc6c4e0f67c7e19a3ad0b</signature>
</root>
Signature parameter
Signature is being calculated as MD5 sum of all the parameters and secret key concatenation. Secret key is being generated for each partner personally.
Singnature generation is being explained in following example. We need to sign the following response:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423127764</time>
<params>
<user_id>150205</user_id>
<username>test_player</username>
<currency>eur</currency>
<info>Vilnius, LT</info>
</params>
</root>
- Assemble the parameters string (it's important to assemble parameters in the right order): methodget_account_detailstokenc2696fe0-eba8-012f-596c-528c3f9e4820success1error_code0error_texttime1423127764user_id150205usernametest_playercurrencyeurinfoVilnius, LT Response string must be builded in the same order as XML elements are. Additional parameters (params) are being added in the end of this string in the same order they are going in the request.
- Add current partner secret key. We receive the following string: methodget_account_detailstokenc2696fe0-eba8-012f-596c-528c3f9e4820success1error_code0error_texttime1423127764user_id150205usernametest_playercurrencyeurinfoVilnius, LT1JD4U-S7XB6-GKITA-DQXHP
- Calculate MD5 for the received string: ca9fd88a49f039f5bde952c31247f09a
- Singing the response:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423127764</time>
<params>
<user_id>150205</user_id>
<username>test_player</username>
<currency>eur</currency>
<info>Vilnius, LT</info>
</params>
<signature>ca9fd88a49f039f5bde952c31247f09a</signature>
</root>
Signature validation is being made in similar way. In example you received the following request:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>ping</method>
<token>-</token>
<time>1423124660</time>
<params></params>
<signature>6094dc0397895ee55c93b01f54477527</signature>
</root>
- Assemble parameters string without “signature” parameter: methodpingtoken-time1423124660
- Add the secret key: methodpingtoken-time14231246601JD4U-S7XB6-GKITA-DQXHP
- Count MD5: 6094dc0397895ee55c93b01f54477527
- This md5 sum is equal to the signature parameter. So the validity check is passed.
XML methods. Common notes
BetGames.TV server uses XML to communicate with Partner API via a HttpWebRequest. XML structure is described below. XML structure differs in accordance to method being called.
XML packet specifications
All requests and responses should be wrapped in root packet:
<?xml version="1.0" encoding="UTF-8"?>
<root>
</root>
Methods parameters
Required request params:
- method (varchar) – method name;
- token (vachar) — token sent to game launching Javascript Code;
- params — packet for method additional params;
Example:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<signature>59514741eae44d72480de631b98f51ce</signature>
<time>1423127764</time>
<params></params>
</root>
Required response params:
- method (varchar) – called method name;
- token (varchar) — token from the request;
- success (int) – 1 or 0, response status, in case of success returns 1;
- error_code (int) – Partner internal error code. In case of success returns 0; Note: code 404 is prohibited (being used by BetGames.TV in case of network connection problems);
- error_text (varchar) – text description of the error;
- params — packet for answer additional params;
Example:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423127764</time>
<params>
<user_id>150205</user_id>
<username>test_player</username>
<currency>eur</currency>
<info>Vilnius, LT</info>
</params>
<signature>ca9fd88a49f039f5bde952c31247f09a</signature>
</root>
Common notes and recommendations
Bet structure
For each bet_id, there will be only one transaction_id for payin and only one transaction_id for payout. It could be described as one row in DB table, for example: (bet_id, transaction_payin_id, transaction_payout_id). Field type for bet_id and transaction_id in database must be BIGINT UNSIGNED.
Transaction_bet_payin method checks order
Firstly check if this transaction already exists in your DB. If so don't update player balance, and return success status. Elsewhere check players balance and respond accordingly. For example, if the system repeats same transaction twice in a row and it withdraws the whole balance, your API would respond successfully both times. Elsewhere if balance check is on the first place, second call would return error which is wrong behavior.
Text encoding
To avoid any encoding problems, please provide errors text and user names in Latin symbols only. For example:
Do:
<error_text>Bet not found.</error_text>
<username>john_doe</username>
<info>Beijing</info>
And do NOT:
<error_text>Įvyko klaida</error_text>
<username>Кирилл_Ш</username>
<info>北京</info>
On player logout in partner system
If the player logs out from the Partner's system, current player's token should become invalid.
Payout's retry policy
If the partner server is unavailable or responds with incorrect error code to payout requests, Betgames will repeat payouts until successful response is received. To save traffic and prevent from creating big load for partners' systems, the time interval between payouts increases and will be repeated in following order:
API Methods
Method ping |
---|
Description: Method is being used for detecting API service availability status. Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>ping</method>
<token>-</token>
<time>14231246601</time>
<params></params>
<signature>4cb7b36895e86c22ea2bc9120e3488da</signature>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>ping</method>
<token>-</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423124663</time>
<params></params>
<signature>dee0dda6b4adc6c4e0f67c7e19a3ad0b</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>ping</method>
<token>-</token>
<success>0</success>
<error_code>1</error_code>
<error_text>wrong signature</error_text>
<time>1423124663</time>
<signature>2f731bac67c9a363602f773ac71d12b3</signature>
</root>
|
Method get_account_details | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method is called when the player logs in. Method passes the token generated by Partner server. Method returns players data in case player is logged in to the Partner website and token is valid. Player currency should be the same as in Partner database. Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<signature>59514741eae44d72480de631b98f51ce</signature>
<time>1423127764</time>
<params></params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423127764</time>
<params>
<user_id>150205</user_id>
<username>test_player</username>
<currency>eur</currency>
<info>Vilnius, LT</info>
</params>
<signature>ca9fd88a49f039f5bde952c31247f09a</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>a2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid token</error_text>
<time>1423147340</time>
<signature>bec2559abe0c28466027e383ac86ce19</signature>
</root>
|
Method refresh_token |
---|
Description: Method validates the token. This method is being called when the player is idle. Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>refresh_token</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<signature>122ed52b84777c09a56bc5b0e777a174</signature>
<time>1423127764</time>
<params></params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>refresh_token</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423125818</time>
<params></params>
<signature>1cf45d34ef9951c5e9ae5494312f095b</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>refresh_token</method>
<token>abc-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid token</error_text>
<time>1423229288</time>
<signature>e4546f45daec49d6dadf751eb08c17c9</signature>
</root>
|
Method request_new_token | |||||||||
---|---|---|---|---|---|---|---|---|---|
Description: Method returns valid token. If current token is live, you have to refresh and return it. Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>request_new_token</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<signature>8106b7478f92a57f3f6b725f6007e5a8</signature>
<time>1423126078</time>
<params></params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>request_new_token</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423126078</time>
<params>
<new_token>c2696fe0-eba8-012f-596c-528c3f9e4820</new_token>
</params>
<signature>b8cf58866581b73797305b2cb9ed7673</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>request_new_token</method>
<token>abc-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid token</error_text>
<time>1345808201</time>
<signature>f0dcd1cbc56e880230268b907e6baba6</signature>
</root>
|
Method get_balance | |||||||||
---|---|---|---|---|---|---|---|---|---|
Description: Method returns current player balance in players currency. Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_balance</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<signature>1f1c4dbe2d6fe35ccd7b0cb3081c2c5f</signature>
<time>1423126078</time>
<params></params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_balance</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423126129</time>
<params>
<balance>50000</balance>
</params>
<signature>9f336db3614e5105cd5c7b32de5d65e6</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_balance</method>
<token>abc-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid token</error_text>
<time>1423229288</time>
<signature>9e784891fb366edcc8e4f6e85b5cd02e</signature>
</root>
|
Method transaction_bet_payin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method for money withdrawals from Partners player account for making bets. If there are not enough money, then Partner API should return insufficient funds error.
Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<signature>a91c39b7028bde988d1a6858fafd545a</signature>
<time>1423127617</time>
<params>
<amount>1234</amount>
<currency>eur</currency>
<bet_id>123456</bet_id>
<transaction_id>246912</transaction_id>
<retrying>0</retrying>
<bet>Selected ball will be dropped with No. 1,...,42(1, 3, 10)</bet>
<odd>5.70</odd>
<bet_time>2015-02-05 09:13:37</bet_time>
<game>1</game>
<draw_code>71304050073</draw_code>
<draw_time>2015-02-05 09:15:00</draw_time>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423127617</time>
<params>
<balance_after>48766</balance_after>
<already_processed>0</already_processed>
<aams>S:M42BF200DC66DFQG T:N42BF200EBDD0BKJ</aams>
</params>
<signature>1a4938e2e6804c88d708f9ff8d323c64</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payin</method>
<token>abc-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid token</error_text>
<time>1423229288</time>
<signature>06a2d3c9d7448ee6b0fad54d00cdb946</signature>
</root>
|
Method transaction_bet_subscription_payin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method for accepting subscription payin. Transaction_bet_subscription_payin is used for betting on future draws. Players will have a possibility to place the same bet for several upcoming draws (i.e. 10 draws) in static odds games, so they could "buy in bulk". Basically transaction_bet_subscription_payin method, does the same logic as transaction_bet_payin method. The only difference is that:
Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_subscription_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<time>1528269625</time>
<signature>2beeb78d9f2f9b488fb8f8ae5211ff4f</signature>
<params>
<amount>6170</amount>
<currency>eur</currency>
<subscription_id>123456</subscription_id>
<subscription_time>2018-06-06 07:20:25</subscription_time>
<odd>
<name>SUM of the numbers on the dropped YELLOW balls will be LESS than 73.5</name>
<value>1.9</value>
<translation>SUM of the numbers on the dropped YELLOW balls will be LESS than 73.5</translation>
</odd>
<is_mobile>0</is_mobile>
<game>
<id>1</id>
<name>Lucky 7</name>
<translation>Lucky 7</translation>
</game>
<bet>
<bet_id>123456</bet_id>
<transaction_id>123456</transaction_id>
<amount>1234</amount>
<draw>
<code>71304050073</code>
<time>2018-06-06 07:23:25</time>
</draw>
</bet>
<bet>
<bet_id>123457</bet_id>
<transaction_id>123457</transaction_id>
<amount>1234</amount>
<draw>
<code>71304050074</code>
<time>2018-06-06 07:23:25</time>
</draw>
</bet>
<bet>
<bet_id>123458</bet_id>
<transaction_id>123458</transaction_id>
<amount>1234</amount>
<draw>
<code>71304050075</code>
<time>2018-06-06 07:23:25</time>
</draw>
</bet>
<bet>
<bet_id>123459</bet_id>
<transaction_id>123459</transaction_id>
<amount>1234</amount>
<draw>
<code>71304050076</code>
<time>2018-06-06 07:23:25</time>
</draw>
</bet>
<bet>
<bet_id>123460</bet_id>
<transaction_id>123460</transaction_id>
<amount>1234</amount>
<draw>
<code>71304050077</code>
<time>2018-06-06 07:23:25</time>
</draw>
</bet>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_subscription_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423127617</time>
<params>
<balance_after>48766</balance_after>
<already_processed>0</already_processed>
</params>
<signature>bb15c611416cf9512e70bf3fb7463dcb</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_subscription_payin</method>
<token>abc-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid token</error_text>
<time>1423229288</time>
<signature>104fa720c8e9d44db7a7cb58896bd442</signature>
</root>
|
Method transaction_bet_payout | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method for money deposits to Partners player account – paying out the winnings.
Flowchart diagram:
Request example for games without additional selection (balls, dice, wheel sector): <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payout</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<signature>e456c597cb7f97c168009661b4ee2522</signature>
<time>1423128560</time>
<params>
<player_id>150205</player_id>
<amount>2034</amount>
<currency>eur</currency>
<bet_id>123456</bet_id>
<transaction_id>246913</transaction_id>
<retrying>0</retrying>
<bet_type>won</bet_type>
<game_id>1</game_id>
<final_odd>2.50<final_odd>
</params>
</root>
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payout</method>
<token>5j5JK3JpWr3PXpkwPtAC4TMxX1dVICTE1OS0TbgCwXa3IZItQ7w26pUXINuJ</token>
<time>1611067082</time>
<signature>c866b0d947688ddf92175a323d4177ba</signature>
<params>
<player_id>8</player_id>
<amount>3260</amount>
<currency>usd</currency>
<bet_id>4420111</bet_id>
<transaction_id>13249950</transaction_id>
<retrying>0</retrying>
<bet_type>won</bet_type>
<game_id>11</game_id>
<bet_option>
<name>choice</name>
<value>black</value>
<round>3</round>
</bet_option>
<bet_option>
<name>choice</name>
<value>black</value>
<round>4</round>
</bet_option>
<final_odd>1.80<final_odd>
</params>
</root>
<bet_option></bet_option> element values can be different for each game. Lottery games (Lucky 5, Lucky 6, Lucky 7) example: <bet_option>
<name>ball</name>
<value>25</value>
<round></round>
</bet_option>
<bet_option>
<name>ball</name>
<value>26</value>
<round></round>
</bet_option>
<bet_option>
<name>ball</name>
<value>27</value>
<round></round>
</bet_option>
Dice Duel: <bet_option>
<name>dice</name>
<value>5</value>
<round></round>
</bet_option>
<bet_option>
<name>sector</name>
<value>10</value>
<round></round>
</bet_option>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payout</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423128560</time>
<params>
<balance_after>2092</balance_after>
<already_processed>0</already_processed>
</params>
<signature>736782bf451def853bbad43e210d3787</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payout</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>700</error_code>
<error_text>there is no PAYIN with provided bet_id</error_text>
<time>1423229288</time>
<signature>a678ae382bce2edd151a40d6b470e257</signature>
</root>
|
Method transaction_bet_combination_payin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method for accepting combination payin. Transaction_bet_combination_payin gives a possibility to place one bet consisting of two or more different bets/events. Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<time>1543926540</time>
<params>
<amount>1200</amount>
<odd_value>3</odd_value>
<currency>eur</currency>
<combination_id>123</combination_id>
<combination_time>2018-12-04 12:29:00</combination_time>
<is_mobile>0</is_mobile>
<bet>
<bet_id>1231</bet_id>
<transaction_id>1233</transaction_id>
<draw>
<code>51301010100</code>
<time>2018-01-01 00:00:00</time>
</draw>
<game>
<id>1</id>
<name>Lucky 7</name>
<translation>Lucky 7</translation>
</game>
<odd>
<name>More ODD numbered balls will be dropped</name>
<value>1.5</value>
<translation>More ODD numbered balls will be dropped</translation>
</odd>
</bet>
<bet>
<bet_id>1232</bet_id>
<transaction_id>1234</transaction_id>
<draw>
<code>51301010300</code>
<time>2018-01-01 00:00:00</time>
</draw>
<game>
<id>3</id>
<name>Lucky 5</name>
<translation>Lucky 5</translation>
</game>
<odd>
<name>COUNT of the dropped WHITE balls will be MORE than COUNT of the dropped RED balls</name>
<value>2</value>
<translation>COUNT of the dropped WHITE balls will be MORE than COUNT of the dropped RED balls</translation>
</odd>
</bet>
</params>
<signature>e32ce06ecfbdb76a1813e02881d63cc1</signature>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423127617</time>
<params>
<balance_after>48766</balance_after>
<already_processed>0</already_processed>
</params>
<signature>33059d3b8405d51d46a673c8acec1064</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payin</method>
<token>abc-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid token</error_text>
<time>1423229288</time>
<signature>fbf1851d854329d7f04842f115351421</signature>
</root>
|
Method transaction_bet_combination_payout | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method for money deposits to Partners player account – paying out the winnings.
Flowchart diagram:
Request example without selected additional betting options (balls, dice, wheel sector): <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payout</method>
<token>abc-eba8-012f-596c-528c3f9e4820</token>
<time>1543926924</time>
<params>
<player_id>c2696fe0-eba8-012f-596c-528c3f9e4820</player_id>
<amount>1234</amount>
<type>won</type>
<currency>eur</currency>
<combination_id>123</combination_id>
<bet>
<bet_id>1231</bet_id>
<game_id>1</game_id>
<transaction_id>1235</transaction_id>
<type>won</type>
<final_odd>1.5</final_odd>
</bet>
<bet>
<bet_id>1232</bet_id>
<game_id>3</game_id>
<transaction_id>1236</transaction_id>
<type>won</type>
<final_odd>1.5</final_odd>
</bet>
<final_odd>2.25</final_odd>
</params>
<signature>fe75334d2b064e616ed58d7b0413d915</signature>
</root>
Request example with selected additional betting options (same as for transaction_bet_payout, different <name> for each game can be included like choice, ball and etc): <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payout</method>
<token>5j5JK3JpWr3PXpkwPtAC4TMxX1dVICTE1OS0TbgCwXa3IZItQ7w26pUXINuJ<
/token>
<time>1611071329</time>
<signature>8571541fac780af5ce43d6f5ecbf4931</signature>
<params>
<player_id>8</player_id>
<amount>0</amount>
<type>lost</type>
<currency>usd</currency>
<combination_id>2981</combination_id>
<bet>
<bet_id>4420295</bet_id>
<game_id>1</game_id>
<transaction_id>13250512</transaction_id>
<type>lost</type>
<final_odd>1.5</final_odd>
<bet_option>
<name>ball</name>
<value>16</value>
<round></round>
</bet_option>
<bet_option>
<name>ball</name>
<value>17</value>
<round></round>
</bet_option>
</bet>
<bet>
<bet_id>4420296</bet_id>
<game_id>7</game_id>
<transaction_id>13250513</transaction_id>
<type>lost</type>
<final_odd>1.5</final_odd>
<bet_option>
<name>sector</name>
<value>16</value>
<round></round>
</bet_option>
</bet>
<final_odd>2.25</final_odd>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payout</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423128560</time>
<params>
<balance_after>2092</balance_after>
<already_processed>0</already_processed>
</params>
<signature>7c67a40ae0a3b7884ed45baf75a3cc1d</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payout</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>700</error_code>
<error_text>there is no PAYIN with provided bet_id</error_text>
<time>1423229288</time>
<signature>cea725e94b7683684efb1b7287226850</signature>
</root>
|
Method transaction_promo_payout | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method for money deposits to Partners player account – paying out the promotion winnings. Important notes:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_promo_payout</method>
<token>5j5JK3JpWr3PXpkwPtAC4TMxX1dVICTE1OS0TbgCwXa3IZItQ7w26pUXINuJ</token>
<time>1611072828</time>
<signature>3050679cd4bb83dbd2c8adf8cfccd0c0</signature>
<params>
<player_id>8</player_id>
<currency>usd</currency>
<amount>100</amount>
<promo_transaction_id>77472884103</promo_transaction_id>
<bet_id>92644491027</bet_id>
<game_id>1</game_id>
<promo_type>cashback</promo_type>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_promo_payout</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1423128560</time>
<params>
<balance_after>2092</balance_after>
<already_processed>0</already_processed>
</params>
<signature>736782bf451def853bbad43e210d3787</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_promo_payout</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>0</success>
<error_code>700</error_code>
<error_text>there is no PAYIN with provided bet_id</error_text>
<time>1423229288</time>
<signature>a678ae382bce2edd151a40d6b470e257</signature>
</root>
|
Method transaction_bet_multi_payin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method allows to place multiple single bets with one request. Accept any of sent bets, partial success is possible. Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_multi_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<time>1577836800</time>
<signature>2d7a67bd343de00b8815ecc88d2eebb8</signature>
<params>
<currency>eur</currency>
<is_mobile>1</is_mobile>
<bet>
<bet_id>1</bet_id>
<amount>100</amount>
<transaction_id>1</transaction_id>
<draw>
<code>123</code>
<time>2020-01-01 00:00:00</time>
</draw>
<game>
<id>10</id>
<name>Dice Duel</name>
<translation>Dice Duel</translation>
</game>
<odd>
<id>231</id>
<name>Red dice wins</name>
<value>2.25</value>
<translation>Red dice wins</translation>
</odd>
</bet>
<bet>
<bet_id>2</bet_id>
<amount>100</amount>
<transaction_id>2</transaction_id>
<draw>
<code>123</code>
<time>2020-01-01 00:00:00</time>
</draw>
<game>
<id>10</id>
<name>Dice Duel</name>
<translation>Dice Duel</translation>
</game>
<odd>
<id>231</id>
<name>Red dice wins</name>
<value>2.25</value>
<translation>Red dice wins</translation>
</odd>
</bet>
<bet>
<bet_id>3</bet_id>
<amount>100</amount>
<transaction_id>3</transaction_id>
<draw>
<code>123</code>
<time>2020-01-01 00:00:00</time>
</draw>
<game>
<id>10</id>
<name>Dice Duel</name>
<translation>Dice Duel</translation>
</game>
<odd>
<id>231</id>
<name>Red dice wins</name>
<value>2.25</value>
<translation>Red dice wins</translation>
</odd>
</bet>
</params>
</root>
1.0. Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_multi_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1577836800</time>
<params>
<balance_after>999700</balance_after>
<bet>
<transaction_id>246912</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
</bet>
<bet>
<transaction_id>246913</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
</bet>
<bet>
<transaction_id>246914</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
</bet>
</params>
<signature>92339383ecdbbd181880500686dbd932</signature>
</root>
2.0. Partial success is possible. Example response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_multi_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1577836800</time>
<params>
<balance_after>999700</balance_after>
<bet>
<transaction_id>246912</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
</bet>
<bet>
<transaction_id>246913</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
</bet>
<bet>
<transaction_id>246914</transaction_id>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient balance</error_text>
</bet>
</params>
<signature>34b65e7c2f22719689dd4f727974e62e</signature>
</root>
3.0. Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_multi_payin</method>
<token>c2696fe0-eba8-012f-596c-528c3f9e4820</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<time>1577836800</time>
<params>
<balance_after>999700</balance_after>
<bet>
<transaction_id>246912</transaction_id>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient balance</error_text>
</bet>
<bet>
<transaction_id>246913</transaction_id>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient balance</error_text>
</bet>
<bet>
<transaction_id>246914</transaction_id>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient balance</error_text>
</bet>
</params>
<signature>1ca007a86ffb3239f316d6b0d99350cb</signature>
</root>
|
Method transaction_bet_batch_payin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method allows to place multiple single bets with one request. Accept all or none. Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_batch_payin</method>
<token>yt3XMvbut2</token>
<time>1715688506</time>
<signature>8ba594bea4b04c4e5baff5e6480ccb16</signature>
<params>
<currency>eur</currency>
<is_mobile>0</is_mobile>
<bet>
<bet_id>9252642</bet_id>
<amount>50000</amount>
<transaction_id>29307071</transaction_id>
<draw>
<code>232405140723</code>
<time>2024-05-14 12:08:26</time>
</draw>
<game>
<id>1</id>
<name>Lucky 7</name>
<translation>7 iš 42</translation>
</game>
<odd>
<id>213</id>
<name>Selected ball will be dropped with No. 1,...,42 (1, 2, 3)</name>
<value>1.23</value>
<translation>Iškris pasirinktas kamuoliukas Nr.1,...,42 (1, 2, 3)</translation>
</odd>
</bet>
<bet>
<bet_id>9252643</bet_id>
<amount>50000</amount>
<transaction_id>29307072</transaction_id>
<draw>
<code>232405140724</code>
<time>2024-05-14 12:08:26</time>
</draw>
<game>
<id>1</id>
<name>Lucky 7</name>
<translation>7 iš 42</translation>
</game>
<odd>
<id>213</id>
<name>Selected ball will be dropped with No. 1,...,42 (1, 2, 3)</name>
<value>1.23</value>
<translation>Iškris pasirinktas kamuoliukas Nr.1,...,42 (1, 2, 3)</translation>
</odd>
</bet>
<bet>
<bet_id>9252644</bet_id>
<amount>50000</amount>
<transaction_id>29307073</transaction_id>
<draw>
<code>232405140725</code>
<time>2024-05-14 12:08:26</time>
</draw>
<game>
<id>1</id>
<name>Lucky 7</name>
<translation>7 iš 42</translation>
</game>
<odd>
<id>213</id>
<name>Selected ball will be dropped with No. 1,...,42 (1, 2, 3)</name>
<value>1.23</value>
<translation>Iškris pasirinktas kamuoliukas Nr.1,...,42 (1, 2, 3)</translation>
</odd>
</bet>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_batch_payin</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text></error_text>
<params>
<balance_after>725000</balance_after>
<already_processed>0</already_processed>
</params>
<time>1715688066</time>
<signature>b3a2795b9c3f25e14acff680735a7b0b</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_batch_payin</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient balance</error_text>
<time>1715688066</time>
<signature>9675688a7b46d063aeb046a4ed69b38b</signature>
</root>
|
Test token page
The next step after you implemented all API methods is testing procedure from Betgames.TV side.
To start testing procedure we need a simple page which outputs a newly generated token for some test player. You have to generate a token on each page load for logged in player and place it in that page. We need it for easier testing, so we could get new valid tokens by ourselves.
Note: please make sure a test player has some money in account.
Frequently asked questions
1. Does each API method should be accessible by separate url?
No, you have provide us single API url.
Good example: https://partner-domain.com/betgames_api
Bad example: https://partner-domain.com/betgames_api/ping, https://partner-domain.com/betgames_api/get_account_details, etc.;
2. Can we use our internal error codes/error texts?
Yes, you can use your internal error codes system. Only error code 404 is prohibited (being used by BetGames.TV in case of network connection problems) and error code's 700-799 are reserved for a specific cases. When Betgames server receives one of these error codes, specific error message will be shown inside of iFrame. Currently, following specific cases are registered:
- 701 - We apologize, but bets for this game provider are restricted for you, please contact support for more details.
- 702 - Your account requires identity validation.
- 703 - Insufficient balance.
- 704 - The game in the section is not available due to the active bonus. Details will be in your account.
- 705 - Bet stake can not contain cents in your currency.
3. How does Betgames.TV side behaves when our (Partner) server is unavailable?
Request is timed out when Betgames.TV server doesn't get response from Partner's server in 15 seconds.
Example:
- a player places a bet and Partner's server becomes unavailable (doesn't respond in 15 seconds)
- the player gets an error message 'Bet was not accepted'
- this bet is being marked as failed on Betgames.TV side
- Betgames.TV server waits 2 minutes (expecting Partner's server to become available) and sends transaction_bet_payout request for failed bet, so the player could receive bet amount back into his account
- Betgames.TV server repeats current procedure every minute while Partner's server becomes available