Web integration API 1.9

From BetgamesTV
Jump to navigation Jump to search

BetGames.TV Partner API

API process flow.png

API process flow.

Game communication processes:

  1. Iframe game client sends requests to BetGames.TV server;
  2. 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:

  1. Implementation of Partner API in Partner testing environment;
  2. Passing all the test procedures with BetGames.TV engineer (note: before testing procedures please provide a test token page);
  3. 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");
  4. 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:

  1. Contain both letters and digits;
  2. Be minimum 10 symbols and maximum 100 symbols lenght;
  3. Be unique for each player;
  4. 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>
  1. Calculate HMAC-SHA256 with response_id "1ed343c3-266d-6280-9dba-005056a4d105" and your personal secret key, for example "1JD4U-S7XB6-GKITA-DQXHP".
  2. 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>
  1. Calculate HMAC-SHA256 hmac with request_id "1ed34bf5-4b69-663a-adda-005056a4d105" and your personal secret key "1JD4U-S7XB6-GKITA-DQXHP".
  2. 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:

  • 5 times every 5 seconds
  • 5 times every minute
  • 5 times every 2 minutes
  • 5 times every 5 minutes
  • 5 times every 10 minutes
  • every hour (until we cancel the payout or partner fixes issue on their side)
  • API Methods

    Method ping

    Description: Method is being used for detecting API service availability status.

    Flowchart diagram:

    Ping new2.png

     


     

    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>
    
    • Signature calculation string:
      1ed34c78-205b-6f78-ae90-005056a4d105
    • Secret key:
      1JD4U-S7XB6-GKITA-DQXHP
    • Result after HMAC-SHA256 calculation:
      216b9d98c9d24b3d02937fdbc887baf29803ff4a44f6619b03ef137d1caa77d7

     


     

    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>
    
    • Signature calculation string:
      1ed34c78-20d0-6ee0-bb33-005056a4d105
    • Secret key:
      1JD4U-S7XB6-GKITA-DQXHP
    • Result after HMAC-SHA256 calculation:
      1025669422b33fe62231abe3fe8cc30824ab6ca63035c7a2520842f3e6cba670

     


     

    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>
    
    • Signature calculation string:
      1ed34c8d-9401-65f8-904c-005056a4d105
    • Secret key:
      1JD4U-S7XB6-GKITA-DQXHP
    • Result after HMAC-SHA256 calculation:
      e2dd00326d30c366312efac013a5656ff71c099962252fcd7ad3a522f0fca66e

    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:

    Get account details new.png

     


     

    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>ab9438245acb353c733f0c1c932e1ae5d4f5084549efd86c6c5a7e33058ea34b</signature>
      <params/>
    </root>
    
    • Signature calculation string:
      1ed34cbb-5000-6ce0-9cf0-005056a4d105
    • Secret key:
      1JD4U-S7XB6-GKITA-DQXHP
    • Result after HMAC-SHA256 calculation:
      ab9438245acb353c733f0c1c932e1ae5d4f5084549efd86c6c5a7e33058ea34b

     


     

    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>
    
    • Signature calculation string:
      1ed34cbb-5071-6670-bade-005056a4d105
    • Secret key:
      1JD4U-S7XB6-GKITA-DQXHP
    • Result after HMAC-SHA256 calculation:
      8320ffb4cff75f56e460163eced95b3b54bd8c4789a6a5d752ba665d792963d6

     

    Required Response Child-Elements for <params>
    Field Type Description
    user_id varchar User_id created at partner side.
    username varchar Username at partner side.
    Important: this field is optional and can have value "-".
    currency varchar Please specify the list of the available currencies from ISO 4217 currency list.
    info varchar Additional information about the user.
    Important: this field is optional and can have value "-".

     


     

    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>
    
    • Signature calculation string:
      1ed34cc7-a507-614c-b555-005056a4d105
    • Secret key:
      1JD4U-S7XB6-GKITA-DQXHP
    • Result after HMAC-SHA256 calculation:
      833452ee788ddd62ca8a88c15b00570cc0edab184c00abcbd05b4cddd1c49bed

    Method refresh_token

    Description: Method validates the token. This method is being called when the player is idle.

    Flowchart diagram:

    Refresh token new.png

     


     

    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 creates and returns new valid token, in the same time old token becomes invalid.

    Description: Method returns valid token. If current token is live, you have to refresh and return it.

    Flowchart diagram:

    Request new token new.png

     


     

    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>
    

     

    Required Response Child-Elements for <params>
    Field Type Description
    new_token varchar You have to refresh current token lifetime and return it as new_token.

     


     

    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:

    Get balance new.png

     


     

    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>
    

     

    Required Response Child-Elements for <params>
    Field Type Description
    balance int Current player balance.
    Important: amount must be in cents.

     


     

    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.

    • We will not call get_balance (to check if player has enough funds to place a bet) before transaction_bet_payin for Speedy 7 game, so you need to ensure the balance checking is done properly on your side. In case the player does not have enough funds/balance you should return error response with error code 703 and a proper message "Insufficient balance" shall be displayed.
    • IMPORTANT! API requests for some features and games are sent parallel/asynchronously. Make sure your API handles asynchronous API requests well and won't accept pay-in if the player doesn't have enough balance.


    Flowchart diagram:

    Payin.drawio.png

     


     

    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>
    

     

    Required Request Child-Elements for <params>
    Field Type Description
    amount int Amount to withdraw from account.
    Important: amount is in cents.
    currency varchar Currency code from the ISO 4217 currency list.
    bet_id bigint unsigned Unique bet id on BetGames.TV server.
    transaction_id bigint unsigned Unique transaction id on BetGames.TV server. Partner is obliged to store processed transaction ids. If the request contains the same transaction id, Partner should return success status, but do not withdraw money from the balance again.
    retrying int Informational parameter. If it is equal 1, it means BetGames.TV server tries to resend request. For example, because of the network connection problems.

     

    Optional Request Child-Elements for <params> (enabled by default, could be disabled by Partner request)
    Field Type Description
    bet varchar Bet name on default Partner's language, encoding - UTF-8.
    odd decimal Outcome value.
    bet_time datetime Time when the bet has been placed. Timezone - UTC+0.
    game int or varchar By default is returned as Game ID (integer value). Can be returned as game name on default Partner's language (encoding - UTF-8) by Partner request.
    draw_code varchar Draw code number.
    draw_time datetime Scheduled start time of the draw. Timezone - UTC+0.
    bet / draw / match / name varchar Match name
    bet / draw / match / code varchar Match name
    bet / draw / match / time datetime Scheduled start time of the match. Timezone - UTC+0.
    bet / draw / tournament / name varchar Tournament name
    bet / draw / tournament / code varchar Tournament code
    bet / draw / tournament / time datetime Scheduled start time of the tournament. Timezone - UTC+0.
    odd_extra / betting_option varchar betting option
    odd_extra / participant varchar nickname of participant
    odd_extra / score decimal Score value which was selected.
    odd_extra / count int count for first generated values, for example "Total of first (COUNT) generated values - ODD/EVEN"
    odd_extra / odd_even varchar Option which was selected odd/even
    odd_extra / under_over varchar Option which was selected under/over
    odd_extra / point_values varchar Used for most RNG generated value betting options
    is_mobile int Parameter to distinguish platform ("1"-mobile). This parameter appears in transaction_bet_payin requests only when you push it into iFrame JavaScript launch code.
    Note: this parameter isn't being used for desktop platform.

     


     

    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>
    

     

    Required Response Child-Elements for <params>
    Field Type Description
    balance_after int Player balance after the transaction.
    Important: amount must be in cents.
    already_processed int Equals 1 if the transaction was already processed.

     

    Optional Response Child-Elements for <params>
    Field Type Description
    AAMS code varchar Key for each bet on the Bet History page and Recent Bets block.

     


     

    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:

    • In case of transaction_bet_payin player is able to make only single bet.
    • In case of transaction_bet_subscription_payin player is able to make several bets per 1 payin.
    • IMPORTANT! API requests for some features and games are sent parallel/asynchronously. Make sure your API handles asynchronous API requests well and won't accept pay-in if the player doesn't have enough balance.

    Flowchart diagram:

    Transaction bet subscription payin.png

     


     

    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>
    

     

    Required Request Child-Elements for <params>
    Field Type Description
    amount int Total subscription amount to withdraw from account.
    Important: amount is in cents.
    currency varchar Currency code from the ISO 4217 currency list.
    subscription_id bigint unsigned Unique subscription id on BetGames.TV server.
    subscription_time string Subsciption creation time, UTC.
    odd / name string Outcome name in English.
    odd / value float Outcome value.
    odd / translation string Outcome name in player's language.
    is_mobile bool-int Parameter to distinguish platform ("1"-mobile). This parameter appears in transaction_bet_payin requests only when you push it into iFrame JavaScript launch code.
    Note: this parameter isn't being used for desktop platform.
    game / id int or varchar Game ID in Betgames system - List of game ID's.
    game / name string Game name in English.
    game / translation string Game name in player's language.
    bet / bet_id bigint unsigned Unique bet id on BetGames.TV server.
    bet / transaction_id bigint unsigned Unique transaction id on BetGames.TV server. Partner is obliged to store processed transaction ids. If the request contains the same transaction id, Partner should return success status, but do not withdraw money from the balance again.
    bet / amount int Amount of the exact bet to withdraw from account.
    Important: amount is in cents.
    bet / draw / code string Draw code number.
    bet / draw / time string Draw start time, UTC.

     


     

    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>
    

     

    Required Response Child-Elements for <params>
    Field Type Description
    balance_after int Player balance after the transaction.
    Important: amount must be in cents.
    already_processed int Equals 1 if the transaction was already processed.

     


     

    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.
    Important notes:

    • Transaction payout should return error with code 700, in case there were no payin with same bet_id before. This transaction should not affect the players balance.
    • Transaction payout should return success but do not change players balance, in case there were already payout been made with same bet_id, but different transaction_id.
    • If transaction_bet_payout method has validation that a payout amount must be equal to payin amount * odd value, then this validation for Speedy 7 game payout should not be used. It's because of the game logic - the odd value/coefficient might be different in payin and payout requests.

    Flowchart diagram:

    Transaction bet payout new2.png

     


     

    • Some betting options, can have additional selections, like number, sector, dice and etc. For each selection new <bet_option> </bet_option> element will be added. Up to 7 <bet_option> elements can be included in the request.

    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>
    
    Required Request Child-Elements for <params>
    Field Type Description
    token varchar Betgames system sends last valid player token, but it's not used for user identification in money deposit. Instead of it Betgames system uses player_id field.
    Read more Token System
    player_id varchar Player external code provided by partner in get_account_details method. This method uses player_id for player identification.
    amount int Amount to deposit to account.
    Important: 1) amount is in cents. 2) amount is 0 for lost bet.
    currency varchar Currency code from the ISO 4217 code list.
    bet_id bigint unsigned Unique bet id on BetGames.TV server.
    transaction_id bigint unsigned Unique transaction id on BetGames.TV server. Partner is obliged to store processed transaction ids. If the request contains the same transaction id, Partner should return success status, but do not deposit money to the balance again.
    retrying int Informational parameter. If it is equal 1, it means BetGames.TV server tries to resend request. For example, because of the network connection problems.
    bet_type const Can be 'lost' / 'won' / 'return' / 'tie'.
    game_id int Game ID in Betgames system - List of game ID's.
    bet_option / name string Selection name, can be 'ball' / 'sector' / 'dice' / 'choice'.
    bet_option / value string Selection value
    bet_option / round int / null Only used for game "Speedy 7", to determine a round in which bet was placed.
    final_odd decimal Shows final odd value by which - bet was really calculated.

     


     

    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>
    

     

    Required Response Child-Elements for <params>
    Field Type Description
    balance_after int Player balance after the transaction.
    Important: amount must be in cents.
    already_processed int Equals 1 if the transaction was already processed.

     


     

    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.
    Note: currently only two combo bets can be placed inside transaction_bet_combination_payin.

    Flowchart diagram:

    Combo payin.png

     


     

    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>
    


     

    Required Request Child-Elements for <params>
    Field Type Description
    amount int Total combination amount to withdraw from account.
    Important: amount is in cents.
    odd_value float Multiplied combination odd value.
    currency varchar Currency code from the ISO 4217 currency list.
    combination_id bigint unsigned Unique combination id on BetGames.TV server.
    combination_time string Combination creation time, UTC.
    is_mobile bool-int Parameter to distinguish platform ("1"-mobile). This parameter appears in transaction_bet_payin requests only when you push it into iFrame JavaScript launch code.
    Note: this parameter isn't being used for desktop platform.
    bet / bet_id bigint unsigned Unique bet id on BetGames.TV server.
    bet / transaction_id bigint unsigned Unique transaction id on BetGames.TV server. Partner is obliged to store processed transaction ids. If the request contains the same transaction id, Partner should return success status, but do not withdraw money from the balance again.
    bet / draw / code string Draw code number.
    bet / draw / time string Draw start time, UTC.
    bet / draw / match / name varchar Match name
    bet / draw / match / code varchar Match name
    bet / draw / match / time datetime Scheduled start time of the match. Timezone - UTC+0.
    bet / draw / tournament / name varchar Tournament name
    bet / draw / tournament / code varchar Tournament code
    bet / draw / tournament / time datetime Scheduled start time of the tournament. Timezone - UTC+0.
    bet / game / id int or varchar Game ID in Betgames system - List of game ID's.
    bet / game / name string Game name in English.
    bet / game / translation string Game name in player's language.
    bet / odd / name string Outcome name in English.
    bet / odd / value float Outcome value
    bet / odd / translation string Outcome name in player's language.
    odd / id int Odd ID in Betgames system - List of odd ID's.
    odd / betting_option varchar betting option
    odd / participant varchar nickname of participant
    odd / score decimal Score value which was selected.
    odd / count int count for first generated values, for example "Total of first (COUNT) generated values - ODD/EVEN"
    odd / odd_even varchar Option which was selected odd/even
    odd / under_over varchar Option which was selected under/over
    odd / point_values varchar Used for most RNG generated value betting options

     


     

    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>
    

     

    Required Response Child-Elements for <params>
    Field Type Description
    balance_after int Player balance after the transaction.
    Important: amount must be in cents.
    already_processed int Equals 1 if the transaction was already processed.

     


     

    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.
    Important notes:

    • Transaction combination payout should return error with code 700, in case there were no combination payin with same combination_id and bet_id's before.
    • Transaction payout should return success but do not change players balance, in case there were already payout been made with same bet_id, but different transaction_id.

    Flowchart diagram:

    Combo payout.png

     


     

    • Some betting options, can have additional selection like number, sector, dice and etc. For each selection new <bet_option> </bet_option> element will be added. Up to 7 <bet_option> elements can be included in the request.

    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>
    


    Required Request Child-Elements for <params>
    Field Type Description
    player_id varchar Player external code provided by partner in get_account_details method. This method uses player_id for player identification.
    amount int Amount to deposit to account.
    Important: 1) amount is in cents. 2) amount is 0 for lost bet.
    currency varchar Currency code from the ISO 4217 code list.
    combination_id bigint unsigned Unique combination id on BetGames.TV server.
    type string Type of combination result - could be won, lost, return.
    bet / bet_id bigint unsigned Unique bet id on BetGames.TV server.
    bet / game_id int or varchar Game ID in Betgames system - List of game ID's.
    bet / transaction_id bigint unsigned Unique transaction id on BetGames.TV server. Partner is obliged to store processed transaction ids. If the request contains the same transaction id, Partner should return success status, but do not deposit money to the balance again.
    bet / type string Type of combination result for each single bet separately - could be won, lost, return.
    bet_option / name string Selection name, can be 'ball' / 'sector' / 'dice' / 'choice'.
    bet_option / value string Selection value
    bet_option / round int / null Only used for game "Speedy 7", to determine a round in which bet was placed.
    final_odd decimal Shows final odd value by which - bet was really calculated

     


     

    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>
    

     

    Required Response Child-Elements for <params>
    Field Type Description
    balance_after int Player balance after the transaction.
    Important: amount must be in cents.
    already_processed int Equals 1 if the transaction was already processed.

     


     

    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:

    • Transaction promo payout should return error with code 700, in case there were no payin with bet_id provided in request. This transaction should not affect the players balance;
    • Token shouldn't be used as player identificator for payout, player_id should be used;
    • Transaction promo payout should return success but do not change players balance, in case there were already payout been made with same promo_transaction_id;
    • Second transaction promo payout for same bet_id should be accepted if promo_transaction_id and promo_type is different.
    • promo_transaction_id ids pool is different from transaction_ids used in transaction_bet_payout (transaction_bet_payin) methods, there may be transaction_bet_payout with transaction_id = 1 and transaction_promo_payout with promo_transaction_id = 1.
    • transaction_promo_payout will be sent as additional payout with bet_id, which was already paid out with transaction_bet_payout or transaction_bet_combination_payout.


    Promo payout flowchart.png

     


     

    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>
    

     

    Required Request Child-Elements for <params>
    Field Type Description
    player_id varchar Player external code provided by partner in get_account_details method. This method uses player_id for player identification.
    currency varchar Currency code from the ISO 4217 code list.
    amount int Amount to deposit to account.
    Important: 1) amount is in cents. 2) amount is 0 for lost bet.
    promo_transaction_id bigint unsigned Unique promotion transaction id on BetGames.TV server. Partner is obliged to store processed promotion transaction ids. If the request contains the same transaction id, Partner should return success status, but do not deposit money to the balance again.

    Important: promo_transaction_id and transaction_id used in transaction_bet_payin/transaction_bet_payout is different and should be stored separately.

    bet_id bigint unsigned Unique bet id on BetGames.TV server.
    game_id int Game ID in Betgames system - List of game ID's.
    promo_type string Can be 'Cashback' / 'Speedy7 JackPot' / 'Poker Headsup JackPot'.

     


     

    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>
    


     

    Required Response Child-Elements for <params>
    Field Type Description
    balance_after int Player balance after the transaction.
    Important: amount must be in cents.
    already_processed int Equals 1 if the transaction was already processed.

     


     

    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:

    Transaction bet multi payin.png

     


     

    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>
    

     


     

    Required Request Child-Elements for <params>
    Field Type Description
    currency string Currency code from the ISO 4217 currency list.
    is_mobile bool-int Parameter to distinguish platform ("1"-mobile). This parameter appears in transaction_bet_payin requests only when you push it into iFrame JavaScript launch code.
    Note: this parameter isn't being used for desktop platform.
    bet / amount int Amount of the exact bet to withdraw from account.
    Important: amount is in cents.
    bet / bet_id bigint Unique bet id on BetGames.TV server.
    bet / transaction_id bigint Unique transaction id on BetGames.TV server. Partner is obliged to store processed transaction ids. If the request contains the same transaction id, Partner should return success status, but do not withdraw money from the balance again.
    bet / draw / code string Draw code number.
    bet / draw / time string Draw start time, UTC.
    bet / draw / match / name varchar Match name
    bet / draw / match / code varchar Match name
    bet / draw / match / time datetime Scheduled start time of the match. Timezone - UTC+0.
    bet / draw / tournament / name varchar Tournament name
    bet / draw / tournament / code varchar Tournament code
    bet / draw / tournament / time datetime Scheduled start time of the tournament. Timezone - UTC+0.
    game / id int or varchar Game ID in Betgames system - List of game ID's.
    game / name string Game name in English.
    game / translation string Game name in player's language.
    odd / id int Odd ID in Betgames system - List of odd ID's.
    odd / name string Outcome name in English.
    odd / value float Outcome value.
    odd / translation string Outcome name in player's language.
    odd / betting_option varchar betting option
    odd / participant varchar nickname of participant
    odd / score decimal Score value which was selected.
    odd / count int count for first generated values, for example "Total of first (COUNT) generated values - ODD/EVEN"
    odd / odd_even varchar Option which was selected odd/even
    odd / under_over varchar Option which was selected under/over
    odd / point_values varchar Used for most RNG generated value betting options

     


     

    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>
    
    Required Response Child-Elements for <params>
    Field Type Description
    balance_after int Player balance after the transaction.
    Important: amount must be in cents.
    bet / transaction_id bigint Unique transaction id on BetGames.TV server. Partner is obliged to store processed transaction ids. If the request contains the same transaction id, Partner should return success status, but do not withdraw money from the balance again.
    bet / 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).
    bet / error_text varchar text description of the error

     


    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