NAV
go php js java

Withdraw

Withdrawal application

Request example:

POST <base_path>/v2/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>

{"user_id":"0","coin":"hc","address":"HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi","amount":"0.02","trade_id":"20200114202903274786"}

resp, err := client.Post("/v2/transfer", map[string]any{
    "user_id":  "0",
    "coin":     "hc",
    "address":  "HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi",
    "amount":   "0.02",
    "trade_id": "20200114202903274786",
})
$resp = $client->post('/v2/transfer', [
    'user_id' => '0',
    'coin' => 'hc',
    'address' => 'HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi',
    'amount' => '0.02',
    'trade_id' => '20200114202903274786',
]);
const resp = await client.post('/v2/transfer', {
  user_id: '0',
  coin: 'hc',
  address: 'HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi',
  amount: '0.02',
  trade_id: '20200114202903274786',
});
String resp = client.post("/v2/transfer", Map.of(
        "user_id", "0",
        "coin", "hc",
        "address", "HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi",
        "amount", "0.02",
        "trade_id", "20200114202903274786"));

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":"20200114005026028784" }, "date_time":"2020-01-14 00:50:27" }

The merchant initial a on-chain withdrawal request will use this API. In order to complete the withdrawl request, merchant need to prepare the callback API for risk control callback. ( Detail please refer to the Risk Control callback -> The second review of the withdrawal order)

HTTP Request

POST /v2/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
user_id No string user ID, composed of letters, numbers and underscores, within 40 characters in length
coin Yes string currency abbreviation - platform agreement shall prevail
amount Yes string withdrawal amount, an error will occur if it exceeds the range
address Yes string payment address, an error will occur if it exceeds the range
memo No string memo/tag needs to be filled in when the current currency is eos and its tokens
trade_id Yes string The unique ID of the merchant's transaction (recommended format: year, month, day, hour, minute, second + 6-digit random number case: 20200311202903000001)

Response Parameters

Parameter Type Description
status integer status code
msg string state description
data object
data.trade_id string Merchant-side transaction unique ID
date_time string response time
time_stamp integer unix timestamp in second

Withdrawal list

Request example:

POST <base_path>/v2/transfer/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>

{"page":1}
resp, err := client.Post("/v2/transfer/list", map[string]any{
    "page": 1,
})
$resp = $client->post('/v2/transfer/list', [
    'page' => 1,
]);
const resp = await client.post('/v2/transfer/list', {
  page: 1,
});
String resp = client.post("/v2/transfer/list", Map.of("page", 1));

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": 1,
    "list": [{
      "trade_id": "20200114202903274786",
      "coin": "hc",
      "chain": "hc",
      "txid": "",
      "amount": "0.02",
      "fee": "0",
      "total": "0.02",
      "address": "HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi",
      "from_address": "the transaction from address",
      "status": "2",
      "time": "1658482253",
      "type": "2",
      "gas_fee": "0.1"
    }]
  },
  "date_time": "2022-07-22 18:36:36",
  "time_stamp": 1658486196
}

You can query the status of an order through this interface, you can query only one, or you can query multiple ones vaguely.

HTTP Request

POST /v2/transfer/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
coin No string coin name, filters by 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 withdrawal, 2 waiting for risk control processing, 5 waiting for currency issuance, 10 review failed, 20 transfer 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 ~ 100), default 20
sort_num No integer default list sorting is ascanding order of record creation time ( 1 positive order; 2 reverse order)

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.coin string currency
data.list.txid string on-chain txid
data.list.amount string total amount
data.list.fee string handling fee (business rule fee is not on-chain gasfee), external deduction mode
data.list.total string Total withdrawal amount total = amount+fee
data.list.address string withdrawal transaction to address
data.list.from_address string withdrawal transaction from address, product environment return this field only for merchant, who created after 2025-01-22
data.list.chain string main chain coin name
data.list.memo string memo/tag will return this field when it is currently eos and its token
data.list.status string 0 pending review, 1 successful withdrawal, 2 waiting for risk control processing, 5 waiting for currency issuance, 10 review failed, 20 transfer failed
data.list.time string Status time, finally fixed at the time when status=1
data.list.type string 1 On-site transaction 2 On-chain transaction 5 Centralized withdrawal
data.list.gas_fee string gas fee, product environment return this field only for merchant, who created after 2024-08-14, the precision is 8 digits
date_time string response time
time_stamp integer unix timestamp in second

Withdrawal 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": {
    "trade_id": "20200114202903274786",
    "coin": "usdt_erc20",
    "chain": "eth",
    "txid": "0x735dc8becd0d5dc0023b526584b75c8772551fc9268668991608dadc69facb39",
    "address": "0x038B8E7406dED2Be112B6c7E4681Df5316957cad",
    "from_address": "0xf854AC319A546ae11e367ef80a203AaC923ca6A3",
    "amount": "10.1",
    "fee": "0",
    "total": "10.1",
    "status": 1,
    "msg": "success",
    "time": "1650011196",
    "type": 2,
    "gas_fee": "0.000105"
  }
}
http.HandleFunc("/notify/withdraw", 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/withdraw', 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/withdraw", 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"
  }
}

HTTP Request

POST: The specific callback URL 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 as follows
data.trade_id Yes string trade id
data.coin Yes string coin name
data.chain Yes string main chain coin name
data.txid Yes string txid
data.address Yes string withdrawal to address
data.from_address Yes string withdrawal from address, product environment return this field only for merchant, who created after 2025-01-22
data.time Yes string order last update time
data.amount Yes string withdrawal amount, the precision is 8 digits
data.fee Yes string handling fee, the precision is 8 digits
data.total Yes string total amount of withdrawal total=amount+fee, the precision is 8 digits
data.status Yes string Withdrawal status: 1 success;5 waiting confirm(txid generated but not confirm yet); 10 review failed; 20 transfer failed; other error codes (refer to the description of error codes)
data.msg Yes string state description
data.type Yes integer 1 on-site deposit 2 on-chain deposit
data.gas_fee No string gas fee, product environment return this field only for merchant, who created after 2024-08-14, the precision is 8 digits
data.refund_txid No string Sent for exchange refund payouts: the refund txid
data.tr_transfer_id No string Sent for Travel Rule compliant withdrawals: the Travel Rule transfer 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
Type Content Merchant Handling
Success Status=1 corresponding to trade_id Merchant can consider it to be successful
Change to 1 after success Rollback due to chain failure, txid changes. The trade_id and status remain unchanged The merchant side can consider it to be successful, just update the txid
Change to 2 after success The platform broadcast fails, the platform handles The merchant side can think it must be successful, just update the txid
Failure 1 Because the merchant gave the wrong address, the btc address was given to eth The platform does not deduct the money, which requires the merchant to re-request
Failure 2 Due to insufficient user balance The platform does not deduct money, which requires the merchant to re-request

To put it simply: Merchant-side errors cause failures, and merchants re-request for processing. Platform-side errors are handled by the platform. Orders are absolutely unique for platform processing. txid is subject to change.
* Asynchronous notification time point
The platform side executes and finds a client error, or the platform side determines the success or changes after the success.