UDun Wallet API development interface document
1、API Integration Notes
1.1 Field Types and body Format
When building requests, serializing the body field, or processing callback data, preserve each field type exactly as defined in the API documentation. Do not convert Integer, Long, or Boolean fields to String, and do not rely on implicit type conversion. Some languages and development environments may not raise a clear error when a conversion fails, but the subsequent logic may not execute. For C integrations, validate every field type before serialization and log conversion or parsing failures.
The outer body field is a String. Its contents must be a valid JSON string that follows the object or array structure shown in the relevant API example. Keep all required braces and brackets. An incorrectly formatted body may return error code B0001.
1.2 Shared Address Rules for EVM-Compatible Networks
UDun Wallet 3.0 uses a shared-address model for EVM-compatible networks. Within the same wallet, networks such as Ethereum, BNB Smart Chain, and Polygon share one address beginning with 0x. This differs from UDun Wallet 2.0, where each network used a separate address.
Generate Address API: When generating an address for any EVM-compatible network or token, always set mainCoinType to 60, the main coin type for Ethereum. Do not use the individual main coin type for BNB Smart Chain, Polygon, or another EVM-compatible network. For non-EVM networks, use the corresponding mainCoinType.
Transaction Callback and Withdrawal APIs: Continue to use the actual mainCoinType and coinType to identify the specific network and asset. For example, Ethereum uses mainCoinType 60, while BNB uses mainCoinType 2510. Refer to the Get Supported Assets API response for the applicable values.
EVM Tokens: The shared-address rule also applies to tokens issued on EVM-compatible networks. When calling the Generate Address API, set mainCoinType to 60 for USDC.ERC20, USDT.ERC20, USDT.BEP20, USDC.BEP20, and other supported EVM tokens. For withdrawals and transaction callbacks, use the actual mainCoinType and coinType for the relevant network and token.
Summary: For all supported EVM-compatible networks and tokens, use mainCoinType = 60 when generating an address. For non-EVM networks such as Bitcoin and TRON, use the network-specific main coin type.
2、Generate addresses
2.1 Scenario description
Requests an address for a specified asset. Before generating an address, make sure the merchant has created a wallet and the wallet supports the asset.
2.2 Interface details
2.2.1 Interface addresses
| Interface details | |
|---|
| URL | 【/mch/address/create】 |
| Application method | POST |
2.2.2 Parameters
2.2.2.1 Parameter description
[
{
"merchantId":"300015",
"mainCoinType":60,
"callUrl":"http://localhost:8080/callBack"
}
]
2.2.2.2 Body parameter field
| Body parameter name | Type | Required or not | Description |
|---|
| merchantId | String | is | Merchant ID |
| mainCoinType | Integer | is | Main coin number. Use the interface to get merchant coin information. |
| callUrl | String | is | The deposit information about the callback address created through the interface will be notified to you through the callback address you specified. See the trade callback interface for specific examples. |
| walletId | String | No | Wallet number. By default, the address is generated according to the main wallet. |
| alias | String | No | Address alias |
2.2.2.3 Examples
{
"timestamp": 1535005047,
"nonce": 10000,
"sign": "a230def43c1a12b14393880a28d4e005",
"body": "[{\"merchantId\":\"300015\",\"mainCoinType\":60,\"callUrl\":\"http://localhost:8080/callBack\"}]"
}
2.2.3 Return to status code
| code | Explain |
|---|
| -1 | Failed to generate addresses |
| 200 | Generate addresses successfully |
| 4001 | No merchant |
| 4005 | Illegal parameters |
| 4045 | Wrong coin information |
| 4162 | Abnormal signature |
| 4163 | Wrong signature |
| 4166 | The merchant has no configuration package |
| 4168 | The merchant address reaches the upper limit |
| 4169 | The merchant has disabled |
| 4175 | Wrong wallet number |
| 4017 | The merchant does not create a wallet |
| 4176 | The coin is not added to the wallet |
| 4188 | Not supported now |
| 4226 | The merchant's general account is banned |
| 4261 | The merchant's administrator account is banned |
| 4262 | The account does not exist |
| 4264 | The request IP is not on the whitelist. |
| B0001 | Invalid request body format. |
2.3 Call examples
2.3.1 Success
{
"data":{
"coinType":60,
"address":"0xbe4e3699cb870bc95365fe04a187dd279a651a58"
},
"message":"SUCCESS",
"code":200
}
2.3.2 Failure
{
"code": "4101",
"message": "SIGN_MSG_ERROR"
}
3、Send withdrawal application
3.1 Scenario description
Withdrawal application
3.2 Interface details
3.2.1 Interface addresses
| Interface details | |
|---|
| URL | 【/mch/withdraw】 |
| Application method | POST |
3.2.2 Parameters
3.2.2.1 Parameter description
[
{
"address":"raadSxrUhG5EQVCY75CSGaVLWCeXd6yH6s",
"amount":"0.11",
"merchantId":"100109",
"mainCoinType":"144",
"coinType":"144",
"callUrl":"http://localhost:8080/mch/callBack",
"businessId":"15",
"memo":"10112"
}
]
3.2.2.2 Body parameter field
| Body parameter name | Required or not | Type | Description |
|---|
| address | is | String | Withdrawal address |
| amount | is | String | Withdrawal amount |
| merchantId | is | String | Merchant ID |
| mainCoinType | is | String | Main coin number. Use the interface to get merchant coin information. |
| coinType | is | String | Child coin number. Use the interface to get merchant coin information. |
| callUrl | is | String | Callback address. You are informed of the status of the coin withdrawal transaction through the callUrl. For specific examples, See the trade callback interface for specific examples. |
| businessId | is | String | Business id must be ensured that this field is unique in the system. If it is duplicated, the withdrawal will not be received by the wallet. |
| memo | No | String | Please note that this field is optional for withdrawal applications for XRP and EOS and other types of coins are not filled in. |
3.2.2.3 Examples
{
"timestamp": 1535005047,
"nonce": 100000,
"sign": "6df1512ee650431632ce1541a6b064e1",
"body": "[{\"address\":\"raadSxrUhG5EQVCY75CSGaVLWCeXd6yH6s\",\"amount\":\"0.11\",\"merchantId\":\"100109\",\"mainCoinType\":\"144\",\"coinType\":\"144\",\"callUrl\":\"http://localhost:8080/callBack\",\"businessId\":\"15\",\"memo\":\"10112\"}]"
}
3.2.3 Return to status code
| code | Explain |
|---|
| 200 | Withdrawal success |
| 523 | The parameter is null |
| 581 | Invalid withdrawal amount |
| 4005 | Illegal parameters |
| 4014 | Coin type is null |
| 4034 | The coin information is not found |
| 4162 | Abnormal signature |
| 4163 | Wrong signature |
| 4169 | The merchant has been banned |
| 4183 | Abnormal arrival address |
| 4193 | EOS amount exceeds 4 decimal places in length |
| 4214 | No available coins now |
| 4226 | The merchant's general account is banned |
| 4261 | The merchant's administrator account is banned |
| 4284 | No merchant |
| 4288 | Business ID is duplicate. Please do not apply repeatedly |
| 4598 | All the merchant ID in the list passed into the body must be consistent |
| 4001 | No merchant |
| 4264 | The request IP is not on the whitelist. |
| B0001 | Invalid request body format. |
3.3.1 Success
{
"message":"SUCCESS",
"code":200
}
3.3.2 Failure
{
"code": "4101",
"message": "SIGN_MSG_ERROR"
}
4、Payment on behalf
4.1 Scenario description
Withdrawal. It works the same as the withdrawal interface. You can directly use the withdrawal interface, and this interface can be ignored.。
4.2 Interface details
4.2.1 Interface addresses
| Interface details | |
|---|
| URL | 【/mch/withdraw/proxypay】 |
| Application method | POST |
4.2.2 Parameters
4.2.2.1 Parameter description
[
{
"address":"raadSxrUhG5EQVCY75CSGaVLWCeXd6yH6s",
"amount":"0.1",
"merchantId":"100146",
"mainCoinType":"144",
"coinType":"144",
"callUrl":"http://localhost:8080/callBack",
"businessId":"571001",
"memo":"10112"
}
]
3.2.2.2 Body parameter description
| Body parameter name | Type | Required or not | Description |
|---|
| merchantId | String | is | Merchant ID |
| address | String | is | Withdrawal address |
| mainCoinType | String | is | Main coin number. Use the interface to get merchant coin information. |
| coinType | String | is | Child coin number. Use the interface to get merchant coin information. |
| amount | String | is | Trade amount |
| callUrl | String | is | Callback address. The results of withdrawal (review and transaction) will be notified through this callback address. For specific examples, See the trade callback interface for specific examples. |
| businessId | String | is | Business id must be ensured that this field is unique in the system. If it is duplicated, the withdrawal will not be received by the wallet. |
| memo | String | No | Please note that this field is optional for withdrawal applications for XRP and EOS and other types of coins are not filled in. |
4.2.2.2 Examples
{
"timestamp": 1535005047,
"nonce": 100000,
"sign": "e1bee3a417b9c606ba6cedda26db761a",
"body": "[{\"address\":\"raadSxrUhG5EQVCY75CSGaVLWCeXd6yH6s\",\"amount\":\"0.1\",\"merchantId\":\"100146\",\"mainCoinType\":\"144\",\"coinType\":\"144\",\"callUrl\":\"http://localhost:8080/callBack\",\"businessId\":\"571001\",\"memo\":\"10112\"}]"
}
4.2.3 Return to status code
| code | Explain |
|---|
| 200 | Success |
| 4005 | Illegal parameters |
| 4001 | No merchant |
| 4166 | The merchant has no configuration package |
| 4169 | The merchant has been banned |
| 4612 | Abnormal signature |
| 4163 | Wrong signature |
| 569 | Invalid address |
| 571 | Audit records already exist and will not be processed |
| 581 | Illegal withdrawal amount |
| 554 | The merchant does not support this coin |
| 4183 | Abnormal arrival address |
| 4193 | EOS amount exceeds 4 decimal places in length |
| 4214 | No available coins now |
| 4261 | The merchant's administrator account is banned |
| 4226 | The merchant's general account is banned |
| 4284 | No merchant |
| 4264 | The request IP is not on the whitelist. |
| B0001 | Invalid request body format. |
4.3 Call examples
4.3.1 Success
{
"message":"SUCCESS",
"code":200
}
4.3.2 Failure
{
"code": "4101",
"message": "SIGN_MSG_ERROR"
}
5、Trade callback interface
5.1 Scenario description
The gateway receives the transaction processing result and calls the callback interface provided by the merchant to notify the merchant of the specific change information. The interface gateway sends you the content of the callback address specified by you to process your business information. There are callbacks for deposit and withdrawal, of which up to two callbacks will be made for withdrawals (audit callback and transaction result callback)
5.2 Interface details
5.2.1 Interface addresses
| Interface details | |
|---|
| URL | Provided by the address generation interface or the withdrawal interface callUrl |
| Application method | POST / Form |
5.2.2 Parameters
5.2.2.1 Parameter description
{
"address":"DJY781Z8qbuJeuA7C3McYivbX8kmAUXPsW",
"amount":"12345678",
"blockHigh":"102419",
"coinType":"206",
"decimals":"8",
"fee":"452000",
"mainCoinType":"206",
"status":3,
"tradeId":"20181024175416907",
"tradeType":1,
"txId":"31689c332536b56a2246347e206fbed2d04d461a3d668c4c1de32a75a8d436f0",
"businessId":"",
"memo":""
}
4.2.2.2 Body parameter description
| Body parameter name | Type | Description |
|---|
| address | String | 地址 |
| amount | String | Trade amount. The actual amount is obtained according to the precision of the coins. The actual amount=amount/pow(10,decimals), that is, the actual amount is equal to amount divided by 10 decimals times |
| fee | String | Miner's fee. The actual amount is obtained according to the precision of the coins. The actual amount is obtained as above. |
| decimals | String | Coin precision |
| coinType | String | Child coin number. Use the interface to get merchant coin information. |
| mainCoinType | String | Main coin number. Use the interface to get merchant coin information. |
| businessId | String | Business number is passed in for the coin withdrawal request at the time of the coin withdrawal callback. No value for the coin withdrawal callback. |
| blockHigh | String | Block height |
| status | Integer | Status, see Callback interface status description |
| tradeId | String | Transaction serial number |
| tradeType | Integer | Transaction type, see Callback interface transaction type description |
| txid | String | Blockchain transaction hash |
| memo | String | Please note that XRP and EOS using the interface to obtain merchant coin information may have values for coin deposit and withdrawal. |
5.2.2.2 Examples
{
"timestamp": 1535005047,
"nonce": 100000,
"sign": "e1bee3a417b9c606ba6cedda26db761a",
"body": "{\"address\":\"DJY781Z8qbuJeuA7C3McYivbX8kmAUXPsW\",\"amount\":\"12345678\",\"blockHigh\":\"102419\",\"coinType\":\"206\",\"decimals\":\"8\",\"fee\":\"452000\",\"mainCoinType\":\"206\",\"status\":3,\"tradeId\":\"20181024175416907\",\"tradeType\":1,\"txId\":\"31689c332536b56a2246347e206fbed2d04d461a3d668c4c1de32a75a8d436f0\"}"
}
6、Verify address legality
6.1 Scenario description
Check the legality of the address. You can check the legality of the address first when adding addresses, withdrawing coins and other scenarios, see Verification rule
6.2 Interface details
6.2.1 Interface addresses
| Interface details | |
|---|
| URL | 【/mch/check/address】 |
| Application method | Post |
6.2.2 Parameters
6.2.2.1 Parameter description
| Parameters | Type | Required or not | Description | Note |
|---|
| timestamp | String | is | Timestamp | |
| nonce | String | is | Random number | |
| sign | String | is | Sign | |
| body | String | is | Message | json string, in the following format |
[
{
"merchantId": 200000,
"mainCoinType": "206",
"address": "DJY781Z8qbuJeuA7C3McYivbX8kmAUXPsW"
}
]
5.2.2.2 Body parameter description
| Body parameter name | Type | Required or not | Description |
|---|
| merchantId | Long | is | Merchant ID |
| mainCoinType | String | is | Main coin number. Use the interface to get merchant coin information. |
| address | String | is | Addresses to be verified |
6.2.2.3 Examples
{
"timestamp": 1535005047,
"nonce": 100000,
"sign": "e1bee3a417b9c606ba6cedda26db761a",
"body": "[{\"merchantId\":200000,\"mainCoinType\":\"206\",\"address\":\"DJY781Z8qbuJeuA7C3McYivbX8kmAUXPsW\"}]"
}
6.2.3 Return to status code
| code | Explain |
|---|
| 200 | Success |
| 4005 | Illegal parameters |
| 4162 | Abnormal signature |
| 4163 | Wrong signature |
| 4165 | Address is not legal |
| 4264 | The request IP is not on the whitelist. |
| B0001 | Invalid request body format. |
6.3 Call examples
6.3.1 Success
{
"code":200,
"message":"SUCCESS"
}
6.3.2 Failure
{
"code":4005,
"message":"PARAM_ERROR"
}
7、Obtain the information of tokens supported by merchants
7.1 Scenario description
Obtain the tokens supported by merchants and the balance
7.2 Interface details
7.2.1 Interface addresses
| Interface details | |
|---|
| URL | 【/mch/support-coins】 |
| Application method | POST |
7.2.2 Parameters
7.2.2.1 Parameter description
| Parameters | Type | Required or not | Description |
|---|
| timestamp | String | is | Timestamp |
| nonce | String | is | Random number |
| sign | String | is | Sign |
| body | String | is | Message |
6.2.2.2 Body parameter description
| Body parameter name | Type | Required or not | Description |
|---|
| merchantId | Long | is | Merchant ID |
| showBalance | Boolean | is | Whether to check the balance. False is not to get it and true is to get it. |
7.2.2.3 Examples
{
"timestamp": 1535005047,
"nonce": 100000,
"sign": "e1bee3a417b9c606ba6cedda26db761a",
"body": "{\"merchantId\":\"200032\",\"showBalance\":true}"
}
7.2.3 Return to status code
| Status code | Explain |
|---|
| -1 | Query failed |
| 200 | Query successfully |
| 4005 | Illegal parameters |
| 4264 | The request IP is not on the whitelist. |
| B0001 | Invalid request body format. |
7.3 Call examples
7.3.1 Success
{
"code": 200,
"message": "SUCCESS",
"data":[
{
"name": "BTC",
"coinName":"Bitcoin",
"symbol":"BTC",
"mainCoinType":"0",
"coinType":"0",
"decimals":"8",
"tokenStatus":"0",
"mainSymbol":"BTC",
"balance":"0",
"logo":""
},
{
"name": "ETH",
"coinName":"Ethereum",
"symbol":"ETH",
"mainCoinType":"60",
"coinType":"60",
"decimals":"18",
"tokenStatus":"0",
"mainSymbol":"ETH",
"balance":"0",
"logo":""
}
]
}
7.3.2 Failure
{
"code":4005,
"message":"BGS_ILLEGAL_PARAMETER"
}