Common parameters

0.1 Common parameters (parameters included in all API interfaces)

parameter type Required explain Example
merchantId Integer yes Merchant account, obtained from the user center 2000213
timestamp Integer yes Current timestamp 1732192125
nonce Integer yes Random number 121554
body String no Body is a business parameter, optional. After converting the business parameter array to JSON, use base64 encoding, as detailed in 0.2 YWJjZGVmZzEyMzQ1Njc4OTA=
sign String yes MD5 signature, signature rules see 0.3 2de03a66b9daf209687b98acce4cef81

0.2 Composition rules of business parameter body

The result obtained by converting business parameters into JSON strings and encoding them with base64. For example, after converting your business parameters to JSON, it is {"chainType": 160, "callUrl": "http: \/\/xxx. com \/ubao_callback. HTML"}. Encoding this JSON string with base64 yields the result: eyJtYWluQ29pblR5cGUiOjE2MCwiY2FsbFVybCI6Imh0dHA6XC9cL3h4eC5jb21cL3ViYW9fY2FsbGJhY2suaHRtbCJ9, which is the body. Value of

0.3 Signature rules

Connect the body The four strings api_key, nonce, and timestamp are concatenated in this order and converted to md5 to obtain the signature. Merchant ID and api_key, obtained from the user center

0.4 Return value

See Error codes

0.5 Asynchronous notification

0.5.1 Asynchronous notification signature verification and fields

Asynchronous notification, also provided by the body Nonce, timestamp, and sign constitute. The body is encoded using base64. Connect the body The api_key, nonce, and timestamp are connected in this order, and then encrypted with MD5 to obtain a signature. Compare this signature with the returned sign, and if it is consistent, the signature verification is successful. After decoding the body through base64, you can obtain a JSON string containing the notification content.

0.5.2 Asynchronous notificationtype

Asynchronous notifications are divided into three categories, all using the same callback address, which is the callback address filled in when generating the address. Distinguish with the callbackType field in the body. These three types are: recharge, withdrawal or transfer, and balance change. When act in the body=recharge, it indicates that this is a recharge notification, while the other two types are pushed.

1、create address

1.1 Scenario Description

Generate the address of the specified chain. To successfully generate the address, you need to first add this chain Debug ToolSDK

1.2 Interface address

/mch/address/create

1.3 bodyparameter

parameter type Required explain Example
chainType Integer yes Chain number 160
callUrl String yes Callback address, an address created through this interface, will notify you of future recharge information about this address through the callback address you specified http://xxx.com/ubao_callback.html
type Inegter no Type: 0 is receiving address, 2 is collection wallet, - 2 is Observe wallet. Default is 0 0

1.4 Return after success

{"code":200,"message":"SUCCESS","address":"TQcK2oKpeVAE1mvYEudYJHgCr47F5ba8hk","chainType":160}

1.5 Return after failure

See Error codes

2、Withdraw coins

2.1 Scenario Description

The withdrawal request can only be for collection wallets or collection wallets. Please use the collection function.

2.2 Interface address

/mch/withdraw

2.3 bodyparameter

parameter type Required explain Example
from String yes Withdrawal address 0xE27be41F25D66A05d1fBA4DeEF740921a5F26980
to String yes Delivery address 0xc9Da8e789Ee111b40DFf90805DfE000f303e2582
amount String yes Withdrawal amount 10.32
coinID Integer yes Currency number 1002
chainType Integer yes Main coin chain 170
order_sn String no Business number, this field will be returned as is, making it easier for you to identify the business 12345

2.4 Return after success

{"code":200,"message":"SUCCESS"}

2.5 Return after failure

See Error codes

3、Verify the legitimacy of the address

3.1 Scenario Description

If you are unsure if the address you submitted meets the requirements, you can first verify its legality

3.2 Interface address

/mch/address/check

3.3 bodyparameter

parameter type Required explain Example
chainType Integer yes Chain number, see at the end of this article 160
address String yes Address to be verified TWJQVNivkcvyAwbEuWPmZT9E5oZBC2dUXt

3.4 Return after success

{"code":200,"message":"SUCCESS"}

3.5 Return after failure

See Error codes

4、Add observation wallet

4.1 Scenario Description

Add an observation address for an external wallet

4.2 Interface address

/mch/address/add

4.3 bodyparameter

parameter type Required explain Example
chainType Integer yes Main Currency Type 170
address String yes Address 0xdac17f958d2ee523a2206206994597c13d831ec7
callUrl String yes Callback URL http://xxx.com/callback.html

4.4 Return after success

{"code":200,"message":"SUCCESS"}

4.5 Return after failure

See Error codes

5、Obtain currency information supported by merchants

5.1 Scenario Description

Obtain supported currencies from merchants

5.2 Interface address

/mch/coins

5.3 bodyparameter

5.4 Return after success

{"code":200,"message":"SUCCESS","coins":"[]"}

5.5 Return after failure

See Error codes

6、Collect to Collection Wallet

6.1 Scenario Description

Collect the balance from the collection wallet into the collection wallet

6.2 Interface address

/mch/address/pooling

6.3 bodyparameter

parameter type Required explain Example
coinID Integer yes Currency, see at the end of this article 1002
address String yes Address to be collected TWJQVNivkcvyAwbEuWPmZT9E5oZBC2dUXt

6.4 Return after success

{"code":200,"message":"SUCCESS"}

6.5 Return after failure

See Error codes

7、Verify address ownership

7.1 Scenario Description

In DAPP, after obtaining an address, it is also necessary to verify the ownership of the address to prevent logging in with an observation wallet. In similar situations, ownership verification is required.

7.2 Interface address

/mch/address/verify

7.3 bodyparameter

parameter type Required explain Example
address String yes Wallet address that needs to be verified 0xdd0 ...... 99Cb79
message String yes A random string is sufficient, it can be a random string xxx.com:user:1999-10-10 11:12:00
sign String yes The signature generated using the string above xxxxxxxxxxxxxxxxxxyyyyyyyyyyyyzzzzzzz
chainType Integer yes Chain type: See the bottom. 170 is a Binance (BSC) chain 170

7.4 Return after success

{"code":200,"message":"SUCCESS","result":"true"}

7.5 Return after failure

See Error codes

8、Asynchronous notification for coin recharge

8.1 Scenario Description

After UBAO detects that the receiving address has been recharged, it will notify the callback URL left by the address. The notification content is: nonce timestamp、sign、body. body requires base64 decoding Debug ToolSDK

8.3 bodyparameter

parameter type explain Example
callbackType String Recharge: recharge, Transfer: Withdrawal or transfer of funds, Balance: balance notification recharge
amount String Amount can be calculated based on accuracy to determine the true amount 98260
decimals Integer accuracy 6
address String Receiving address 0xc2132d05d31c914a87c6611c10748aeb04b58e8f
chainType Integer Chain type, see the end of this article 170
coinType String Token Contract Address, see the end of this article 0x55d398326f99059ff775485246999027b3197955
coinID Integer Currency number, see at the end of this article 1002
hash String Unique transaction HASH, please record and check, repeat callback with name 0x0000000xxxxx....
fromAddress String Payment address 0xc2132d05d31c914a87c6611c10748aeb04b58e8f
coinName String Coin name USDT

8.4 Return after success

SUCCESS

8.5 Return after failure

If your business processing is successful, please return SUCCESS. If your business processing fails, you can return FAIL or other values. If SUCCESS is not returned, UBAO will make another callback in 5, 15, and 30 minutes. If it fails three times, it will give up. If necessary, you can manually call back in the user center.

9、Asynchronous notification of withdrawal and transfer

9.1 Scenario Description

When you withdraw or transfer money (only through the collection wallet), After UBAO processing, it will notify you through the callback URL left by this collection wallet. body requires base64 decoding Debug ToolSDK

9.3 bodyparameter

parameter type explain Example
callbackType String Recharge: recharge, Transfer: Withdrawal or transfer of funds, Balance: balance notification transfer
result Integer 1: Success, 0: Failure 1
amount Long Transfer amount 1234
decimals Integer accuracy 18
coinID Integer Currency number, see at the end of this collection 1002
coinName String Coin name USDT
address String Transfer address 0xdac17f958d2ee523a2206206994597c13d831ec7
toAddress String Receiving address 0xdac17f958d2ee523a2206206994597c13d831ec7
coinType String Token Contract Address 0x55d398326f99059ff775485246999027b3197955
hash String Unique transaction HASH, please record and check, repeat callback with name 0x00000011111......
order_sn String The order number you passed in when you withdrew the coin, return it as is 123456
chain String Chain bsc
chainType String Chain type, see the end of this article 170
message String Return message, success or failure reason OK
tradeId Integer Unique transaction ID in UBAO 192201

9.4 Return after success

SUCCESS

9.5 Return after failure

If your business processing is successful, please return SUCCESS. If your business processing fails, you can return FAIL or other values. If SUCCESS is not returned, UBAO will make another callback in 5, 15, and 30 minutes. If it fails three times, it will give up. If necessary, you can manually call back in the user center.

10、Balance change notification

10.1 Scenario Description

When UBAO detects a change in balance, it will notify you of the change through the callback URL left at this address. body requires base64 decoding Debug ToolSDK

10.3 bodyparameter

parameter type explain Example
callbackType String Recharge: recharge, Transfer: Withdrawal or transfer of funds, Balance: balance notification balance
address String Wallet address 0x00033
amount Long Latest balance 3390
decimals Integer accuracy 18
coinID Integer Currency number, see below 1002
coinName String Coin name USDT
coinType String Token Contract Address 0x55d398326f99059ff775485246999027b3197955
chainType Integer Chain number, see below 170

10.4 Return after success

SUCCESS

10.5 Return after failure

If your business processing is successful, please return SUCCESS. If your business processing fails, you can return FAIL or other values. If SUCCESS is not returned, UBAO will make another callback in 5, 15, and 30 minutes. If it fails three times, it will give up. If necessary, you can manually call back in the user center.

Currency number

number Coin name Official name Chain number chain Token Contract Address
1001 BNB BNB 170 BSC
1002 USDT BEP20 BSC-USD 170 BSC 0x55d398326f99059ff775485246999027b3197955
1003 TRX TRX 160 TRON
1004 USDT TRC20 Tether USD 160 TRON TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
1005 ETH ETH 180 ETH
1006 USDT ERC20 USDT 180 ETH 0xdac17f958d2ee523a2206206994597c13d831ec7
1008 POL POL 190 Polygon
1009 USDT ERC20 (Pos)Tether USD 190 Polygon 0xc2132d05d31c914a87c6611c10748aeb04b58e8f
1010 USDC BEP20 Binance-Peg USD Coin 170 BSC 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d
1011 USDC TRC20 USD Coin 160 TRON TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8
1012 USDC ERC20 Token USDC 180 ETH 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48