1. Overview
This document describes the seamless wallet integration between casino and merchant. In seamless wallet, the member's balance is kept at merchant. Merchant will be required to prepare API for casino to send wager details.
1.1 Items provided by casino
- casino endpoint
- casino merchant code
- casino merchant token
- casino secret key
1.2 Items provided by merchant
- Merchant endpoint
1.3 Required API from merchant
Merchant will be required to have the API listed below for casino to call.
- balance
- wager
Example :
Merchant endpoint provided : http://www.merchant.com/Fully qualified URL for balance : http://www.merchant.com/balance
2. User authentication
Merchant will call this casino API to get the url of the game for a specified user. The API will create new member if it is not found in casino system.
URL :
<casino endpoint>/auth
2.1 Request format
Method : POST
Content type : JSON
Content type : JSON
Header
| Key | Value |
|---|---|
| merchant-code | Provided by casino |
| merchant-token | Provided by casino |
Content
| Field | Type | Description | Mandatory |
|---|---|---|---|
| user | object | y | |
| user.id | integer | Unique identifier for user | y |
| user.name | string | Name | y |
| user.currency | string | ISO 4217 code, can't change In staging environment, currency will be hardcoded to UAT |
y |
| user.language | string | Game language, ISO 639-1 code | y |
| user.bet_limit | integer | Refer to casino for latest bet limit Default bet limit by currency will be used if not defined |
n |
| table | integer | Launch direct to table Refer to casino for table ID |
n |
{
"user":
{
"id":1,
"name":"tester01",
"currency":"USD",
"language":"en",
"bet_limit":1,
},
"table":1
}
"user":
{
"id":1,
"name":"tester01",
"currency":"USD",
"language":"en",
"bet_limit":1,
},
"table":1
}
2.2 Response format
Content
| Field | Type | Description |
|---|---|---|
| status | integer | 0 if fail, 1 if success |
| member_id | integer | casino member id |
| launch_url | string | Launch URL |
| error | string | Error details if fail |
Success
{"status":1,
"member_id":10001,
"launch_url":"http://test.com",
}
Error
{"status":0,
"error":"UNAUTHORIZED_ACCESS",
}
Error code
| Error code | Description |
|---|---|
| UNAUTHORIZED_ACCESS | Invalid merchant token |
| INVALID_USER_PARAMS | Invalid format for user object |
| INVALID_GAME_PARAMS | Invalid format for game object |
| MEMBER_CREATION_FAILED | Fail to create member |
| INTERNAL_ERROR | System error |
3. Member Balance
casino will call this API in the merchant system to get the member's balance.
URL :
<Merchant endpoint>/balance
3.1 Request format
Method : POST
Content type : JSON
Content type : JSON
Header
| Key | Value |
|---|---|
| secret-key | Provided by casino |
Content
| Field | Type | Description |
|---|---|---|
| member_id | integer | casino member id |
{
"member_id":1001
}
"member_id":1001
}
3.2 Response format
Content
| Field | Type | Description |
|---|---|---|
| status | integer | 0 if fail, 1 if success |
| balance | decimal(20,2) | Latest member balance |
| error | string | Error details if fail |
Success
{"status":1,
"balance":999.99,
}
Error
{"status":0,
"error":"UNAUTHORIZED_ACCESS",
}
Error code
| Error code | Description |
|---|---|
| UNAUTHORIZED_ACCESS | Invalid secret key |
| MEMBER_NOT_EXIST | Member not found in merchant system |
| INTERNAL_ERROR | System error |
4. Wager
casino will call this API in the merchant system to send in wager details.
All debit and credit will be paired by transaction ID. A credit can only be processed when a matching debit is found.
All debit and credit will be paired by transaction ID. A credit can only be processed when a matching debit is found.
URL :
<Merchant endpoint>/wager
4.1 Request format
Method : POST
Content type : JSON
Content type : JSON
Header
| Key | Value |
|---|---|
| secret-key | Provided by casino |
Content
| Field | Type | Description |
|---|---|---|
| member_id | integer | casino member id |
| debit | object | |
| debit.game_id | integer | Game ID, refer appendix |
| debit.round_id | integer | Round ID |
| debit.txn_id | integer | Transaction ID |
| debit.amount | decimal(20,2) | Amount |
| credit | object | |
| credit.game_id | integer | Game ID, refer appendix |
| credit.round_id | integer | Round ID |
| credit.txn_id | integer | Transaction ID |
| credit.amount | decimal(20,2) | Amount |
| credit.is_cancel | integer | 0=normal 1=cancel |
{
"member_id":1001,
"debit":
{
"game_id":1
"round_id":100
"txn_id":10000
"amount":99.99
},
"credit":
{
"game_id":1
"round_id":100
"txn_id":10000
"amount":99.99
"is_cancel":0
}
}
"member_id":1001,
"debit":
{
"game_id":1
"round_id":100
"txn_id":10000
"amount":99.99
},
"credit":
{
"game_id":1
"round_id":100
"txn_id":10000
"amount":99.99
"is_cancel":0
}
}
4.2 Response format
Content
| Field | Type | Description |
|---|---|---|
| status | integer | 0 if fail, 1 if success |
| balance | decimal(20,2) | Latest member balance |
| error | string | Error details if fail |
Success
{"status":1,
"balance":999.99,
}
Error
{"status":0,
"error":"UNAUTHORIZED_ACCESS",
}
Error code
| Error code | Description |
|---|---|
| UNAUTHORIZED_ACCESS | Invalid secret key |
| MEMBER_NOT_EXIST | Member not found in merchant system |
| INSUFFICIENT_FUNDS | Debit check : member do not have sufficient funds to place bet |
| DEBIT_ALREADY_EXIST | Debit check : debit with the same transaction id already found in merchant system |
| DEBIT_DOES_NOT_EXIST | Credit check : debit with the same transaction id as credit not found in merchant system |
| CREDIT_ALREADY_EXIST | Credit check : credit with the same transaction id already found in merchant system |
| INTERNAL_ERROR | System error |
5. Check wager
Merchant can use this API to check the results of wager. Possible usage is when merchant did not received wager – credit call. Only settled wager will be retrieved.
URL :
<casino endpoint>/wager
5.1 Request format
Method : POST
Content type : JSON
Content type : JSON
Header
| Key | Value |
|---|---|
| merchant-code | Provided by casino |
| merchant-token | Provided by casino |
Content
| Field | Type | Description | Mandatory |
|---|---|---|---|
| txn_id | integer | Transaction ID | y (not mandatory when time is used) |
| from_time | datetime | UTC timezone ISO 8601 format Maximum 3 hour data |
n |
| to_time | datetime | UTC timezone ISO 8601 format Maximum 3 hour data |
n |
| details | integer | 0 = no details 1 = with details |
n |
{
"from_time":"2000-01-01T00:00:00",
"to_time":"2000-01-01T02:00:00",
"details":1
}
"from_time":"2000-01-01T00:00:00",
"to_time":"2000-01-01T02:00:00",
"details":1
}
5.2 Response format
Content
| Field | Type | Description |
|---|---|---|
| status | integer | 0 if fail, 1 if success |
| wager | array | |
| wager.game_id | integer | Refer appendix |
| wager.round_id | integer | Round ID |
| wager.ext_round_id | string | Round ID shown in the game and video If empty string means wager.round_id is shown instead |
| wager.txn_id | integer | Transaction ID |
| wager.member_id | integer | casino member ID |
| wager.stakes | decimal(20,2) | Stakes |
| wager.stakes_valid | decimal(20,2) | Valid stakes |
| wager.payout | decimal(20,2) | Payout |
| wager.is_cancel | integer | 0=normal 1=cancel |
| wager.debit_time | datetime | UTC timezone ISO 8601 format |
| wager.credit_time | datetime | UTC timezone ISO 8601 format |
| wager.currency | string | ISO 4217 code In staging environment, currency will be hardcoded to UAT |
| wager.table_id | integer | Table ID |
| wager.ip_addr | string | Member's IP address |
| details | array | Will be available if request "details" = 1 Refer appendix |
| error | string | Error details if fail |
Success
{"status":1,
"wager":[
{
"game_id":1,
"round_id":50,
"ext_round_id":"",
"txn_id":1000,
"member_id":5000,
"stakes":100.00,
"stakes_valid":100.00,
"payout":195.00,
"is_cancel":0,
"debit_time":"2000-12-01T00:18:00.000",
"credit_time":"2000-12-01T00:18:00.000",
"currency":"USD",
"table_id":1
}],
"details":[
{
"txn_id":1000,
...
}]
}
Error
{"status":0,
"error":"UNAUTHORIZED_ACCESS",
}
Error code
| Error code | Description |
|---|---|
| UNAUTHORIZED_ACCESS | Invalid merchant token |
| INTERNAL_ERROR | System error |
6. Appendix
6.1 Game ID
| Key | Value |
|---|---|
| 1 | Baccarat |
| 2 | Dragon Tiger |
6.2 Card ID
| Key | Value |
|---|---|
| Suit + Number | S = Spade suit H = Heart suit C= Club suit D = Diamond suit 1 = Ace 2-10 = Number card J,Q,K = Face card example: S1 = Spade Ace HK = Heart King C10 = Club 10 |
6.3 Game details - format
Game ID : 1
| Field | Type | Description |
|---|---|---|
| comm | integer | 0=no commission 1=commission |
| bet_player | decimal(20,2) | Total bets on player |
| bet_banker | decimal(20,2) | Total bets on banker |
| bet_tie | decimal(20,2) | Total bets on tie |
| bet_playerpair | decimal(20,2) | Total bets on player pair |
| bet_bankerpair | decimal(20,2) | Total bets on banker pair |
| bet_luckysix | decimal(20,2) | Total bets on lucky six |
| bet_luckyseven | decimal(20,2) | Total bets on lucky seven |
| bet_superluckyseven | decimal(20,2) | Total bets on super lucky seven |
| bet_smalldragon | decimal(20,2) | Total bets on small dragon |
| bet_bigdragon | decimal(20,2) | Total bets on big dragon |
| bet_smalltiger | decimal(20,2) | Total bets on small tiger |
| bet_bigtiger | decimal(20,2) | Total bets on big tiger |
| bet_dragontiger | decimal(20,2) | Total bets on dragon tiger |
| bet_tigerpair | decimal(20,2) | Total bets on tiger pair |
| bet_eitherpair | decimal(20,2) | Total bets on either pair |
| bet_perfectpair | decimal(20,2) | Total bets on perfect pair |
| bet_dragonseven | decimal(20,2) | Total bets on dragon seven |
| bet_pandaeight | decimal(20,2) | Total bets on panda eight |
| bet_playerdragon | decimal(20,2) | Total bets on player dragon |
| bet_bankerdragon | decimal(20,2) | Total bets on banker dragon |
| bet_superpair | decimal(20,2) | Total bets on super pair |
| bet_tigertie | decimal(20,2) | Total bets on tiger tie |
| bet_playerheaven | decimal(20,2) | Total bets on player heaven |
| bet_bankerheaven | decimal(20,2) | Total bets on banker heaven |
| bet_heavencard | decimal(20,2) | Total bets on heaven card |
| bet_supertie0 | decimal(20,2) | Total bets on super tie 0 |
| bet_supertie1 | decimal(20,2) | Total bets on super tie 1 |
| bet_supertie2 | decimal(20,2) | Total bets on super tie 2 |
| bet_supertie3 | decimal(20,2) | Total bets on super tie 3 |
| bet_supertie4 | decimal(20,2) | Total bets on super tie 4 |
| bet_supertie5 | decimal(20,2) | Total bets on super tie 5 |
| bet_supertie6 | decimal(20,2) | Total bets on super tie 6 |
| bet_supertie7 | decimal(20,2) | Total bets on super tie 7 |
| bet_supertie8 | decimal(20,2) | Total bets on super tie 8 |
| bet_supertie9 | decimal(20,2) | Total bets on super tie 9 |
| win_player | decimal(20,2) | Total winnings on player |
| win_banker | decimal(20,2) | Total winnings on banker |
| win_tie | decimal(20,2) | Total winnings on tie |
| win_playerpair | decimal(20,2) | Total winnings on player pair |
| win_bankerpair | decimal(20,2) | Total winnings on banker pair |
| win_luckysix | decimal(20,2) | Total winnings on lucky six |
| win_luckyseven | decimal(20,2) | Total winnings lucky seven |
| win_superluckyseven | decimal(20,2) | Total winnings super lucky seven |
| win_smalldragon | decimal(20,2) | Total winnings small dragon |
| win_bigdragon | decimal(20,2) | Total winnings big dragon |
| win_smalltiger | decimal(20,2) | Total winnings small tiger |
| win_bigtiger | decimal(20,2) | Total winnings big tiger |
| win_dragontiger | decimal(20,2) | Total winnings dragon tiger |
| win_tigerpair | decimal(20,2) | Total winnings tiger pair |
| win_eitherpair | decimal(20,2) | Total winnings either pair |
| win_perfectpair | decimal(20,2) | Total winnings perfect pair |
| win_dragonseven | decimal(20,2) | Total winnings dragon seven |
| win_pandaeight | decimal(20,2) | Total winnings panda eight |
| win_playerdragon | decimal(20,2) | Total winnings player dragon |
| win_bankerdragon | decimal(20,2) | Total winnings banker dragon |
| win_superpair | decimal(20,2) | Total winnings super pair |
| win_tigertie | decimal(20,2) | Total winnings tiger tie |
| win_playerheaven | decimal(20,2) | Total winnings player heaven |
| win_bankerheaven | decimal(20,2) | Total winnings banker heaven |
| win_heavencard | decimal(20,2) | Total winnings heaven card |
| win_supertie0 | decimal(20,2) | Total winnings super tie 0 |
| win_supertie1 | decimal(20,2) | Total winnings super tie 1 |
| win_supertie2 | decimal(20,2) | Total winnings super tie 2 |
| win_supertie3 | decimal(20,2) | Total winnings super tie 3 |
| win_supertie4 | decimal(20,2) | Total winnings super tie 4 |
| win_supertie5 | decimal(20,2) | Total winnings super tie 5 |
| win_supertie6 | decimal(20,2) | Total winnings super tie 6 |
| win_supertie7 | decimal(20,2) | Total winnings super tie 7 |
| win_supertie8 | decimal(20,2) | Total winnings super tie 8 |
| win_supertie9 | decimal(20,2) | Total winnings super tie 9 |
| result_player_card | string | Refer card id in appendix 2-3 cards,separated by comma example S1,S2,S3 |
| result_banker_card | string | Refer card id in appendix 2-3 cards,separated by comma example S1,S2,S3 |
Game ID : 2
| Field | Type | Description |
|---|---|---|
| bet_dragon | decimal(20,2) | Total bets on dragon |
| bet_tiger | decimal(20,2) | Total bets on tiger |
| bet_tie | decimal(20,2) | Total bets on tie |
| win_dragon | decimal(20,2) | Total winnings on dragon |
| win_tiger | decimal(20,2) | Total winnings on tiger |
| win_tie | decimal(20,2) | Total winnings on tie |
| result_dragon_card | string | Refer card id in appendix 1 card only example: S1 |
| result_tiger_card | string | Refer card id in appendix 1 card only example: S1 |