Skip to main content

VNLOTO API Single Wallet

Overview

1. Language

  • Mobile web, desktop web: Vietnamese
  • Backoffice: Vietnamese, English, Chinese

2. Currency

  • The system supports most currencies. Refer to the appendix.

3. Time Zone and Date/Time

  • API: GMT+7
  • Backoffice: GMT+7
  • Platform: GMT+7
  • Required date/time format:
    • Date: dd-mm-yyyy (Example: 03-08-2024)
    • Date and time: dd-mm-yyyy hh24:mi (Example: 03-08-2024 14:20)

4. Error Handling

  • All responses should include an error status to indicate whether an error occurred.

Common Responses

Success
{
"errorCode": 0,
"message": "Action successful!"
}

Success with data
{
"balance": "9774000",
"errorCode": 0,
"message": "Action successful!"
}
...

Failure
{
"errorCode": 3,
"message": "Failure: The username has already been registered."
}
  • Generally, an error code of 0 means “no error.” Any other code indicates an error.

5. Logging

  • All request and response parameters, including server errors, are logged.

6. Interfaces

The system has two interfaces: xoso168 and xoso188.

  • xoso168: Uses a dominant luxurious gold color.
  • xoso188: Uses a dominant sky blue color.

7. Game Betting Odds

  • Agents can set their own detailed lottery odds for each lottery type, lottery station, and play style.

8. Integration Steps

8.1 Agent Provides Integration Information

  • The agent provides the following information to XOSO168 before integration:
    • Wallet type: Seamless
    • Currency: VND (two types: VND or VNDK)
    • Agent code: X88 (used for agent identification)
    • Agent API URL: https://[SERVER]/api/merchant
    • Agent API key: APIKEY01a15085-8460

8.2 XOSO168 Creates the Integration Environment and Returns It to the Agent

  • After the agent provides the required information, XOSO168 will create a test integration environment for the agent:

9. API Authentication

  • When the agent calls the XOSO168 API:
    • Include the apiPrivateKey in the header; this key is provided by XOSO168 during integration.

alt text

  • XOSO168 calls the agent’s API:
    • Include the agentSecretKey in the header; this key is provided by the agent to XOSO168 during integration.

alt text

Common APIs

  • CreatePlayer, PlayerLogin, BetLog, BetInfo
  • These APIs use the [apiPrivateKey] provided by XOSO168 to the agent for authentication.
  • Please refer to the TransferWallet documentation.

Single Wallet APIs

  • These APIs use the [agentSecretKey] provided by the agent to XOSO168 for authentication.
https://[SERVER]/api/merchant

1. Balance

  • This function allows the game provider to periodically synchronize the player’s balance.
URL: https://[SERVER]/api/merchant
Method: POST
info
  • Connection Timeout: 5 seconds
  • Read Timeout: 5 seconds
Request
Field NameTypeMax LengthMandatoryDescription
flagString32YFixed value: Balance
accountString50YPlayer’s account

Request sample

curl --header "Content-Type:application/json" \
--header "Accept: application/json" \
--header "agentSecretKey: APIKEY01a15085-8460" \
--request POST \
--data '{
"flag": "Balance",
"account": "lt001"
}' \
https://[SERVER]/api/merchant

Response

Field NameTypeMax LengthMandatoryDescription
errorCodeIntegerYError code
messageString255YError message
dataObjectNHolds the response data

Response data structure

Field NameTypeMax LengthMandatoryDescription
balanceDecimal18,2YPlayer’s balance
accountString50YPlayer’s account

Response sample

Success
{
"errorCode": 0,
"message": "Successfully executed",
"data": {
"balance": 998665.75,
"account": "lt001"
}
}

Server error
{
"errorCode": 500,
"message": "Internal server error"
}

2. Bet

  • Send betting information to the single wallet. Each bet request must respond with the updated “balance” parameter to update the player’s game balance.
  • The PlaceBet action will start after the player clicks the “Confirm” button.
  • The single wallet must check the player’s balance and deduct the bet amount based on the transaction details.
URL: https://[SERVER]/api/merchant
Method: POST
info
  • Connection Timeout: 5 seconds
  • Read Timeout: 6 seconds
Request
Field NameTypeMax LengthMandatoryDescription
flagString32YFixed value: Bet
balanceChangeIdString50YTransaction Id
betIdString50YBet Id
accountString50YPlayer’s account
amountDecimal18,2YBet amount

Request sample

curl --header "Content-Type:application/json" \
--header "Accept: application/json" \
--header "agentSecretKey: APIKEY01a15085-8460" \
--request POST \
--data '{
"flag": "Bet",
"balanceChangeId": "BCB240729153234F1LF",
"betId": "B2407291532343P4L",
"account": "lt001",
"amount": 50
}' \
https://[SERVER]/api/merchant

Response

Field NameTypeMax LengthMandatoryDescription
errorCodeIntegerYError code
messageString255YError message
dataObjectNHolds the response data

Data Structure

Field NameTypeMax LengthMandatoryDescription
balanceChangeIdString50YTransaction Id
betIdString50YBet Id
accountString50YPlayer’s account
amountDecimal18,2YBet amount
balanceDecimal18,2YPlayer’s account balance

Response sample

Success
{
"errorCode": 0,
"message": "Success",
"data": {
"balanceChangeId": "abc123",
"betId": "bet456",
"account": "lt001",
"amount": 100,
"balance": 50
}
}

Fail
{
"errorCode": "20",
"message": "Account balance is not enough"
}

Server error
{
"errorCode": "500",
"message": "Internal server error"
}

3. Cancel

  • Send a cancel bet request to the single wallet.
  • Cancel bet can be triggered when the Bet response times out.
  • Cancel bet will be retried several times until it is successful, or the operator returns an error or the retry limit is reached.
  • The single wallet must check and refund the bet amount to the player based on the transaction details.
  • Retry Policy:
    • 1 retry after 5 seconds
    • 1 retry after 10 seconds
    • 1 retry after 30 seconds
    • 1 retry after 1 minute
    • 1 retry after 2 minutes
    • 1 retry after 5 minutes
    • 1 retry after 10 minutes
    • 1 retry after 15 minutes
URL: https://[SERVER]/api/merchant
Method: POST
info
  • Connection Timeout: 5 seconds
  • Read Timeout: 12 seconds
Request
Field NameTypeMax LengthMandatoryDescription
flagString32YFixed value: Cancel
balanceChangeIdString50YTransaction Id
betIdString50YBet Id
accountString50YPlayer’s account
amountDecimal18,2YBet amount

Request sample

curl --header "Content-Type:application/json" \
--header "Accept: application/json" \
--header "agentSecretKey: APIKEY01a15085-8460" \
--request POST \
--data '{
"flag": "Cancel",
"balanceChangeId": "BCB240729153234F1LF",
"betId": "B2407291532343P4L",
"account": "lt001",
"amount": 50
}' \
https://[SERVER]/api/merchant

Response

Field NameTypeMax LengthMandatoryDescription
errorCodeIntegerYError code
messageString255YError message
dataObjectNHolds the response data

Data Structure

Field NameTypeMax LengthMandatoryDescription
balanceChangeIdString50YTransaction Id
betIdString50YBet Id
accountString50YPlayer’s account
amountDecimal18,2YBet amount

Response sample

Success
{
"errorCode": 0,
"message": "Success",
"data": {
"balanceChangeId": "abc123",
"betId": "bet456",
"account": "lt001",
"amount": 50
}
}

Server error
{
"errorCode": 500,
"message": "Internal server error"
}

4. Settle

  • This function is used to send credit transactions (bonus) to the player. The single wallet must update the player's balance based on these credit transactions.
  • The Settle call may be retried if there is an error. It will keep retrying until it is successful.
URL: https://[SERVER]/api/merchant
Method: POST
info
  • Connection Timeout: 5 seconds
  • Read Timeout: 12 seconds
Request
Field NameTypeMax LengthMandatoryDescription
flagString32YFixed value: Settle
dataArrayNStores the request array data

Data structure

Field NameTypeMax LengthMandatoryDescription
balanceChangeIdString50YTransaction Id
betIdString50YBet Id
accountString50YPlayer’s account
amountDecimal18,2YWinning amount

Request sample

curl --header "Content-Type:application/json" \
--header "Accept: application/json" \
--header "agentSecretKey: APIKEY01a15085-8460" \
--request POST \
--data '{
"flag": "Settle",
"data": [
{
"balanceChangeId": "BCB240729153234F1LA",
"betId": "B2407291532343P4A",
"account": "lt001",
"amount": 50
},
{
"balanceChangeId": "BCB240729153234F1LF",
"betId": "B2407291532343P4L",
"account": "lt002",
"amount": 20
}
]
}' \
https://[SERVER]/api/merchant

Response

Field NameTypeMax LengthMandatoryDescription
errorCodeIntegerYError code
messageString255YError message
dataArrayNContains the successful bonus credit data
errorsArrayNContains the bonus credit data that failed, if any

Data Structure

Field NameTypeMax LengthMandatoryDescription
balanceChangeIdString50YTransaction Id
betIdString50YBet Id
accountString50YPlayer’s account
amountDecimal18,2YBonus amount for the player

Response sample

Success
{
"errorCode": 0,
"message": "Success",
"data": [
{
"balanceChangeId": "BCB240729153234F1LA",
"betId": "B2407291532343P4A",
"account": "lt001",
"amount": 50
},
{
"balanceChangeId": "BCB240729153234F1LF",
"betId": "B2407291532343P4L",
"account": "lt002",
"amount": 20
}
]
}

Fail
{
"errorCode": 1,
"message": "Success but content failed",
"data": [
{
"balanceChangeId": "BCB240729153234F1LA",
"betId": "B2407291532343P4A",
"account": "lt001",
"amount": 50
}
],
"errors": [
{
"balanceChangeId": "BCB240729153234F1LF",
"betId": "B2407291532343P4L",
"account": "lt002",
"amount": 20
}
]
}

Server error
{
"errorCode": 500,
"message": "Internal server error"
}

5. Note: Settle & Cancel

Note: The “Settle” and “Cancel” APIs only indicate the bet status on our platform. The operator must determine whether the corresponding transactions are charged or voided. Our platform does not specify or affect the handling method on the operator’s side.

Appendix

1. Error Codes

Error CodeError MessageError TypeSourceWallet Type
0Operation successful!Transaction successAGENT, XOSO168Single, Transfer
1Successful but content is invalidSettleAGENTSingle
20Insufficient account balanceBetAGENTSingle
4001Failure: Access denied.Access rights errorXOSO168Single, Transfer
4002Failure: Invalid agentId.Access rights errorXOSO168Single, Transfer
4004Failure: System is under maintenance.Access rights errorXOSO168Single, Transfer
500Failure: Please try again or contact customer support!System errorXOSO168Single, Transfer
1001Failure: Username already registered.User account errorXOSO168Single, Transfer
1002Failure: Incorrect username or password, please try again!User account errorXOSO168Single, Transfer
1003Your account has been disabled, please contact customer support!User account errorXOSO168Single, Transfer
1004Failure: Account does not existUser account errorXOSO168Single, Transfer
1005Failure: Account is locked, cannot deposit fundsUser account errorXOSO168Single, Transfer
1006Your account has been disabled, please contact customer support!User account errorXOSO168Single, Transfer
1007Failure: Test account cannot deposit fundsUser account errorXOSO168Single, Transfer
1008Failure: Account is locked, cannot withdraw fundsUser account errorXOSO168Single, Transfer
2001Failure: Reference number 0 already existsDuplicate reference errorXOSO168Single, Transfer
2005Failure: Insufficient account balanceWithdrawal transaction errorXOSO168Single, Transfer

2. Betting Status

Betting StatusDescriptionPayout
0Not yet drawnNo
1Awaiting drawNo
2Awaiting settlementNo
3LostNo
4WonYes
5Canceled "maintenance"No
6Individual bet canceledNo
7Draw canceledNo
10Bet created and pending transaction processing (Agent system deducting bet amount)No
12Bet failed due to error or invalid conditions (e.g., insufficient balance or other exceptions)No

3. Frontend Transaction Status

StatusDescription
0Processing
1Cancelled by system
2Successful

4. Backend Transaction Status

StatusDescription
0Processing by system
1Failed
2System processing timed out
3Processing error
4Successful
5Cancellation in process
6Cancelled by system
7Bonus credit in process

5. GameId Table

GameIdTypeDescription
0MAINMain lobby
1MAINASIA 24H Menu
2MAINVIP Menu
3MAINRapid Menu
4MAINNorthern Menu
5MAINCentral Menu
6MAINSouthern Menu
7MAINFolk Games Menu
400ASIA 24HSouthern 24H14
401ASIA 24HCentral 24H14
402ASIA 24HNorthern 24H14
300VIPVietnam VIP 12H14
301VIPSaigon VIP 15H14
302VIPHo Chi Minh VIP 16H14
303VIPDa Nang VIP 17H14
304VIPHa Noi VIP 19H14
305VIPThang Long VIP 20H14
50Siêu TốcSiêu Tốc 1 Second
100Siêu TốcSiêu Tốc 45 Seconds
101Siêu TốcSiêu Tốc 1 Minute
102Siêu TốcSiêu Tốc 1.5 Minutes
103Siêu TốcSiêu Tốc 2 Minutes
104Siêu TốcSiêu Tốc 5 Minutes
105Miền NamHo Chi Minh
106Miền NamDong Thap
107Miền NamCa Mau
108Miền NamBen Tre
109Miền NamVung Tau
110Miền NamBac Lieu
111Miền NamDong Nai
112Miền NamCan Tho
113Miền NamSoc Trang
114Miền NamTay Ninh
115Miền NamAn Giang
116Miền NamBinh Thuan
117Miền NamVinh Long
118Miền NamBinh Duong
119Miền NamTra Vinh
120Miền NamLong An
121Miền NamBinh Phuoc
122Miền NamHau Giang
123Miền NamTien Giang
124Miền NamKien Giang
125Miền NamDa Lat
126Miền TrungThua Thien Hue
127Miền TrungPhu Yen
128Miền TrungDak Lak
129Miền TrungQuang Nam
130Miền TrungDa Nang
131Miền TrungKhanh Hoa
132Miền TrungBinh Dinh
133Miền TrungQuang Tri
134Miền TrungQuang Binh
135Miền TrungGia Lai
136Miền TrungNinh Thuận
137Miền TrungQuang Ngai
138Miền TrungDak Nong
139Miền TrungKon Tum
200Miền BắcNorthern 18H14
201Miền BắcSpecial 6h25
60Folk GamesTai Xiu 1 Second
80Folk GamesTai Xiu 1 Minute
90Folk GamesXoc Dia 1 Second
91Folk GamesXoc Dia 1 Minute
92Folk GamesBau Cua 1 Second
93Folk GamesBau Cua 1 Minute

6. Currency List

Currency CodeDescription
USDTUSDT
AEDUnited Arab Emirates dirham
AMDArmenian dram
ARSArgentine peso
AUDAustralian dollar
BDTBangladeshi taka
BNDBrunei dollar
BRLBrazilian real
CADCanadian dollar
CHFSwiss franc
CLPChilean peso
COPColombian peso
CNYChinese yuan (Renminbi)
DZDAlgerian dinar
EGPEgyptian pound
ETBEthiopian birr
EUREuro
FRFFrench franc
GBPBritish pound sterling
GHSGhanaian cedi
HKDHong Kong dollar
IDRIndonesian rupiah (1:1000)
INRIndian rupee
JPYJapanese yen
KRWSouth Korean won
KZTKazakhstani tenge
KHRCambodian riel (1:1000)
KESKenyan shilling
LAKLao kip (original)
LAKKLao kip (1:1000)
LKRSri Lankan rupee
MADMoroccan dirham
MOPMacanese pataca
MMKMyanmar kyat (original) (1:1)
MMKKMyanmar kyat (1:1000)
MYRMalaysian ringgit
MXNMexican peso
MNTMongolian tugrik
NOKNorwegian krone
NZDNew Zealand dollar
NPRNepalese rupee
NGNNigerian naira
PGKPapua New Guinean kina
PTIIndonesian rupiah (original) (1:1)
PKRPakistani rupee
PHPPhilippine peso
PENPeruvian nuevo sol
RUBRussian ruble
SEKSwedish krona
SGDSingapore dollar
THBThai baht
TRYTurkish lira
TNDTunisian dinar
TZSTanzanian shilling
USDUnited States dollar
UAHUkrainian hryvnia
UGXUgandan shilling
VNDVietnamese đồng (original) (1:1)
VNDKVietnamese đồng (1:1000)
ZARSouth African rand
ZWDZimbabwean dollar
ZMWZambian kwacha

7. Single Wallet Integration Issues

There are several scenarios that may be encountered in production. We provide the following recommendations for each case so that your technical team can prepare solutions in advance.

A. Financial Data Dispute

If any issue causes a financial data dispute and cannot be processed immediately due to technical difficulties on your side in the production environment, you must accept our final decision if no consensus is reached.

B. Continuous Transaction Issues

If any production incident occurs, causing continuous transactions or transactions being stuck due to technical difficulties on your side and we cannot contact your technical team immediately for an effective resolution, please note that we will suspend your single wallet service to prevent worse situations that could affect the player experience until the technical issue is resolved.

Real-life Scenarios

Based on our real-world API notifications, you may encounter situations as described below. Please confirm that you can handle them correctly.

No.DescriptionDetails
1Normal Case: You will receive the bet request first and then the cancel bet request.Scenario: If XOSO168 does not receive the proper response for the bet request within the designated timeout period from the Operator.

Solution: If the bet transaction has been accepted by the Operator (the balance has been deducted), then the cancel bet for that transaction (with the same transactionId/balanceChangeId) must be processed. The balance should be refunded based on the bet amount.
2Exceptional Case: You receive the cancel bet request before receiving the bet request.Scenario: This may occur due to network instability.

Example:
1. XOSO168 sends a bet request to you.
2. Unstable network.
3. Your bet response times out.
4. XOSO168 sends a cancel bet request.
5. Due to network issues, you receive the cancel bet before the bet request.

Solution: If you receive a cancel bet with a transactionId/balanceChangeId that does not match any stored bet transaction, the bet may still arrive later and should be reversed. Therefore, the Operator must retain this cancel bet until a matching bet is received or store it concurrently with other processed transactionIds/balanceChangeIds. One approach is to store this transactionId/balanceChangeId along with others that have been processed. In this way, if a bet with the same transactionId/balanceChangeId is received, it will not be processed.
3Exceptional Case: You receive a cancel bet request but no corresponding bet exists.Scenario: This may occur when the network experiences an issue.

Example:
1. XOSO168 sends a bet request to you.
2. Due to unstable network, the bet requests are lost.
3. Your bet response times out.
4. XOSO168 sends a cancel bet request.
5. Due to network issues, you receive the cancel bet before the bet request.

Solution: In this case, we recommend handling it in the same manner as Case 2.
4Retry Count for Cancel BetScenario: If we do not receive the expected cancel bet response from you, we will continue to resend the request until it is received.

Solution: Please ensure your system can process and cancel the bet transaction using the same transactionId/balanceChangeId for the cancel bet, then respond successfully after verification.

Expected response from the Operator:
[cancelBet]
errorCode: 0
5Bet Failure due to Insufficient BalanceScenario: If a bet fails due to insufficient balance or other bet limits on your side, XOSO168 will not request a separate cancel bet.

Solution: Please confirm that your system can automatically log and verify these failed bet transactions.

XOSO168 will request a cancel bet in these situations:
1. Bet response from the Operator times out.
2. The game provider sends a cancel bet request to XOSO168.
3. Even if your bet response does not time out, but the HTTP status code from your side is not 200, XOSO168 will request a cancel bet.
6Duplicate RequestScenario: If you receive a duplicate request that has already been successfully responded to XOSO168 (the bet deduction will not be retried).

Solution: Please ensure that your system can recognize and not update the balance again, and respond with status: 0 to us. Any status other than 0 will be identified as invalid, and we will continue to resend the request until a valid response is received.

Expected response from the Operator:
status: 0

Please confirm that you have set up a complete storage environment. In other words, that you can receive and store any requests from XOSO168. If not, please implement it first.

The rationale is to allow you to monitor in real-time through anomaly logging and provide backup solutions so that you can restore necessary data from your log files.

Example: You should ensure that your system logs accurately while receiving a bet and then responds with 0 and the balance to us. No bet, settle, or cancel transaction should be dropped or deleted so that no data is lost.