H5 Deposit
Create Order
Request example:
POST <base_path>/v2/h5Order/create 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>
{"merchant_order_id":"8MrxIV1lJd","amount":"0.0013","currency":"usd","return_url":"http://xxxx.com","success_url":"https://xxx.com/success.html","fail_url":"https://xxx.com/fail.html","hide_back":1,"lang":"en"}
resp, err := client.Post("/v2/h5Order/create", map[string]any{
"merchant_order_id": "8MrxIV1lJd",
"amount": "0.0013",
"currency": "usd",
"return_url": "http://xxxx.com",
"success_url": "https://xxx.com/success.html",
"fail_url": "https://xxx.com/fail.html",
"hide_back": 1,
"lang": "en",
})
$resp = $client->post('/v2/h5Order/create', [
'merchant_order_id' => '8MrxIV1lJd',
'amount' => '0.0013',
'currency' => 'usd',
'return_url' => 'http://xxxx.com',
'success_url' => 'https://xxx.com/success.html',
'fail_url' => 'https://xxx.com/fail.html',
'hide_back' => 1,
'lang' => 'en',
]);
const resp = await client.post('/v2/h5Order/create', {
merchant_order_id: '8MrxIV1lJd',
amount: '0.0013',
currency: 'usd',
return_url: 'http://xxxx.com',
success_url: 'https://xxx.com/success.html',
fail_url: 'https://xxx.com/fail.html',
hide_back: 1,
lang: 'en',
});
String resp = client.post("/v2/h5Order/create", Map.of(
"merchant_order_id", "8MrxIV1lJd",
"amount", "0.0013",
"currency", "usd",
"return_url", "http://xxxx.com",
"success_url", "https://xxx.com/success.html",
"fail_url", "https://xxx.com/fail.html",
"hide_back", 1,
"lang", "en"));
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":"success",
"data":{
"order_no":"BCTOTNI57P",
"merchant_order_id":"8MrxIV1lJd",
"amount":"0.0013",
"currency":"usd",
"status":0,
"created_at":1665659047,
"expires_at":1665660847,
"addresses":[
{
"coin":"usdt_erc20",
"address":"0x1708F6b16D5437730D410D983B8D0235c345433c",
"amount":"0.0013"
},
{
"coin":"usdt_trc20",
"address":"TKzqd9hTDgeeQcHf1RXiCuG6vPPFJK8BDP",
"amount":"0.0013"
}
],
"return_url":"https://xxx.com/pay",
"checkout_url":"http://api.xxxx.com/order/BCTOTNI57P?lang=en"
},
"date_time":"2022-10-13 19:04:07",
"time_stamp":1665659047
}
HTTP Request
POST /v2/h5Order/create
- The merchant identity comes from
X-Cbc-App-Id; do not sendapp_idin the body.
Request Parameters
For the common headers see Signature Regulations; the table below lists only the business parameters in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| merchant_order_id | Yes | string | merchant trade order number |
| amount | Yes | string | order amount |
| currency | No | string | fiat currency, default usd, support: usd, cny, hkd, rub, thb, etc. For more information, please consult customer service |
| return_url | No | string | the default jump link of the return button, with a lower priority than success_url / fail_url |
| success_url | No | string | return button to jump link when payment is successful, has higher priority than return_url |
| fail_url | No | string | return button to jump link when payment is abnormal, has higher priority than return_url |
| hide_back | No | integer | hide return button: 1 to hide, default 0 to display |
| lang | No | string | language “en”, “ko”, “zh” |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| data.order_no | string | platform order number |
| data.merchant_order_id | string | merchant trade order number |
| data.amount | string | order amount |
| data.currency | string | fiat currency |
| data.status | integer | 0 pending payment 1 completed 2 abnormal payment 10 cancelled |
| data.return_url | string | page jump return address |
| data.checkout_url | string | cashier address |
| data.expires_time | integer | order expiration time |
| data.create_time | integer | creation time |
| data.addresses | array | address information |
| data.addresses.coin | string | coin name |
| data.addresses.address | string | address |
| data.addresses.amount | string | amount payable in currency |
| date_time | string | Beijing time |
| time_stamp | integer | response time in seconds |
Cancel Order
Request example:
POST <base_path>/v2/h5Order/cancel 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>
{"order_no":"test123"}
resp, err := client.Post("/v2/h5Order/cancel", map[string]any{
"order_no": "test123",
})
$resp = $client->post('/v2/h5Order/cancel', [
'order_no' => 'test123',
]);
const resp = await client.post('/v2/h5Order/cancel', {
order_no: 'test123',
});
String resp = client.post("/v2/h5Order/cancel", Map.of("order_no", "test123"));
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": "success",
"data": [],
"date_time": "2020-11-23 16:51:51",
"time_stamp": 1606121511
}
HTTP Request
POST /v2/h5Order/cancel
Request Parameters
For the common headers see Signature Regulations; the table below lists only the business parameters in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| order_no | Yes | string | platform order number |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | status description |
| data | object | empty |
| date_time | string | Beijing time |
| time_stamp | integer | response time in seconds |
Order Details
Request example:
POST <base_path>/v2/h5Order/detail 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>
{"order_no":"JDYFJEEA7T"}
resp, err := client.Post("/v2/h5Order/detail", map[string]any{
"order_no": "JDYFJEEA7T",
})
$resp = $client->post('/v2/h5Order/detail', [
'order_no' => 'JDYFJEEA7T',
]);
const resp = await client.post('/v2/h5Order/detail', {
order_no: 'JDYFJEEA7T',
});
String resp = client.post("/v2/h5Order/detail", Map.of("order_no", "JDYFJEEA7T"));
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":"success",
"data":{
"order_no":"JDYFJEEA7T",
"merchant_order_id":"8MrxIV1lJd",
"amount":"0.0013",
"currency":"usd",
"status":1,
"created_at":1664360232,
"expires_at":1664362032,
"addresses":[
{
"coin":"usdt_erc20",
"address":"0x1708F6b16D5437730D410D983B8D0235c345433c",
"amount":"0.0013"
},
{
"coin":"usdt_trc20",
"address":"TKzqd9hTDgeeQcHf1RXiCuG6vPPFJK8BDP",
"amount":"0.0013"
}
],
"payments":[
{
"coin":"usdt_trc20",
"address":"TKzqd9hTDgeeQcHf1RXiCuG6vPPFJK8BDP",
"txid":"422a7eef6af75960efa3e204fee1e642caf0b7d25dccd2678d6ae4e086733096",
"amount":"0.0013",
"confirm_time":1664360357,
"status":1,
"check_status":0
}
],
"return_url":"https://xxx.com/pay"
},
"date_time":"2022-10-13 19:24:26",
"time_stamp":1665660266
}
HTTP Request
POST /v2/h5Order/detail
Request Parameters
For the common headers see Signature Regulations; the table below lists only the business parameters in the body.
| Parameter | Required | Type | Description |
|---|---|---|---|
| order_no | Yes | string | platform order number |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| status | integer | status code |
| msg | string | state description |
| data | object | |
| data.order_no | string | platform order number |
| data.merchant_order_id | string | merchant trade order number |
| data.amount | string | order amount |
| data.currency | string | fiat currency |
| data.status | integer | 0 pending payment 1 completed 2 abnormal payment 10 cancelled |
| data.return_url | string | return address |
| data.expires_time | integer | order expiration time |
| data.create_time | integer | creation time |
| data.addresses | object | |
| data.addresses.coin | string | coin name |
| data.addresses.address | string | address |
| data.addresses.amount | string | amount payable in currency |
| data.payments | object | |
| data.payments.coin | string | payment currency |
| data.payments.address | string | payment address |
| data.payments.txid | string | on-chain txid |
| data.payments.amount | string | payment amount |
| data.payments.confirm_time | integer | verify the time |
| data.payments.status | integer | 0 pending payment 1 completed 2 abnormal payment |
| data.payments.check_status | integer | Abnormal reason: 1001 The payment amount does not match 1002 Repeated payment for the completed order |
| date_time | string | Beijing time |
| time_stamp | integer | response time in seconds |
H5 Deposit result 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": {
"order_no": "2020010211153423123456",
"merchant_order_id": "ESIOqIfhKnY",
"status": 1,
"payments": [
{
"coin": "eth",
"address": "0x038B8E7406dED2Be112B6c7E4681Df5316957cad",
"txid": "0x735dc8becd0d5dc0023b526584b75c8772551fc9268668991608dadc69facb39",
"amount": "0.1",
"confirm_time": 1650011196,
"check_code": 0
}
]
}
}
http.HandleFunc("/notify/h5", 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/h5', 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/h5", 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"
}
}
H5 Deposit 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.order_no | Yes | string | platform order number |
| data.merchant_order_id | Yes | string | merchant trade order number |
| data.status | Yes | integer | 0 pending payment 1 completed 2 abnormal payment 10 cancelled |
| data.payments | Yes | array | payment information |
| data.payments.coin | Yes | string | payment currency |
| data.payments.address | Yes | string | payment address |
| data.payments.txid | Yes | string | on-chain txid |
| data.payments.amount | Yes | string | payment amount |
| data.payments.confirm_time | Yes | integer | verify the time |
| data.payments.check_code | Yes | integer | Abnormal reason: 1001 The payment amount does not match 1002 Repeated payment for the completed order |
| data.received_amount | No | string | Total amount received. Sent when a payment tolerance is configured |
| data.within_tolerance | No | integer | 1 means the paid amount differs from the order amount but is within the tolerance and the order is treated as paid; otherwise 0. Sent when a payment tolerance is configured |
Response Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| status | Yes | integer | status code |
| data | Yes | object | |
| data.success_data | Yes | string | success |