Exchange
Redemption application
Request example:
POST <base_path>/v2/exchange/index HTTP/1.1
Host: api.xxxx.com
Content-Type: application/json
X-Cbc-App-Id: hxgmau9imt86qky9
X-Cbc-Key-Version: admin
X-Cbc-Timestamp: 1792382460
X-Cbc-Nonce: 7c1e9a3b5d7f9b1d3f5a7c9e1b3d5f7a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{"user_id":"28","source_coin":"eth","target_coin":"usdt","amount":"0.011","trade_id":"20200114202903274786","limit_price":"5","type":1,"max_time":5}
resp, err := client.Post("/v2/exchange/index", map[string]any{
"user_id": "28",
"source_coin": "eth",
"target_coin": "usdt",
"amount": "0.011",
"trade_id": "20200114202903274786",
"limit_price": "5",
"type": 1,
"max_time": 5,
})
$resp = $client->post('/v2/exchange/index', [
'user_id' => '28',
'source_coin' => 'eth',
'target_coin' => 'usdt',
'amount' => '0.011',
'trade_id' => '20200114202903274786',
'limit_price' => '5',
'type' => 1,
'max_time' => 5,
]);
const resp = await client.post('/v2/exchange/index', {
user_id: '28',
source_coin: 'eth',
target_coin: 'usdt',
amount: '0.011',
trade_id: '20200114202903274786',
limit_price: '5',
type: 1,
max_time: 5,
});
String resp = client.post("/v2/exchange/index", Map.of(
"user_id", "28",
"source_coin", "eth",
"target_coin", "usdt",
"amount", "0.011",
"trade_id", "20200114202903274786",
"limit_price", "5",
"type", 1,
"max_time", 5));
Example of return result:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Request-ID: 4bf92f3577b34da6a3ce929d0e0e4736
X-Cbc-Timestamp: 1792382461
X-Cbc-Nonce: 3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{
"status":200,
"msg":"Request succeeded",
"data":{
"trade_id":"2424sfshdrsfsf210"
},
"date_time":"2020-12-29 09:14:10",
"time_stamp":1609204450
}
Merchant initiates redemption and requests this interface.
HTTP Request
POST /v2/exchange/index
Request Parameters
For the common headers see Signature Regulations; the table below lists only the business parameters in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| user_id | No | string | Merchant user id (required for merchants with risk control enabled) |
| source_coin | Yes | string | exchange coin |
| target_coin | Yes | string | exchange target coin |
| amount | Yes | string | amount of currency exchanged |
| trade_id | Yes | string | Merchant-side transaction unique ID (up to 32 characters in length. Recommended format: year, month, day, hour, minute, second + 6-digit random number Case column: 20200311202903000001) |
| limit_price | No | string | limit price (if type=0, this field is required). The minimum exchange price when exchanging stable coins, or the maximum exchange price when exchanging virtual currency. |
| type | Yes | integer | exchange mode (1 closing mode / 0 general exchange), default 1. Generally, a pending order is placed under the condition that the minimum price is met. There may be some successes and some failures. If the exchange is not successful within a certain period of time, the order will be cancelled. The closing mode is that the order will be successfully placed, regardless of the impact of slippage, and will continue to try to place the order on the exchange regardless of the price. |
| max_time | No | integer | unit second - maximum redemption time - the redemption will be stopped if the redemption will be completed (the general mode only takes effect) |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| data.trade_id | string | trade_id - given by the merchant |
| date_time | string | Beijing time |
| time_stamp | string | response time in seconds |
- The return of this interface is only successful, but it does not mean that the exchange is successful. The processing result is subject to the data returned by the notification interface.
Exchange account recharge
Request example:
POST <base_path>/v2/exchange/transfer HTTP/1.1
Host: api.xxxx.com
Content-Type: application/json
X-Cbc-App-Id: hxgmau9imt86qky9
X-Cbc-Key-Version: admin
X-Cbc-Timestamp: 1792382460
X-Cbc-Nonce: 7c1e9a3b5d7f9b1d3f5a7c9e1b3d5f7a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{"coin":"usdt_erc20","exchange_coin":"usdt","amount":"10"}
resp, err := client.Post("/v2/exchange/transfer", map[string]any{
"coin": "usdt_erc20",
"exchange_coin": "usdt",
"amount": "10",
})
$resp = $client->post('/v2/exchange/transfer', [
'coin' => 'usdt_erc20',
'exchange_coin' => 'usdt',
'amount' => '10',
]);
const resp = await client.post('/v2/exchange/transfer', {
coin: 'usdt_erc20',
exchange_coin: 'usdt',
amount: '10',
});
String resp = client.post("/v2/exchange/transfer", Map.of(
"coin", "usdt_erc20",
"exchange_coin", "usdt",
"amount", "10"));
Example of return result:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Request-ID: 4bf92f3577b34da6a3ce929d0e0e4736
X-Cbc-Timestamp: 1792382461
X-Cbc-Nonce: 3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{
"status": 200,
"msg": "Request succeeded",
"data": [],
"date_time": "2021-08-20 15:44:25",
"time_stamp": 1629445465
}
HTTP Request
POST /v2/exchange/transfer
Request Parameters
For the common headers see Signature Regulations; the table below lists only the business parameters in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| coin | Yes | string | hot wallet coin |
| exchange_coin | Yes | string | exchange account coin |
| amount | Yes | string | recharge amount |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| date_time | string | Beijing time |
| time_stamp | string | response time in seconds |
Exchange rate
Request example:
POST <base_path>/v2/rate/exchange HTTP/1.1
Host: api.xxxx.com
Content-Type: application/json
X-Cbc-App-Id: hxgmau9imt86qky9
X-Cbc-Key-Version: admin
X-Cbc-Timestamp: 1792382460
X-Cbc-Nonce: 7c1e9a3b5d7f9b1d3f5a7c9e1b3d5f7a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{"source_coin":"eth","target_coin":"usdt","amount":"10"}
resp, err := client.Post("/v2/rate/exchange", map[string]any{
"source_coin": "eth",
"target_coin": "usdt",
"amount": "10",
})
$resp = $client->post('/v2/rate/exchange', [
'source_coin' => 'eth',
'target_coin' => 'usdt',
'amount' => '10',
]);
const resp = await client.post('/v2/rate/exchange', {
source_coin: 'eth',
target_coin: 'usdt',
amount: '10',
});
String resp = client.post("/v2/rate/exchange", Map.of(
"source_coin", "eth",
"target_coin", "usdt",
"amount", "10"));
Example of return result:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Request-ID: 4bf92f3577b34da6a3ce929d0e0e4736
X-Cbc-Timestamp: 1792382461
X-Cbc-Nonce: 3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{
"status": 200,
"msg": "Request succeeded",
"data": {
"rate": "3233.688",
"max": "20",
"min": "15",
"source_unit": "4",
"base_coin": "usdt"
},
"date_time": "2021-08-20 15:44:25",
"time_stamp": 1629445465
}
Before exchanging, check the exchange rate.
HTTP Request
POST /v2/rate/exchange
Request Parameters
For the common headers see Signature Regulations; the table below lists only the business parameters in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| source_coin | Yes | string | exchange coin |
| target_coin | Yes | string | exchange target coin |
| amount | Yes | string | amount of currency exchanged |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| data.rate | string | The exchange rate of other currencies corresponding to usdt |
| data.max | string | The maximum number of coins that can be exchanged in a single transaction |
| data.min | string | The minimum supported single exchange quantity of the exchange currency |
| data.source_unit | integer | Supports the length of the decimal places of the exchange currency (a value such as 4 means that up to 4 decimal places are supported) |
| data.base_coin | string | Base currency, the trading area supports the currency as the base currency for the transaction price |
| date_time | string | Beijing time |
| time_stamp | string | response time in seconds |
Batch query exchange rate
Request example:
POST <base_path>/v2/rate/exchangeBatch HTTP/1.1
Host: api.xxxx.com
Content-Type: application/json
X-Cbc-App-Id: hxgmau9imt86qky9
X-Cbc-Key-Version: admin
X-Cbc-Timestamp: 1792382460
X-Cbc-Nonce: 7c1e9a3b5d7f9b1d3f5a7c9e1b3d5f7a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{}
resp, err := client.Post("/v2/rate/exchangeBatch", nil)
$resp = $client->post('/v2/rate/exchangeBatch');
const resp = await client.post('/v2/rate/exchangeBatch');
String resp = client.post("/v2/rate/exchangeBatch", Map.of());
Example of return result:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Request-ID: 4bf92f3577b34da6a3ce929d0e0e4736
X-Cbc-Timestamp: 1792382461
X-Cbc-Nonce: 3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{
"status": 200,
"msg": "Request succeeded",
"data": [
{
"source_coin": "eth",
"target_coin": "usdt",
"rate": 3198.707676,
"max": 0,
"min": 0,
"source_unit": 4,
"base_coin": "usdt"
},
{
"source_coin": "usdt",
"target_coin": "eth",
"rate": 3231.075,
"max": 20,
"min": 15,
"source_unit": 4,
"base_coin": "usdt"
}
],
"date_time": "2021-08-20 15:47:52",
"time_stamp": 1629445672
}
HTTP Request
POST /v2/rate/exchangeBatch
Request Parameters
This API has no business parameters; the request body is {}. For the common headers see Signature Regulations.
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| data.rate | string | The exchange rate of other currencies corresponding to usdt |
| data.max | string | The maximum number of coins that can be exchanged in a single transaction |
| data.min | string | The minimum supported single exchange quantity of the exchange currency |
| data.source_unit | integer | Supports the length of the decimal places of the exchange currency (a value such as 4 means that up to 4 decimal places are supported) |
| data.base_coin | string | Base currency, the trading area supports the currency as the base currency for the transaction price |
| data.source_coin | string | exchange coin |
| data.target_coin | string | target coin |
| date_time | string | Beijing time |
| time_stamp | string | response time in seconds |
Exchange balance query
Request example:
POST <base_path>/v2/balance/exchange HTTP/1.1
Host: api.xxxx.com
Content-Type: application/json
X-Cbc-App-Id: hxgmau9imt86qky9
X-Cbc-Key-Version: admin
X-Cbc-Timestamp: 1792382460
X-Cbc-Nonce: 7c1e9a3b5d7f9b1d3f5a7c9e1b3d5f7a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{"coin":"eth"}
resp, err := client.Post("/v2/balance/exchange", map[string]any{
"coin": "eth",
})
$resp = $client->post('/v2/balance/exchange', [
'coin' => 'eth',
]);
const resp = await client.post('/v2/balance/exchange', {
coin: 'eth',
});
String resp = client.post("/v2/balance/exchange", Map.of("coin", "eth"));
Example of return result:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Request-ID: 4bf92f3577b34da6a3ce929d0e0e4736
X-Cbc-Timestamp: 1792382461
X-Cbc-Nonce: 3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{
"status": 200,
"msg": "Request succeeded",
"data": [{
"coin": "eth",
"amount": 0,
"freeze_amount": 0,
"total": 0
}],
"date_time": "2022-07-22 20:18:01",
"time_stamp": 1658492281
}
Exchange account balance query interface, returns the exchange account balance of a single currency
HTTP Request
POST /v2/balance/exchange
Request Parameters
For the common headers see Signature Regulations; the table below lists only the business parameters in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| coin | No | string | Coin name within 20 characters, which is provided by the coin platform. If the parameter is empty, all coins will be returned |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| data.amount | number | available balance |
| data.freeze_amount | number | Freeze balance |
| data.total | number | frozen + available balance |
| date_time | string | Beijing time |
| time_stamp | string | response time in seconds |
Exchange transaction pair query
Request example:
POST <base_path>/v2/exchange/coin HTTP/1.1
Host: api.xxxx.com
Content-Type: application/json
X-Cbc-App-Id: hxgmau9imt86qky9
X-Cbc-Key-Version: admin
X-Cbc-Timestamp: 1792382460
X-Cbc-Nonce: 7c1e9a3b5d7f9b1d3f5a7c9e1b3d5f7a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{}
resp, err := client.Post("/v2/exchange/coin", nil)
$resp = $client->post('/v2/exchange/coin');
const resp = await client.post('/v2/exchange/coin');
String resp = client.post("/v2/exchange/coin", Map.of());
Example of return result:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Request-ID: 4bf92f3577b34da6a3ce929d0e0e4736
X-Cbc-Timestamp: 1792382461
X-Cbc-Nonce: 3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{
"status": 200,
"msg": "Processing successful",
"data": [
{
"source_coin": "eth",
"target_coin": "usdt",
"source_min_amount": "0",
"source_max_amount": "0",
"source_unit": "4",
"target_unit": "2"
},
{
"source_coin": "usdt_trc20",
"target_coin": "usdt",
"source_min_amount": "0",
"source_max_amount": "0",
"source_unit": "2",
"target_unit": "6"
}
],
"date_time": "2021-08-10 09:32:26",
"time_stamp": 1628559146
}
Query supported exchange currencies
HTTP Request
POST /v2/exchange/coin
Request Parameters
This API has no business parameters; the request body is {}. For the common headers see Signature Regulations.
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| data.source_coin | string | source currency |
| data.target_coin | string | target currency |
| data.source_min_amount | string | The minimum supported single exchange amount of the exchange currency |
| data.source_max_amount | string | The maximum supported single exchange amount of the exchange currency |
| data.source_unit | string | Supports the length of decimal places for exchange currency (a value such as 4 means that up to 4 decimal places are supported) |
| data.target_unit | string | Supports the length of the decimal places of the target currency (a value such as 4 means that up to 4 decimal places are supported) |
| date_time | string | Beijing time |
| time_stamp | string | response time in seconds |
Exchange list query
Request example:
POST <base_path>/v2/exchange/list HTTP/1.1
Host: api.xxxx.com
Content-Type: application/json
X-Cbc-App-Id: hxgmau9imt86qky9
X-Cbc-Key-Version: admin
X-Cbc-Timestamp: 1792382460
X-Cbc-Nonce: 7c1e9a3b5d7f9b1d3f5a7c9e1b3d5f7a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{"source_coin":"eth","target_coin":"usdt","start_time":1587004987,"end_time":1599616679,"status":1,"page":1,"page_size":20}
resp, err := client.Post("/v2/exchange/list", map[string]any{
"source_coin": "eth",
"target_coin": "usdt",
"start_time": 1587004987,
"end_time": 1599616679,
"status": 1,
"page": 1,
"page_size": 20,
})
$resp = $client->post('/v2/exchange/list', [
'source_coin' => 'eth',
'target_coin' => 'usdt',
'start_time' => 1587004987,
'end_time' => 1599616679,
'status' => 1,
'page' => 1,
'page_size' => 20,
]);
const resp = await client.post('/v2/exchange/list', {
source_coin: 'eth',
target_coin: 'usdt',
start_time: 1587004987,
end_time: 1599616679,
status: 1,
page: 1,
page_size: 20,
});
String resp = client.post("/v2/exchange/list", Map.of(
"source_coin", "eth",
"target_coin", "usdt",
"start_time", 1587004987,
"end_time", 1599616679,
"status", 1,
"page", 1,
"page_size", 20));
Example of return result:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Request-ID: 4bf92f3577b34da6a3ce929d0e0e4736
X-Cbc-Timestamp: 1792382461
X-Cbc-Nonce: 3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{
"status": 200,
"msg": "Processing successful",
"data": {
"page": 1,
"max_page": 1,
"count": 4,
"list": [
{
"order_id": "20210811162504870081",
"trade_id": "2424sfshdrsfsf211wqe11",
"user_id": "1001",
"source_coin": "eth",
"target_coin": "usdt",
"source_amount": "0.1234",
"source_success_amount": "0",
"source_failed_amount": "0",
"target_amount": "0",
"limit_price": "3.4",
"type": "1",
"exchange_fee": "0",
"exchange_rate": "0",
"status": "2",
"time": "1629252807"
},
{
"order_id": "20210811162442276466",
"trade_id": "2424sfshdrsfsf211wqe1",
"user_id": "1002",
"source_coin": "eth",
"target_coin": "usdt",
"source_amount": "0.1234",
"source_success_amount": "0",
"source_failed_amount": "0",
"target_amount": "0",
"limit_price": "3.4",
"type": "1",
"exchange_fee": "0",
"exchange_rate": "0",
"status": "2",
"time": "1628670282"
}
]
},
"date_time": "2021-08-18 17:11:54",
"time_stamp": 1629277914
}
Exchange account balance query
Investigate and deal with exchange order status interface, support multi-dimensional query
HTTP Request
POST /v2/exchange/list
Request Parameters
For the common headers see Signature Regulations; the table below lists only the business parameters in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| trade_id | No | string | If the trade_id is passed as exact search, the following parameters will be invalid |
| source_coin | No | string | exchange coin |
| target_coin | No | string | exchange target coin |
| page | No | integer | 1<= N <=Max, take Max if it exceeds Max, return 1 if it is less than 1 or if no parameter is passed |
| status | No | integer | 0 pending review 1 successful exchange, 5 approved, 10 failed, 20 failed |
| start_time | No | integer | start time (creation time) format: timestamp |
| end_time | No | integer | end time (creation time) format: timestamp |
| page_size | No | integer | number of pages per page (20 ~ 500), default 20 |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| data.page | integer | page number |
| data.count | integer | number of records on this page |
| data.list | array | specific record |
| data.list.trade_id | string | trade id |
| data.list.source_coin | string | exchange coin |
| data.list.target_coin | string | Exchange target coin |
| data.list.source_amount | string | Amount of currency exchanged |
| data.list.target_amount | string | The amount of target currency to exchange |
| data.list.limit_price | string | limit price |
| data.list.type | string | Exchange mode (0 general exchange / 1 closing mode) |
| data.list.exchange_fee | string | Exchange fee (unit: target currency) |
| data.list.status | string | Order status: 0 pending approval, 1 exchange completed, 2 pending, 5 approved, 10 approved, 20 failed transfer |
| data.list.time | string | Status time, finally fixed at the time when status=1 |
| data.list.order_id | string | order id |
| data.list.exchange_rate | string | Exchange rate (average transaction price) |
| data.list.source_success_amount | string | The actual exchange amount of the exchange currency (there are partial exchanges in the general exchange mode) |
| data.list.source_failed_amount | string | The amount of exchange failed to exchange currency (the system will automatically return it to the exchange account) |
| data.list.user_id | string | User ID |
| date_time | string | Beijing time |
| time_stamp | string | response time in seconds |
Redeem callback notification
Notification request example:
POST <callback URL provided by the merchant>
Content-Type: application/json
X-Cbc-Timestamp: 1792382460
X-Cbc-Nonce: 9f2c4e6a8b0d1f3e5a7c9e1b3d5f7a9c
X-Cbc-Sign-Alg: RSA-SHA256
X-Cbc-Signature: <base64>
{
"data": {
"trade_id": "20200114202903274786",
"order_id": "2020010211153423123456",
"user_id": "1",
"source_coin": "eth",
"target_coin": "usdt",
"source_amount": "10",
"source_success_amount": "10",
"source_failed_amount": "0",
"target_amount": "25000",
"exchange_rate": "2500",
"exchange_fee": "1",
"limit_price": "0",
"type": "1",
"status": 1,
"time": 1650011196
}
}
http.HandleFunc("/notify/exchange", func(w http.ResponseWriter, r *http.Request) {
body, _ := io.ReadAll(r.Body)
if err := cbc.VerifyBody(r.Header, body, client.PlatformKey, true); err != nil {
http.Error(w, "invalid signature", http.StatusUnauthorized)
return
}
// Signature verified: de-duplicate by X-Cbc-Nonce, then parse the body and handle data
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(`{"status":200,"data":{"success_data":"success"}}`))
})
$body = file_get_contents('php://input');
$headers = array_change_key_case(getallheaders(), CASE_LOWER);
try {
CbcClient::verifyBody($headers, $body, $platformPublicKeyPem, true);
} catch (RuntimeException $e) {
http_response_code(401);
exit;
}
// Signature verified: de-duplicate by X-Cbc-Nonce, then parse the body and handle data
$notify = json_decode($body, true);
header('Content-Type: application/json');
echo '{"status":200,"data":{"success_data":"success"}}';
app.post('/notify/exchange', express.raw({ type: 'application/json' }), (req, res) => {
try {
verifyBody((name) => req.get(name), req.body, platformPublicKeyPem, true);
} catch (e) {
return res.status(401).end();
}
// Signature verified: de-duplicate by X-Cbc-Nonce, then parse the body and handle data
const notify = JSON.parse(req.body);
res.type('application/json').send('{"status":200,"data":{"success_data":"success"}}');
});
@PostMapping(value = "/notify/exchange", produces = "application/json")
public ResponseEntity<String> notify(@RequestHeader HttpHeaders headers, @RequestBody byte[] body) {
Map<String, String> sig = new HashMap<>();
for (String name : new String[]{"X-Cbc-Timestamp", "X-Cbc-Nonce", "X-Cbc-Sign-Alg", "X-Cbc-Signature"}) {
sig.put(name, headers.getFirst(name));
}
try {
CbcClient.verifyBody(sig, body, platformKey, true);
} catch (Exception e) {
return ResponseEntity.status(401).build();
}
// Signature verified: de-duplicate by X-Cbc-Nonce, then parse the body and handle data
return ResponseEntity.ok("{\"status\":200,\"data\":{\"success_data\":\"success\"}}");
}
Merchant reply example:
{
"status": 200,
"data": {
"success_data": "success"
}
}
Exchange result notification (success/failure), a platform initiates a request, and the merchant responds
HTTP Request
POST: The specific callback address is provided by the merchant to the platform side
Request Parameters
For the request headers and the receiver verification steps see Notification and review signature. Verify the signature with the platform public key before parsing the body; the table below lists the fields in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| data | No | string | callback notification carries data structure |
| data.trade_id | Yes | string | Merchant trade order number |
| data.order_id | Yes | string | platform redemption order number |
| data.source_coin | Yes | string | exchange coin |
| data.target_coin | Yes | string | exchange target coin |
| data.source_amount | Yes | string | actual amount of currency exchanged |
| data.target_amount | Yes | string | amount of target currency exchanged for |
| data.exchange_rate | Yes | string | exchange rate (average transaction price) |
| data.exchange_fee | Yes | string | exchange fee (unit: target currency) |
| data.limit_price | Yes | string | limit price |
| data.type | Yes | string | exchange mode (0 general exchange / 1 closing mode) |
| data.status | Yes | string | Order status: 0 pending, 1 exchange completed, 2 pending, 5 approved, 10 approved, 20 failed transfer |
| data.time | Yes | integer | time of occurrence (timestamp) |
| data.source_success_amount | Yes | string | The actual exchange amount of the exchange currency (there are partial exchanges in the general exchange mode) |
| data.source_failed_amount | Yes | string | The amount of exchange failed to exchange currency (the system will automatically return it to the exchange account) |
| data.user_id | Yes | string | user id |
Response Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| status | Yes | integer | status code |
| data | Yes | object | returns the data object |
| data.success_data | Yes | string | success Received successfully |