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 |
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
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
See Error codes
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.
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.
Generate the address of the specified chain. To successfully generate the address, you need to first add this chain Debug Tool 、SDK
/mch/address/create
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 |
{"code":200,"message":"SUCCESS","address":"TQcK2oKpeVAE1mvYEudYJHgCr47F5ba8hk","chainType":160}
See Error codes
The withdrawal request can only be for collection wallets or collection wallets. Please use the collection function.
/mch/withdraw
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 |
{"code":200,"message":"SUCCESS"}
See Error codes
If you are unsure if the address you submitted meets the requirements, you can first verify its legality
/mch/address/check
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 |
{"code":200,"message":"SUCCESS"}
See Error codes
Add an observation address for an external wallet
/mch/address/add
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 |
{"code":200,"message":"SUCCESS"}
See Error codes
Obtain supported currencies from merchants
/mch/coins
{"code":200,"message":"SUCCESS","coins":"[]"}
See Error codes
Collect the balance from the collection wallet into the collection wallet
/mch/address/pooling
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 |
{"code":200,"message":"SUCCESS"}
See Error codes
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.
/mch/address/verify
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 |
{"code":200,"message":"SUCCESS","result":"true"}
See Error codes
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 Tool 、SDK
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 |
SUCCESS
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.
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 Tool 、SDK
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 |
SUCCESS
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.
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 Tool 、SDK
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 |
SUCCESS
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.
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 |