Web integration API 1.9
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>
<request_id>1ed343b9-ffe8-6596-ac6b-005056a4d105</request_id>
<time>1663166621</time>
<signature>554126be9a8467ae54545314eded5fdd27960022103a7bcd59661af784e539a7</signature>
<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/>
<params/>
<response_id>1ed343ba-00ab-630c-b916-005056a4d105</response_id>
<time>1663166621</time>
<signature>be1fac9d23fc17fcc8ed207db907d803bffd6a53a84832659aa6db29225d672b</signature>
</root>
Signature parameter
Signature is being calculated by generating HMAC-SHA256 of request_id/response_id and secret key. Secret key is being generated for each partner personally.
- request_id — UUID generated on Betgames side
- response_id — UUID generated on partners side. Each response should contain new UUID.
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>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<user_id>yt3XMvbut2</user_id>
<username>test_user_yt3XMvbut2</username>
<currency>eur</currency>
<info>Trashy info</info>
</params>
<response_id>1ed34bf1-ed8e-60f4-8a8d-005056a4d105</response_id>
<time>1663223097</time>
</root>
- Calculate HMAC-SHA256 with response_id "1ed343c3-266d-6280-9dba-005056a4d105" and your personal secret key, for example "1JD4U-S7XB6-GKITA-DQXHP".
- Singing the response:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<user_id>yt3XMvbut2</user_id>
<username>test_user_yt3XMvbut2</username>
<currency>eur</currency>
<info>Trashy info</info>
</params>
<response_id>1ed34bf1-ed8e-60f4-8a8d-005056a4d105</response_id>
<time>1663223097</time>
<signature>950e7e8472b369cce37ed77f17cf7d7f31eb2bb58ac8a3409467238ead89180a</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>
<request_id>1ed34bf5-4b69-663a-adda-005056a4d105</request_id>
<time>1663223188</time>
<signature>c1585f9e7444ae9dde2505c662df59d45790310f533479ea882eec66bdc5b806</signature>
<params/>
</root>
- Calculate HMAC-SHA256 hmac with request_id "1ed34bf5-4b69-663a-adda-005056a4d105" and your personal secret key "1JD4U-S7XB6-GKITA-DQXHP".
- This HMAC-SHA256 hmac 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;
- request_id — UUID generated on Betgames side
- params — packet for method additional params;
Example:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>yt3XMvbut2</token>
<request_id>1ed34c05-9447-68ba-bfc7-005056a4d105</request_id>
<time>1663223625</time>
<signature>29e370ff338c9e8588163f1a5f17ba952d4020e7be5b365158a1d0801d84ec6a</signature>
<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;
- response_id — UUID generated on partners side. Each response should contain new UUID.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<user_id>yt3XMvbut2</user_id>
<username>test_user_yt3XMvbut2</username>
<currency>eur</currency>
<info>Trashy info</info>
</params>
<response_id>1ed34c05-94af-6046-9253-005056a4d105</response_id>
<time>1663223625</time>
<signature>6041ccaf0f1ca417faebe234e428164c00d970c2e2880ea7152fa23018c31170</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, if promotions are integrated, additionally bet_id can have promo_transaction_id. It could be described as one row in DB table, for example: (bet_id, transaction_payin_id, transaction_payout_id, transaction_promo_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 success response or error_code 700 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>
<request_id>1ed34c78-205b-6f78-ae90-005056a4d105</request_id>
<time>1663226700</time>
<signature>216b9d98c9d24b3d02937fdbc887baf29803ff4a44f6619b03ef137d1caa77d7</signature>
<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/>
<params/>
<response_id>1ed34c78-20d0-6ee0-bb33-005056a4d105</response_id>
<time>1663226700</time>
<signature>1025669422b33fe62231abe3fe8cc30824ab6ca63035c7a2520842f3e6cba670</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>ping</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>1</error_code>
<error_text>wrong_signature</error_text>
<response_id>1ed34c8d-9401-65f8-904c-005056a4d105</response_id>
<time>1663227276</time>
<signature>e2dd00326d30c366312efac013a5656ff71c099962252fcd7ad3a522f0fca66e</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>yt3XMvbut2</token>
<request_id>1ed34cbb-5000-6ce0-9cf0-005056a4d105</request_id>
<time>1663228503</time>
<signature>11a56f4e2d752c610e0d0d22ec0e1cad7945b5fd406210984bf727bee1f71015</signature>
<params/>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<user_id>yt3XMvbut2</user_id>
<username>test_user_yt3XMvbut2</username>
<currency>eur</currency>
<info>Trashy info</info>
</params>
<response_id>1ed34cbb-5071-6670-bade-005056a4d105</response_id>
<time>1663228503</time>
<signature>8320ffb4cff75f56e460163eced95b3b54bd8c4789a6a5d752ba665d792963d6</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_account_details</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid token</error_text>
<response_id>1ed34cc7-a507-614c-b555-005056a4d105</response_id>
<time>1663228503</time>
<signature>833452ee788ddd62ca8a88c15b00570cc0edab184c00abcbd05b4cddd1c49bed</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>yt3XMvbut2</token>
<request_id>1ed34cda-8830-61d2-af9f-005056a4d105</request_id>
<time>1663229341</time>
<signature>e655d95f47412d258d10ca8ddcbccb02da172d35dd44a5e0ab6e146d86b979b1</signature>
<params/>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>refresh_token</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params/>
<response_id>1ed34cda-8894-6a60-b195-005056a4d105</response_id>
<time>1663229341</time>
<signature>957ecc5bde161e12d887c0b368292add06cb1ebb875b156f652a074df074a5b3</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>refresh_token</method>
<token>sdf</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid_token</error_text>
<response_id>1ed34cdf-799d-678c-a1d3-005056a4d105</response_id>
<time>1663229474</time>
<signature>da82d59c55d54d1f769faa484cfd706d7131897b94811c55d1f6446eb3042627</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>yt3XMvbut2</token>
<request_id>1ed34cf3-6c39-66fe-9603-005056a4d105</request_id>
<time>1663230010</time>
<signature>f2e9bb41be09add05bba1739e0077fcb7010cdda5d28d0e58380b9cf169319bd</signature>
<params/>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>request_new_token</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<new_token>yt3XMvbut2</new_token>
</params>
<response_id>1ed34cf3-6cc4-6290-9ddc-005056a4d105</response_id>
<time>1663230010</time>
<signature>e08f45cb4ca3186f50b83dbebcc93bdd9f6758c53dcfa5dc3327af20fbbb02e0</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>request_new_token</method>
<token>dsgsdg</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid_token</error_text>
<response_id>1ed34cf7-e79d-6be8-a200-005056a4d105</response_id>
<time>1663230130</time>
<signature>687562d1dc272096a74ad804813abb4beb50c000632061c838c7b7c578dec238</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>yt3XMvbut2</token>
<request_id>1ed34d03-d5de-6efa-b361-005056a4d105</request_id>
<time>1663230450</time>
<signature>b40827f8a581c7cab3a0361599855b6e3ec7496b119f76a19b6e7dd259b7d02b</signature>
<params/>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_balance</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance>1006162</balance>
</params>
<response_id>1ed34d03-d64d-6364-96b6-005056a4d105</response_id>
<time>1663230450</time>
<signature>95f006f31df3addfab4ef3d3d93e2738e2857dfe55d0d3488821d4f42f1dc70f</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>get_balance</method>
<token>sdgsdgsdg</token>
<success>0</success>
<error_code>3</error_code>
<error_text>invalid_token</error_text>
<response_id>1ed34d0a-9c43-6ef0-aa9a-005056a4d105</response_id>
<time>1663230632</time>
<signature>063c0be91627ed01c0cc3a096ef9c83f319294cbaadbbc0118ded408be6d4d40</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.
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payin</method>
<token>GNskUmayR7</token>
<request_id>1ed53945-7b4d-6826-8df8-005056a4d105</request_id>
<time>1666613211</time>
<signature>3503c327dc53f5c74ac4e1c0440706c080f333fafa96ea922a73b6f52295c92d</signature>
<params>
<amount>1311</amount>
<currency>usd</currency>
<bet_id>32339139249</bet_id>
<transaction_id>49716719523</transaction_id>
<retrying>0</retrying>
<bet>Selected ball will be dropped with No. 1,...,42 (1, 2, 3)</bet>
<odd>1.23</odd>
<bet_time>2022-10-24 12:06:51</bet_time>
<game>1</game>
<draw_code>71304050073</draw_code>
<draw_time>2022-10-24 12:06:51</draw_time>
<draw>
<match>
<name>Monster Vito vs QuestionMan</name>
<code>a211512fa3</code>
<time>2022-08-22 08:42:00</time>
</match>
<tournament>
<name>10/08 Brno</name>
<code>f46b7e51ae</code>
<time>2022-08-22 08:42:00</time>
</tournament>
<otwmhvcaufihyaasawcatd3f>random field</otwmhvcaufihyaasawcatd3f>
</draw>
<odd_extra>
<betting_option>Match winner</betting_option>
<participant>Player1</participant>
<score>2.5</score>
<count>5</count>
<odd_even>odd</odd_even>
<under_over>under</under_over>
<point_values>1,2</point_values>
</odd_extra>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payin</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>0</balance_after>
<already_processed>0</already_processed>
</params>
<response_id>1ed34d0f-9183-61e6-b99d-005056a4d105</response_id>
<time>1663230765</time>
<signature>f50c48f664d352baed8cda607d1c6699ffe1938ef118feaddd4a17a05848875f</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payin</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient_balance</error_text>
<response_id>1ed34d17-36f7-6c7e-9fc3-005056a4d105</response_id>
<time>1663230970</time>
<signature>488df25d2816ab2cf515e527e72e828bbf26381ca6c84ada6b4803b94dc89a9c</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>yt3XMvbut2</token>
<request_id>1ed34d6d-e9ec-6248-8940-005056a4d105</request_id>
<time>1663233298</time>
<signature>138debfb67b213f8a9342d455134889cebee577c948de2b5fdcd4cea3cce2aa4</signature>
<params>
<amount>1500</amount>
<currency>eur</currency>
<subscription_id>88707571528</subscription_id>
<subscription_time>2022-09-15 09:14:58</subscription_time>
<odd>
<name>Selected ball will be dropped with No. 1,...,42 (1, 2, 3)</name>
<value>1.9</value>
<translation>Iškris pasirinktas kamuoliukas Nr.1,...,42 (1, 2, 3)</translation>
</odd>
<is_mobile>0</is_mobile>
<game>
<id>1</id>
<name>Lucky 7</name>
<translation>7 iš 42</translation>
</game>
<bet>
<bet_id>88707581360361429</bet_id>
<transaction_id>88707543060860670</transaction_id>
<amount>500</amount>
<draw>
<code>72009040243</code>
<time>2022-09-15 09:14:58</time>
</draw>
</bet>
<bet>
<bet_id>88707581360361430</bet_id>
<transaction_id>88707543060860671</transaction_id>
<amount>500</amount>
<draw>
<code>72009040244</code>
<time>2022-09-15 09:14:58</time>
</draw>
</bet>
<bet>
<bet_id>88707581360361431</bet_id>
<transaction_id>88707543060860672</transaction_id>
<amount>500</amount>
<draw>
<code>72009040245</code>
<time>2022-09-15 09:14:58</time>
</draw>
</bet>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_subscription_payin</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>1010624</balance_after>
<already_processed>0</already_processed>
</params>
<response_id>1ed34d6d-ea52-650c-bedc-005056a4d105</response_id>
<time>1663233298</time>
<signature>c33787ca0b58ab0a0b379cb776cd30d832a1e25d0a623c9aae0c4846d2f64f2d</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_subscription_payin</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient_balance</error_text>
<response_id>1ed34d17-36f7-6c7e-9fc3-005056a4d105</response_id>
<time>1663230970</time>
<signature>488df25d2816ab2cf515e527e72e828bbf26381ca6c84ada6b4803b94dc89a9c</signature>
</root>
|
Method transaction_bet_payout | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method for money deposits to Partners player account – paying out the winnings.
Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payout</method>
<token>yt3XMvbut2</token>
<request_id>1ed34d6d-ee26-6dd6-96cb-005056a4d105</request_id>
<time>1663233298</time>
<signature>d5600e9814adec0fa6bf71800283271b992b70117b9c4ee2322b7f7fd669bd49</signature>
<params>
<player_id>yt3XMvbut2</player_id>
<amount>950</amount>
<currency>eur</currency>
<bet_id>88707581360361431</bet_id>
<transaction_id>88707543060860675</transaction_id>
<retrying>0</retrying>
<bet_type>won</bet_type>
<game_id>1</game_id>
<bet_option>
<name>ball</name>
<value>1</value>
<round/>
</bet_option>
<bet_option>
<name>ball</name>
<value>3</value>
<round/>
</bet_option>
<final_odd>1.23</final_odd>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payout</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>1013474</balance_after>
<already_processed>0</already_processed>
</params>
<response_id>1ed34d6d-ee86-6a2e-bdde-005056a4d105</response_id>
<time>1663233298</time>
<signature>3967042bc1aff0dcee21f93fc9e272d750632709396d7c5db157bb2b93fa3646</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_payout</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>700</error_code>
<error_text>there is no PAYIN with provided bet_id</error_text>
<response_id>1ed34d7e-2764-6eee-9f18-005056a4d105</response_id>
<time>1663233734</time>
<signature>058be9cdd5cd1189211ba0cda2a39a4f4d965e12dd6371417edab261a216df7b</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>GNskUmayR7</token>
<request_id>1ed5394a-a071-6422-8ea3-005056a4d105</request_id>
<time>1666613349</time>
<signature>5d5b6c8bb3e1024af4d92979c232ae7ea0f82941edbd253f2dba3d8c98ee4a5f</signature>
<params>
<amount>777</amount>
<odd_value>5.66</odd_value>
<currency>usd</currency>
<combination_id>82273506638</combination_id>
<combination_time>2022-10-24 12:09:09</combination_time>
<is_mobile>0</is_mobile>
<bet>
<bet_id>822735066381</bet_id>
<transaction_id>822735066383</transaction_id>
<draw>
<code>72009040243</code>
<time>2022-10-24 12:09:09</time>
<match>
<name>Monster Vito vs QuestionMan</name>
<code>a211512fa3</code>
<time>2022-08-22 08:42:00</time>
</match>
<tournament>
<name>10/08 Brno</name>
<code>f46b7e51ae</code>
<time>2022-08-22 08:42:00</time>
</tournament>
<yocudhtcwwfahaamt3ifsaav>random field</yocudhtcwwfahaamt3ifsaav>
</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>
<betting_option>Match winner</betting_option>
<participant>Player1</participant>
<score>2.5</score>
<count>5</count>
<odd_even>odd</odd_even>
<under_over>under</under_over>
<point_values>1,2</point_values>
</odd>
</bet>
<bet>
<bet_id>822735066382</bet_id>
<transaction_id>822735066384</transaction_id>
<draw>
<code>12009040485</code>
<time>2022-10-24 12:09:09</time>
<match>
<name>Monster Vito vs QuestionMan</name>
<code>a211512fa3</code>
<time>2022-08-22 08:42:00</time>
</match>
<tournament>
<name>10/08 Brno</name>
<code>f46b7e51ae</code>
<time>2022-08-22 08:42:00</time>
</tournament>
<htoufchitvawaw3ayfadmacs>random field</htoufchitvawaw3ayfadmacs>
</draw>
<game>
<id>7</id>
<name>Wheel of Fortune</name>
<translation>Laimės ratas</translation>
</game>
<odd>
<id>518</id>
<name>Wheel clapper will stop at the SELECTED NUMBER (1 ... 18) (1, 2, 3)</name>
<value>1.23</value>
<translation>Bus išsuktas laukas su pasirinktu skaičiumi (1....18) (1, 2, 3)</translation>
<betting_option>Match winner</betting_option>
<participant>Player1</participant>
<score>2.5</score>
<count>5</count>
<odd_even>odd</odd_even>
<under_over>under</under_over>
<point_values>1,2</point_values>
</odd>
</bet>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payin</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>1021578</balance_after>
<already_processed>0</already_processed>
</params>
<response_id>1ed34da0-f1ea-63e0-bcec-005056a4d105</response_id>
<time>1663234667</time>
<signature>981a5862a33f0f2e9e747fc832c3906b653172da1ae0eb9968efb6f7d5d74f75</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payin</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient_balance</error_text>
<response_id>1ed34d17-36f7-6c7e-9fc3-005056a4d105</response_id>
<time>1663230970</time>
<signature>488df25d2816ab2cf515e527e72e828bbf26381ca6c84ada6b4803b94dc89a9c</signature>
</root>
|
Method transaction_bet_combination_payout | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: Method for money deposits to Partners player account – paying out the winnings.
Flowchart diagram:
Request example: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payout</method>
<token>yt3XMvbut2</token>
<request_id>1ed34dae-f03d-67e6-801d-005056a4c345</request_id>
<time>1663235043</time>
<signature>f1b60fbf83e296339a0dbd2a7dc278d68f8a9c3289355cde8501d2cdee546214</signature>
<params>
<player_id>yt3XMvbut2</player_id>
<amount>0</amount>
<type>LOST</type>
<currency>eur</currency>
<combination_id>6234</combination_id>
<bet>
<bet_id>450</bet_id>
<game_id>19</game_id>
<transaction_id>18000609</transaction_id>
<type>LOST</type>
<bet_option>
<name>participant</name>
<value>The Rock</value>
<round/>
</bet_option>
<final_odd>0</final_odd>
</bet>
<bet>
<bet_id>451</bet_id>
<game_id>19</game_id>
<transaction_id>18000609</transaction_id>
<type>LOST</type>
<bet_option>
<name>participant</name>
<value>Just Sin</value>
<round/>
</bet_option>
<final_odd>0</final_odd>
</bet>
<final_odd>0</final_odd>
</params>
</root>
Example of successful response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payout</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>1020578</balance_after>
<already_processed>0</already_processed>
</params>
<response_id>1ed34dae-f0e1-6850-be4a-005056a4d105</response_id>
<time>1663235043</time>
<signature>41fa09c46b9c6ae8fdeb2d475035fba26349adc9d2ba51e0e032e8438f1c3961</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_combination_payout</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>700</error_code>
<error_text>there is no PAYIN with provided bet_id</error_text>
<response_id>1ed34d7e-2764-6eee-9f18-005056a4d105</response_id>
<time>1663233734</time>
<signature>058be9cdd5cd1189211ba0cda2a39a4f4d965e12dd6371417edab261a216df7b</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>yt3XMvbut2</token>
<request_id>1ed34f17-ccf7-6592-8fc3-005056a4d105</request_id>
<time>1663244730</time>
<signature>0562fc21325570a16196210201bfaf2f1c5706fd92e2cd96c464620ffb4ab2c9</signature>
<params>
<player_id>yt3XMvbut2</player_id>
<currency>eur</currency>
<amount>100</amount>
<promo_transaction_id>50551766198</promo_transaction_id>
<bet_id>84606577110</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>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>1019308</balance_after>
<already_processed>0</already_processed>
</params>
<response_id>1ed34f17-d762-6b3a-8d06-005056a4d105</response_id>
<time>1663244731</time>
<signature>8a2de792bb54b8d21a243ce3d1e8ed8e65d7a16b63059fe9b696f14322b2dd3b</signature>
</root>
Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_promo_payout</method>
<token>yt3XMvbut2</token>
<success>0</success>
<error_code>700</error_code>
<error_text>bet_not_found</error_text>
<response_id>1ed34f17-cd73-69d0-b040-005056a4d105</response_id>
<time>1663244730</time>
<signature>6680999d0a8d38f4b53ec639c4a11e571c71ef1d0509760eb470c93afe9b2dc4</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>GNskUmayR7</token>
<request_id>1ed5394c-582c-62e6-91c6-005056a4d105</request_id>
<time>1666613395</time>
<signature>479d92ff468586637870f43c366ec6a30bb042e0f35efcda351adb5e854780c0</signature>
<params>
<currency>usd</currency>
<is_mobile>0</is_mobile>
<bet>
<bet_id>65710059267</bet_id>
<amount>281</amount>
<transaction_id>62278639526</transaction_id>
<draw>
<code>10428948562</code>
<time>2022-10-24 12:09:55</time>
<match>
<name>Monster Vito vs QuestionMan</name>
<code>a211512fa3</code>
<time>2022-08-22 08:42:00</time>
</match>
<tournament>
<name>10/08 Brno</name>
<code>f46b7e51ae</code>
<time>2022-08-22 08:42:00</time>
</tournament>
<wavctcafhuhoi3yaadftawsm>random field</wavctcafhuhoi3yaadftawsm>
</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>
<betting_option>Match winner</betting_option>
<participant>Player1</participant>
<score>2.5</score>
<count>5</count>
<odd_even>odd</odd_even>
<under_over>under</under_over>
<point_values>1,2</point_values>
</odd>
</bet>
<bet>
<bet_id>62698450893</bet_id>
<amount>113</amount>
<transaction_id>96176048010</transaction_id>
<draw>
<code>32270052748</code>
<time>2022-10-24 12:09:55</time>
<match>
<name>Monster Vito vs QuestionMan</name>
<code>a211512fa3</code>
<time>2022-08-22 08:42:00</time>
</match>
<tournament>
<name>10/08 Brno</name>
<code>f46b7e51ae</code>
<time>2022-08-22 08:42:00</time>
</tournament>
<twaoafhhuvwf3aaascicdtmy>random field</twaoafhhuvwf3aaascicdtmy>
</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>
<betting_option>Match winner</betting_option>
<participant>Player1</participant>
<score>2.5</score>
<count>5</count>
<odd_even>odd</odd_even>
<under_over>under</under_over>
<point_values>1,2</point_values>
</odd>
</bet>
<bet>
<bet_id>49403844453</bet_id>
<amount>228</amount>
<transaction_id>84626018952</transaction_id>
<draw>
<code>31170482402</code>
<time>2022-10-24 12:09:55</time>
<match>
<name>Monster Vito vs QuestionMan</name>
<code>a211512fa3</code>
<time>2022-08-22 08:42:00</time>
</match>
<tournament>
<name>10/08 Brno</name>
<code>f46b7e51ae</code>
<time>2022-08-22 08:42:00</time>
</tournament>
<aaitvocyhwafwmfstdhaua3c>random field</aaitvocyhwafwmfstdhaua3c>
</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>
<betting_option>Match winner</betting_option>
<participant>Player1</participant>
<score>2.5</score>
<count>5</count>
<odd_even>odd</odd_even>
<under_over>under</under_over>
<point_values>1,2</point_values>
</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>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>1019208</balance_after>
<bet>
<transaction_id>33310033226</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text/>
</bet>
<bet>
<transaction_id>56270005115</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text/>
</bet>
<bet>
<transaction_id>40984703550</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text/>
</bet>
</params>
<response_id>1ed34f23-0eaf-62ea-8d52-005056a4d105</response_id>
<time>1663245032</time>
<signature>25bd2957410442212c58426a62048c9b791f2efb41176c4624ffaf7d3206e705</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>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>1019208</balance_after>
<bet>
<transaction_id>33310033226</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text/>
</bet>
<bet>
<transaction_id>56270005115</transaction_id>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient_balance</error_text>
</bet>
<bet>
<transaction_id>40984703550</transaction_id>
<success>1</success>
<error_code>0</error_code>
<error_text/>
</bet>
</params>
<response_id>1ed34f23-0eaf-62ea-8d52-005056a4d105</response_id>
<time>1663245032</time>
<signature>25bd2957410442212c58426a62048c9b791f2efb41176c4624ffaf7d3206e705</signature>
</root>
3.0. Example of error response: <?xml version="1.0" encoding="UTF-8"?>
<root>
<method>transaction_bet_multi_payin</method>
<token>yt3XMvbut2</token>
<success>1</success>
<error_code>0</error_code>
<error_text/>
<params>
<balance_after>1019208</balance_after>
<bet>
<transaction_id>33310033226</transaction_id>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient_balance</error_text>
</bet>
<bet>
<transaction_id>56270005115</transaction_id>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient_balance</error_text>
</bet>
<bet>
<transaction_id>40984703550</transaction_id>
<success>0</success>
<error_code>703</error_code>
<error_text>insufficient_balance</error_text>
</bet>
</params>
<response_id>1ed34f23-0eaf-62ea-8d52-005056a4d105</response_id>
<time>1663245032</time>
<signature>25bd2957410442212c58426a62048c9b791f2efb41176c4624ffaf7d3206e705</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>
<request_id>1ef11e24-46ec-60c0-8c59-005056a4d105</request_id>
<time>1715684898</time>
<signature>f713d87a670cbd756d6996e5c100d0fcd2ff033a3e3f6f2556e94fa9593d9c4f</signature>
<params>
<currency>eur</currency>
<is_mobile>0</is_mobile>
<bet>
<bet_id>9252132</bet_id>
<amount>50000</amount>
<transaction_id>29305730</transaction_id>
<draw>
<code>232405140670</code>
<time>2024-05-14 11:09:00</time>
</draw>
<game>
<id>26</id>
<name>Instant Lucky 7</name>
<translation>Instant Lucky 7</translation>
</game>
<odd>
<id>979</id>
<name>Pick 3 (18, 35, 42)</name>
<value>25</value>
<translation>Pick 3 (18, 35, 42)</translation>
</odd>
</bet>
<bet>
<bet_id>9252133</bet_id>
<amount>50000</amount>
<transaction_id>29305731</transaction_id>
<draw>
<code>232405140670</code>
<time>2024-05-14 11:09:00</time>
</draw>
<game>
<id>26</id>
<name>Instant Lucky 7</name>
<translation>Instant Lucky 7</translation>
</game>
<odd>
<id>979</id>
<name>Pick 3 (5, 7, 11)</name>
<value>25</value>
<translation>Pick 3 (5, 7, 11)</translation>
</odd>
</bet>
<bet>
<bet_id>9252134</bet_id>
<amount>50000</amount>
<transaction_id>29305732</transaction_id>
<draw>
<code>232405140670</code>
<time>2024-05-14 11:09:00</time>
</draw>
<game>
<id>26</id>
<name>Instant Lucky 7</name>
<translation>Instant Lucky 7</translation>
</game>
<odd>
<id>979</id>
<name>Pick 3 (14, 28, 38)</name>
<value>25</value>
<translation>Pick 3 (14, 28, 38)</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/>
<params>
<balance_after>850000</balance_after>
<already_processed>0</already_processed>
</params>
<response_id>1ef11e24-4840-6d04-b3d3-005056a4d105</response_id>
<time>1715684898</time>
<signature>5d5cf59010e0a86baf66a3fe776da7235d1d704be837fee9ae31811d1ecee5f9</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>
<response_id>1ef11e24-4840-6d04-b3d3-005056a4d105</response_id>
<time>1715684898</time>
<signature>5d5cf59010e0a86baf66a3fe776da7235d1d704be837fee9ae31811d1ecee5f9</signature>
</root>
|
API request timeouts
Request timeout is set to 15 seconds for all BetGames, TwainSport and ShowGames games. With the following exceptions due to the fast dynamics of the games:
- Speedy 7 payin timeout is 5 seconds
- Skyward payin/payout timeout is 2 seconds
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