Withdraw
Withdrawal application
$url = "http://api.xxxx.com/shopapi/transfer";
$header = [
'Content-Type:application/json',
];
$params = [
"app_id" => "hxgmau9imt86qky9",
"version" => "1.0",
"time" => 1579004943,
"user_id" => "0",
"coin" => "hc",
"address" => "HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi",
"amount" => "0.02",
"trade_id" => "20200114202903274786",
"sign" => "dLtK+uiPcnxt2ACKMbBqQ6wI5ttAvesOHzK5ybVID1R6hqYPDTkagl7Tsjr5iLJafehcSLTZyJLtCRI8O2CtIWQUUroGXBneHZC486NUi/4FMOQs0FaAgm17pWlbhX5/96cWXXXMVeoe3IZFKaFNYSWaA14v3RcdDU6QDE/9ixGiSJ0DIxm9NKA0+RkbIFbyYeuFn8d63OcjmUhv7tsOE6rKCc3Q2yi7Qe9i6BNAQFYMFATztb18MsxsBHKUxNqklqyVnl0ofETAHmQhfOHLmungOJQnOqAAuwfmRtg50Qci5F+R2mXeqjmIXko/u3E+DLYW1ygDBp3afKZmU4PwmA=="
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$return = curl_exec($ch);
print_r($return);
var url = "http://api.xxxx.com/shopapi/transfer"
data := map[string]interface{}{
"app_id":"hxgmau9imt86qky9",
"version":"1.0",
"time":"1579004943",
"user_id":"0",
"coin":"hc",
"address":"HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi",
"amount":"0.02",
"trade_id":"20200114202903274786",
"sign":"dLtK+uiPcnxt2ACKMbBqQ6wI5ttAvesOHzK5ybVID1R6hqYPDTkagl7Tsjr5iLJafehcSLTZyJLtCRI8O2CtIWQUUroGXBneHZC486NUi/4FMOQs0FaAgm17pWlbhX5/96cWXXXMVeoe3IZFKaFNYSWaA14v3RcdDU6QDE/9ixGiSJ0DIxm9NKA0+RkbIFbyYeuFn8d63OcjmUhv7tsOE6rKCc3Q2yi7Qe9i6BNAQFYMFATztb18MsxsBHKUxNqklqyVnl0ofETAHmQhfOHLmungOJQnOqAAuwfmRtg50Qci5F+R2mXeqjmIXko/u3E+DLYW1ygDBp3afKZmU4PwmA==",
}
dataType, _ := json.Marshal(data)
resp, err := http.Post(url, "application/json", strings.NewReader(string(dataType)))
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(body))
let HTTP = require('http')
let postData = {
"app_id":"hxgmau9imt86qky9",
"version":"1.0",
"time":"1579004943",
"user_id":"0",
"coin":"hc",
"address":"HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi",
"amount":"0.02",
"trade_id":"20200114202903274786",
"sign":"dLtK+uiPcnxt2ACKMbBqQ6wI5ttAvesOHzK5ybVID1R6hqYPDTkagl7Tsjr5iLJafehcSLTZyJLtCRI8O2CtIWQUUroGXBneHZC486NUi/4FMOQs0FaAgm17pWlbhX5/96cWXXXMVeoe3IZFKaFNYSWaA14v3RcdDU6QDE/9ixGiSJ0DIxm9NKA0+RkbIFbyYeuFn8d63OcjmUhv7tsOE6rKCc3Q2yi7Qe9i6BNAQFYMFATztb18MsxsBHKUxNqklqyVnl0ofETAHmQhfOHLmungOJQnOqAAuwfmRtg50Qci5F+R2mXeqjmIXko/u3E+DLYW1ygDBp3afKZmU4PwmA==",
};
let POST_OPTIONS = {
port: 80,
host: "api.xxxx.com",
path: "/shopapi/transfer",
method: 'POST',
headers: {
"Content-Type": "application/json; charset=utf-8"
}
};
const REQUEST = HTTP.request(POST_OPTIONS,function (res) {
let data = []
res.on('data', chunk => {
data.push(...chunk)
})
res.on('end', () => {
let _date = JSON.parse( new TextDecoder().decode(new Uint8Array(data)))
console.log(_date)
})
});
REQUEST.setTimeout(6000)
REQUEST.write(JSON.stringify(postData), 'utf8')
REQUEST.end()
public static void main(String[] args) {
// more detail functions, see "Signature Regulations"Java demo
String baseUrl = "http://api.xxxx.com/shopapi";
String priKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCtdgvcfozY7fe/x6UlXR/Fff8+wX++CiG05YVRafDe90O8y5KJAMZ156TgajEUXSRyKZqASz7iVoMAcu5FqfK1KuOOdjTAg0LFe/twIZvKmAqHcCSS2pjUXk0fTpZEgQ5lmDCK12Mg07YXvr+BeHjF+kBpwRJMPMG/+DGBDYNFNeRSJqWyopt6yyF528soAykHIUQ7TTultJV5IPCrvjRQQrGdJ/QtCdE0vZg+tA09nFN7AqgraU99kIvzyS0sqysj+pP1SJRmTRSGtlVAO3mILfkXOekZl1KD60G7CF+7BIaaW83FPD55tZhAGhnbLMYyiq7OiIyU61LTRcNSaJ0tAgMBAAECggEBAIGgGKcSzxCBbMYdXLV6TPbZ/HeaRGrwyVWUu7cmc0E8CJu6iWvmb2jGzbiCwuCT5luF6ZZ8JKchvU4FlTfsE5r9TQY2IZ/Ht4s65qBaDUEts5iY3kv8HX9+ZSXDJZpV0ztqqsPmx4ZNj+NYwWXwcFiKdb5R8OmV8bgSsnPddD6wFhwewglUOBPRAjropHE4sqk1Vam6q1MlFq5kiekMn/CItyFYFFzST/ruqAtVTp7YIvazAMrfCKH+pvXWk6pYNHZmL/JZey0GglRyJ1nItiqL33X8Lji056FcbAclidq022h/KPLEJpZk6irWqYdqYZeF6YMLHtdZFDkTZ/hXY+UCgYEA5i794UTQ1Kd6K+iui/S8K5H8nGdiXb3+uZ5j5VKYfbRmzXhAdVYisYe8czeTECxhH+MeHgM4tLR4ifx9q60ylvZxl9Fav1p6EaE36YcvGVmpm7Gm3q6QDDBa4gB+X9u7CxCS4LpotV917YS1QvOIF9lnRonSj1zNzFtbXkywrN8CgYEAwOpx/mR40ZvgZxNCq9DsIdrSZYAFFKpw0xy0OtF1PpuwMaREoRabnlVw6Bb3Hofg50XA3JxemzAX6fB92ee+NfXfeL4UtC4vG1K9JyiXHtHq8p9Uw2W03ehIEeNa3xdoRRnLmD4VUpyfL19ViE2+7TM1Gd3TogjDT+AMOCSuq3MCgYBsurPH7gaq/LVT+mRAzgj4l8v4YUlwuGeTbIMJdvt7HXUWB4CDLH3U2CYnUpAQKrZyJok6ahEmIr1xiKggKP7lmmHL8eNo0icpHrtXfzi7Q8Q/PCpzs4dtioXTjaIkS5nNvzVyG/uL+RyuZmpsxrZ5dYM4KbAhchfwORMutxEZhwKBgQC5zpVw4jCEItBmNuTWO+nTScGvxTgfiXIVw+XLaQa2AJoZlhAL34yPWdffko79tv3lgweY9HsimZXO2rU8dbp8mo5c6ydhy8HPXUeWOcAkDSdv/ApWENW9jgYsRIC3swHY3Fl+Dv3Wjce8huQI3mjwaYvRmBhIToxfmHnscVhTBQKBgB9uciEHfz8hMI7ePrPo2PkyK/RbJDm3HnuWE2lFBp7MOUMlh53MXwv4dIRaYMbRrFuN1UIKEFxuKhWwTHSzZJufk/UENrha/81fpj2BoFsAKkEunKeETvaIh6fZSjec16h2+zxbzwkdS6b+yIYkSlaoAxmDYrMtae0C8G4e0YS9";
String pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2RZZISModRzproL3eTxRtvVK/nToDbeLmAVdmaVtHgNCwjXMeNCZvHySZKO7+t7XySzBd2PhhQjvAkDd8HRKB5Y0uvP6TFwvhxOMkMydTeBFcUobQWNeAI7ttRms1txSNrmyrZr0WpWfk79VIsO+yI/jFN/Pj2gxD+vh5UUKU1LD2IQq/VxgtEpf8Vs6w7SvafPwYkpdPGCKUFkRvN1FrY2+tq0j1MRVJbB2rIunWDnT8cDUh2sWLXf4yNaJVOaaTFB0zbAk/qcoicGQyW7bVG7dVW8WywKmOAPeQCCQa+SJ4BhfI1k8eEAwFVRuxz/f9Ecfog9hZJ+RgELkpS8qhQIDAQAB";
rsaSigner signer = new rsaSigner();
Map<String, Object> params = new HashMap<>();
params.put("app_id", "hxgmau9imt86qky9");
params.put("version", "1.0");
params.put("key_version", "admin");
params.put("time", Long.toString(System.currentTimeMillis() / 1000));
params.put("user_id", "1");
params.put("coin", "hc");
params.put("address", "HsRDEePh7WBCsdJPfo1UsjfurwLBU6HD5Vi");
params.put("amount", "0.02");
params.put("trade_id", "20200114202903274786");
try {
params.put("sign", signer.genSign(params, priKey));
Gson gson = new GsonBuilder().create();
System.out.println("params = " + gson.toJson(params));
String res = doPost(baseUrl + "/transfer", gson.toJson(params));
if (null == res) {
throw new RuntimeException("http error");
}
System.out.println("response = " + res);
JsonParser jp = new JsonParser();
JsonObject resEle = jp.parse(res).getAsJsonObject();
boolean retSignOK = signer.verifySign(resEle, resEle.get("sign").getAsString(), pubKey);
if (!retSignOK) {
throw new RuntimeException("verify response sign fail");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("OK");
}
Example of return result:
{
"status":200,
"msg":"Request succeeded",
"data":{
"trade_id":"20200114005026028784"
},
"date_time":"2020-01-14 00:50:27",
"sign":"ib1gqr0E0gJ02yo3InXKcKGaPqIp+r1izMego+KMRvE0B4ZdkFGrLmOtxGStUBibGVMzJRGWppKyU4PzcK877AOEvQlSFiUI+hDL1z8WaZsWD3r3ykbPzU0uWo4U+6WQTpOEo1gJ/N2FlAgwgzJsd
}
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)
POST: /transfer
request parameters
| parameter name | required | type | description |
|---|---|---|---|
| common parameter | yes | string | common parameter refers to: signature (sign), version (version), merchant ID (app_id), time (time) |
| 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 parameter description
| parameter name | type | description |
|---|---|---|
| status | int | status code |
| msg | string | state description |
| data | jsonObject | |
| data.trade_id | string | Merchant-side transaction unique ID |
| date_time | string | response time |
| time_stamp | int | unix timestamp in second |
| sign | string | signature |
- Remark: This api is for submit the withdrawal request, having the result of successfully is only mean the withdraw request is received. The final withdrawal request result will use the withdrawal request callback API to notify the merchant. For more return error codes, please see the error code description on the home page.
Withdrawal list
$url = "http://api.xxxx.com/shopapi/transfer/list";
$header = [
'Content-Type:application/json',
];
$params = [
"version" => "1.0",
"app_id" => "hxgmau9imt86qky9",
"time" => "1578736053",
"page" => 1,
"sign" => "dLtK+uiPcnxt2ACKMbBqQ6wI5ttAvesOHzK5ybVID1R6hqYPDTkagl7Tsjr5iLJafehcSLTZyJLtCRI8O2CtIWQUUroGXBneHZC486NUi/4FMOQs0FaAgm17pWlbhX5/96cWXXXMVeoe3IZFKaFNYSWaA14v3RcdDU6QDE/9ixGiSJ0DIxm9NKA0+RkbIFbyYeuFn8d63OcjmUhv7tsOE6rKCc3Q2yi7Qe9i6BNAQFYMFATztb18MsxsBHKUxNqklqyVnl0ofETAHmQhfOHLmungOJQnOqAAuwfmRtg50Qci5F+R2mXeqjmIXko/u3E+DLYW1ygDBp3afKZmU4PwmA=="
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$return = curl_exec($ch);
print_r($return);
var url = "http://api.xxxx.com/shopapi/transfer/list"
data := map[string]string{
"version": "1.0",
"app_id": "hxgmau9imt86qky9",
"time": "1578736053",
"page": "1",
"sign": "OTA8utI8y8G93p7RPCyb4qIilFQ0B4Aq4iUjhaXWK9m2kgektqlHOASDKXT2VE7NPNysrGycYlVfjDR2WGZn1G66phHo3qa9CcCNpG9klOBEuBEMjiVbb/d8AXcxEzvQr9OCwNsikyxonyzLiY/lsNHeGm9cC5eRvlNLdUSVBipH+ajPd0lDHCayZPs1eCMfbm/xnf8e2lfy6z0UPOpHGfyX/0+hz99Ir5Xnx+0sBBzyZZJxKm4ROid5aDv/9m9guILpURae+Yw/IrkYF4uAKGX+/44cBvtTRQSdX76CAOBSiywZa6BAgDYBLRtkAPM+i+vwNzFBovqHUvI+4Ponaw==",
}
dataType, _ := json.Marshal(data)
resp, err := http.Post(url, "application/json", strings.NewReader(string(dataType)))
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(body))
let HTTP = require('http')
let postData = {
"version": "1.0",
"app_id": "hxgmau9imt86qky9",
"time": "1578736053",
"page": "1",
"sign": "OTA8utI8y8G93p7RPCyb4qIilFQ0B4Aq4iUjhaXWK9m2kgektqlHOASDKXT2VE7NPNysrGycYlVfjDR2WGZn1G66phHo3qa9CcCNpG9klOBEuBEMjiVbb/d8AXcxEzvQr9OCwNsikyxonyzLiY/lsNHeGm9cC5eRvlNLdUSVBipH+ajPd0lDHCayZPs1eCMfbm/xnf8e2lfy6z0UPOpHGfyX/0+hz99Ir5Xnx+0sBBzyZZJxKm4ROid5aDv/9m9guILpURae+Yw/IrkYF4uAKGX+/44cBvtTRQSdX76CAOBSiywZa6BAgDYBLRtkAPM+i+vwNzFBovqHUvI+4Ponaw==",
};
let POST_OPTIONS = {
port: 80,
host: "api.xxxx.com",
path: "/shopapi/transfer/list",
method: 'POST',
headers: {
"Content-Type": "application/json; charset=utf-8"
}
};
const REQUEST = HTTP.request(POST_OPTIONS,function (res) {
let data = []
res.on('data', chunk => {
data.push(...chunk)
})
res.on('end', () => {
let _date = JSON.parse( new TextDecoder().decode(new Uint8Array(data)))
console.log(_date)
})
});
REQUEST.setTimeout(6000)
REQUEST.write(JSON.stringify(postData), 'utf8')
REQUEST.end()
public static void main(String[] args) {
// more detail functions, see "Signature Regulations"Java demo
String baseUrl = "http://api.xxxx.com/shopapi";
String priKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCtdgvcfozY7fe/x6UlXR/Fff8+wX++CiG05YVRafDe90O8y5KJAMZ156TgajEUXSRyKZqASz7iVoMAcu5FqfK1KuOOdjTAg0LFe/twIZvKmAqHcCSS2pjUXk0fTpZEgQ5lmDCK12Mg07YXvr+BeHjF+kBpwRJMPMG/+DGBDYNFNeRSJqWyopt6yyF528soAykHIUQ7TTultJV5IPCrvjRQQrGdJ/QtCdE0vZg+tA09nFN7AqgraU99kIvzyS0sqysj+pP1SJRmTRSGtlVAO3mILfkXOekZl1KD60G7CF+7BIaaW83FPD55tZhAGhnbLMYyiq7OiIyU61LTRcNSaJ0tAgMBAAECggEBAIGgGKcSzxCBbMYdXLV6TPbZ/HeaRGrwyVWUu7cmc0E8CJu6iWvmb2jGzbiCwuCT5luF6ZZ8JKchvU4FlTfsE5r9TQY2IZ/Ht4s65qBaDUEts5iY3kv8HX9+ZSXDJZpV0ztqqsPmx4ZNj+NYwWXwcFiKdb5R8OmV8bgSsnPddD6wFhwewglUOBPRAjropHE4sqk1Vam6q1MlFq5kiekMn/CItyFYFFzST/ruqAtVTp7YIvazAMrfCKH+pvXWk6pYNHZmL/JZey0GglRyJ1nItiqL33X8Lji056FcbAclidq022h/KPLEJpZk6irWqYdqYZeF6YMLHtdZFDkTZ/hXY+UCgYEA5i794UTQ1Kd6K+iui/S8K5H8nGdiXb3+uZ5j5VKYfbRmzXhAdVYisYe8czeTECxhH+MeHgM4tLR4ifx9q60ylvZxl9Fav1p6EaE36YcvGVmpm7Gm3q6QDDBa4gB+X9u7CxCS4LpotV917YS1QvOIF9lnRonSj1zNzFtbXkywrN8CgYEAwOpx/mR40ZvgZxNCq9DsIdrSZYAFFKpw0xy0OtF1PpuwMaREoRabnlVw6Bb3Hofg50XA3JxemzAX6fB92ee+NfXfeL4UtC4vG1K9JyiXHtHq8p9Uw2W03ehIEeNa3xdoRRnLmD4VUpyfL19ViE2+7TM1Gd3TogjDT+AMOCSuq3MCgYBsurPH7gaq/LVT+mRAzgj4l8v4YUlwuGeTbIMJdvt7HXUWB4CDLH3U2CYnUpAQKrZyJok6ahEmIr1xiKggKP7lmmHL8eNo0icpHrtXfzi7Q8Q/PCpzs4dtioXTjaIkS5nNvzVyG/uL+RyuZmpsxrZ5dYM4KbAhchfwORMutxEZhwKBgQC5zpVw4jCEItBmNuTWO+nTScGvxTgfiXIVw+XLaQa2AJoZlhAL34yPWdffko79tv3lgweY9HsimZXO2rU8dbp8mo5c6ydhy8HPXUeWOcAkDSdv/ApWENW9jgYsRIC3swHY3Fl+Dv3Wjce8huQI3mjwaYvRmBhIToxfmHnscVhTBQKBgB9uciEHfz8hMI7ePrPo2PkyK/RbJDm3HnuWE2lFBp7MOUMlh53MXwv4dIRaYMbRrFuN1UIKEFxuKhWwTHSzZJufk/UENrha/81fpj2BoFsAKkEunKeETvaIh6fZSjec16h2+zxbzwkdS6b+yIYkSlaoAxmDYrMtae0C8G4e0YS9";
String pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2RZZISModRzproL3eTxRtvVK/nToDbeLmAVdmaVtHgNCwjXMeNCZvHySZKO7+t7XySzBd2PhhQjvAkDd8HRKB5Y0uvP6TFwvhxOMkMydTeBFcUobQWNeAI7ttRms1txSNrmyrZr0WpWfk79VIsO+yI/jFN/Pj2gxD+vh5UUKU1LD2IQq/VxgtEpf8Vs6w7SvafPwYkpdPGCKUFkRvN1FrY2+tq0j1MRVJbB2rIunWDnT8cDUh2sWLXf4yNaJVOaaTFB0zbAk/qcoicGQyW7bVG7dVW8WywKmOAPeQCCQa+SJ4BhfI1k8eEAwFVRuxz/f9Ecfog9hZJ+RgELkpS8qhQIDAQAB";
rsaSigner signer = new rsaSigner();
Map<String, Object> params = new HashMap<>();
params.put("app_id", "hxgmau9imt86qky9");
params.put("version", "1.0");
params.put("key_version", "admin");
params.put("time", Long.toString(System.currentTimeMillis() / 1000));
params.put("page", "1");
try {
params.put("sign", signer.genSign(params, priKey));
Gson gson = new GsonBuilder().create();
System.out.println("params = " + gson.toJson(params));
String res = doPost(baseUrl + "/transfer/list", gson.toJson(params));
if (null == res) {
throw new RuntimeException("http error");
}
System.out.println("response = " + res);
JsonParser jp = new JsonParser();
JsonObject resEle = jp.parse(res).getAsJsonObject();
boolean retSignOK = signer.verifySign(resEle, resEle.get("sign").getAsString(), pubKey);
if (!retSignOK) {
throw new RuntimeException("verify response sign fail");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("OK");
}
Example of return result:
{
"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,
"sign": "uuYWvmoMqM5xh7aTcxspJmW78y8op5BBjYXp0XoqcqFXe+HrSGzxN2Ls6LA7SlfsNndCtS4AX1/J+2o1MWZw/HFVfRqtxu02AEfWhM5ZSiJfEtO8f47H2/EGcsKw/eK8nxOnYAyAKwG6Ia6L4KgYIXLwsGt6Dt0VYWADu+vEQEes83/c6+Tc8QdqpdnLbs2XXXkYkl5eijoja+QEMaENbx+DHxnsVZV0iRK5FcSQH9PdOIpWmC944BA2v0tnPQWb6WDnOTsw5xoVKiL57WGIeOaxepvjo6poi1a/+HYrowT4IcejZZHi9YW0iM4eNm8MPK0tloAQ8GWY7kVs9uEwOA=="
}
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: /transfer/list
request parameters
| parameter name | required | type | description |
|---|---|---|---|
| common parameter | yes | string | common parameter refers to: signature (sign), version (version), merchant ID (app_id), time (time) |
| trade_id | No | string | If the trade_id is passed as exact search, the following parameters will be invalid |
| page | no | int | 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 | int | 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 | int | start time (creation time) format: timestamp |
| end_time | no | int | end time (creation time) format: timestamp |
| page_size | no | int | number of pages per page (20 ~ 100), default 20 |
| sort_num | no | int | default list sorting is ascanding order of record creation time ( 1 positive order; 2 reverse order) |
Response parameter description
| parameter name | type | description |
|---|---|---|
| status | int | status code |
| msg | string | state description |
| data | jsonObject | |
| data.page | int | page number |
| data.count | int | number of records on this page |
| data.list | jsonArray | 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 | enum | 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 | time_stamp | 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 | int | unix timestamp in second |
| sign | string | signature |
Withdrawal result callback notification
$url = "The withdrawal callback URL configured in the backend of the merchant";
$header = [
'Content-Type:application/json',
];
$params = [
"data" => [
"trade_id" => "this is trade_id",
"coin" => "eth",
"txid" => "this is txid",
"address" => "this is to address",
"from_address" => "this is from address",
"time" => "1591779242",
"amount" => "10.1",
"fee" => "0",
"total" => "10.1",
"status" => "1",
"msg" => "Prompt information",
"type" => 1,
"gas_fee" => "0.1",
],
"sign" => "dLtK+uiPcnxt2ACKMbBqQ6wI5ttAvesOHzK5ybVID1R6hqYPDTkagl7Tsjr5iLJafehcSLTZyJLtCRI8O2CtIWQUUroGXBneHZC486NUi/4FMOQs0FaAgm17pWlbhX5/96cWXXXMVeoe3IZFKaFNYSWaA14v3RcdDU6QDE/9ixGiSJ0DIxm9NKA0+RkbIFbyYeuFn8d63OcjmUhv7tsOE6rKCc3Q2yi7Qe9i6BNAQFYMFATztb18MsxsBHKUxNqklqyVnl0ofETAHmQhfOHLmungOJQnOqAAuwfmRtg50Qci5F+R2mXeqjmIXko/u3E+DLYW1ygDBp3afKZmU4PwmA=="
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$return = curl_exec($ch);
print_r($return);
var url = "The withdrawal callback URL configured in the backend of the merchant"
data := map[string]interface{}{
"data": map[string]string{
"trade_id":"this is trade_id",
"coin":"eth",
"txid":"this is txid",
"address":"this is to address",
"from_address":"this is from address",
"time":"1591779242",
"amount": "10.1",
"fee":"0",
"total":"10.1",
"status":"1",
"msg":"Prompt information",
"type":"1",
"gas_fee":"0.1",
},
"sign": "OTA8utI8y8G93p7RPCyb4qIilFQ0B4Aq4iUjhaXWK9m2kgektqlHOASDKXT2VE7NPNysrGycYlVfjDR2WGZn1G66phHo3qa9CcCNpG9klOBEuBEMjiVbb/d8AXcxEzvQr9OCwNsikyxonyzLiY/lsNHeGm9cC5eRvlNLdUSVBipH+ajPd0lDHCayZPs1eCMfbm/xnf8e2lfy6z0UPOpHGfyX/0+hz99Ir5Xnx+0sBBzyZZJxKm4ROid5aDv/9m9guILpURae+Yw/IrkYF4uAKGX+/44cBvtTRQSdX76CAOBSiywZa6BAgDYBLRtkAPM+i+vwNzFBovqHUvI+4Ponaw==",
}
dataType, _ := json.Marshal(data)
resp, err := http.Post(url, "application/json", strings.NewReader(string(dataType)))
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(body))
let HTTP = require('http')
let postData = {
"data": {
"trade_id":"this is trade_id",
"coin":"eth",
"txid":"this is txid",
"address":"this is to address",
"from_address":"this is from address",
"time":"1591779242",
"amount": "10.1",
"fee":"0",
"total":"10.1",
"status":"1",
"msg":"Prompt information",
"type":"1",
"gas_fee":"0.1",
},
"sign": "OTA8utI8y8G93p7RPCyb4qIilFQ0B4Aq4iUjhaXWK9m2kgektqlHOASDKXT2VE7NPNysrGycYlVfjDR2WGZn1G66phHo3qa9CcCNpG9klOBEuBEMjiVbb/d8AXcxEzvQr9OCwNsikyxonyzLiY/lsNHeGm9cC5eRvlNLdUSVBipH+ajPd0lDHCayZPs1eCMfbm/xnf8e2lfy6z0UPOpHGfyX/0+hz99Ir5Xnx+0sBBzyZZJxKm4ROid5aDv/9m9guILpURae+Yw/IrkYF4uAKGX+/44cBvtTRQSdX76CAOBSiywZa6BAgDYBLRtkAPM+i+vwNzFBovqHUvI+4Ponaw==",
};
let POST_OPTIONS = {
port: 80,
host: "The withdrawal callback URL configured in the backend of the merchant",
path: "",
method: 'POST',
headers: {
"Content-Type": "application/json; charset=utf-8"
}
};
const REQUEST = HTTP.request(POST_OPTIONS,function (res) {
let data = []
res.on('data', chunk => {
data.push(...chunk)
})
res.on('end', () => {
let _date = JSON.parse( new TextDecoder().decode(new Uint8Array(data)))
console.log(_date)
})
});
REQUEST.setTimeout(6000)
REQUEST.write(JSON.stringify(postData), 'utf8')
REQUEST.end()
public static void main() {
String priKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCtdgvcfozY7fe/x6UlXR/Fff8+wX++CiG05YVRafDe90O8y5KJAMZ156TgajEUXSRyKZqASz7iVoMAcu5FqfK1KuOOdjTAg0LFe/twIZvKmAqHcCSS2pjUXk0fTpZEgQ5lmDCK12Mg07YXvr+BeHjF+kBpwRJMPMG/+DGBDYNFNeRSJqWyopt6yyF528soAykHIUQ7TTultJV5IPCrvjRQQrGdJ/QtCdE0vZg+tA09nFN7AqgraU99kIvzyS0sqysj+pP1SJRmTRSGtlVAO3mILfkXOekZl1KD60G7CF+7BIaaW83FPD55tZhAGhnbLMYyiq7OiIyU61LTRcNSaJ0tAgMBAAECggEBAIGgGKcSzxCBbMYdXLV6TPbZ/HeaRGrwyVWUu7cmc0E8CJu6iWvmb2jGzbiCwuCT5luF6ZZ8JKchvU4FlTfsE5r9TQY2IZ/Ht4s65qBaDUEts5iY3kv8HX9+ZSXDJZpV0ztqqsPmx4ZNj+NYwWXwcFiKdb5R8OmV8bgSsnPddD6wFhwewglUOBPRAjropHE4sqk1Vam6q1MlFq5kiekMn/CItyFYFFzST/ruqAtVTp7YIvazAMrfCKH+pvXWk6pYNHZmL/JZey0GglRyJ1nItiqL33X8Lji056FcbAclidq022h/KPLEJpZk6irWqYdqYZeF6YMLHtdZFDkTZ/hXY+UCgYEA5i794UTQ1Kd6K+iui/S8K5H8nGdiXb3+uZ5j5VKYfbRmzXhAdVYisYe8czeTECxhH+MeHgM4tLR4ifx9q60ylvZxl9Fav1p6EaE36YcvGVmpm7Gm3q6QDDBa4gB+X9u7CxCS4LpotV917YS1QvOIF9lnRonSj1zNzFtbXkywrN8CgYEAwOpx/mR40ZvgZxNCq9DsIdrSZYAFFKpw0xy0OtF1PpuwMaREoRabnlVw6Bb3Hofg50XA3JxemzAX6fB92ee+NfXfeL4UtC4vG1K9JyiXHtHq8p9Uw2W03ehIEeNa3xdoRRnLmD4VUpyfL19ViE2+7TM1Gd3TogjDT+AMOCSuq3MCgYBsurPH7gaq/LVT+mRAzgj4l8v4YUlwuGeTbIMJdvt7HXUWB4CDLH3U2CYnUpAQKrZyJok6ahEmIr1xiKggKP7lmmHL8eNo0icpHrtXfzi7Q8Q/PCpzs4dtioXTjaIkS5nNvzVyG/uL+RyuZmpsxrZ5dYM4KbAhchfwORMutxEZhwKBgQC5zpVw4jCEItBmNuTWO+nTScGvxTgfiXIVw+XLaQa2AJoZlhAL34yPWdffko79tv3lgweY9HsimZXO2rU8dbp8mo5c6ydhy8HPXUeWOcAkDSdv/ApWENW9jgYsRIC3swHY3Fl+Dv3Wjce8huQI3mjwaYvRmBhIToxfmHnscVhTBQKBgB9uciEHfz8hMI7ePrPo2PkyK/RbJDm3HnuWE2lFBp7MOUMlh53MXwv4dIRaYMbRrFuN1UIKEFxuKhWwTHSzZJufk/UENrha/81fpj2BoFsAKkEunKeETvaIh6fZSjec16h2+zxbzwkdS6b+yIYkSlaoAxmDYrMtae0C8G4e0YS9";
String pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArXYL3H6M2O33v8elJV0fxX3/PsF/vgohtOWFUWnw3vdDvMuSiQDGdeek4GoxFF0kcimagEs+4laDAHLuRanytSrjjnY0wINCxXv7cCGbypgKh3AkktqY1F5NH06WRIEOZZgwitdjINO2F76/gXh4xfpAacESTDzBv/gxgQ2DRTXkUialsqKbesshedvLKAMpByFEO007pbSVeSDwq740UEKxnSf0LQnRNL2YPrQNPZxTewKoK2lPfZCL88ktLKsrI/qT9UiUZk0UhrZVQDt5iC35FznpGZdSg+tBuwhfuwSGmlvNxTw+ebWYQBoZ2yzGMoquzoiMlOtS00XDUmidLQIDAQAB";
rsaSigner signer = new rsaSigner();
Map<String, Object> data = new HashMap<>();
data.put("trade_id","this is trade_id");
data.put("coin","eth");
data.put("txid","this is txid");
data.put("address","this is to address");
data.put("from_address","this is from address");
data.put("time","1591779242");
data.put("amount", "10.1");
data.put("fee","0");
data.put("total","10.1");
data.put("status","1");
data.put("msg","Prompt information");
data.put("type","1");
data.put("gas_fee","0.1");
try {
Map<String, Object> params = new HashMap<>();
params.put("data", data);
params.put("sign", signer.genSign(data, priKey));
Gson gson = new GsonBuilder().create();
System.out.println("params = " + gson.toJson(params));
String res;
// platform request shop callback API
// res = doPost("http://api.shophost.com/withdraw/callback", gson.toJson(params));
// if (null == res) {
// throw new RuntimeException("http error");
// }
// mock response from shop callback API
{
res = """
{
"status":200,
"sign": "A3wCWwcw1w7Ee/xDDWBpf80i2Wc1oqpcqChznv9mr7dgLcKPQAECtemvmRTPwAxsZm6SJeGSN7P3ssB8/wmyZcJiVykr1HWbcQNL/YNYb6MCJqBXpbpnOwaBSWGr+aOh/1ql1ciW04W/rhF8rHch13Se+ZQ1TmJ5/JooEssCxaIRI4EiwGM47cpFSpuMv1e0UMsozCNvudAZDhwh/fDU4eIk2n3qikFEN6uAkG2gN2Y0dseG1/ua1RLYn97lb6oU4cYTpmrlGYZCMzc+cvhDkBL83UsU1hiVYMQtTJ5jtrUe5sumkYuVqkT0VjZklszvKtDDblK/KYXtZ2kRkWn2kg==",
"data":{
"success_data":"success"
}
}
""";
}
System.out.println("response = " + res);
JsonParser jp = new JsonParser();
JsonObject resEle = jp.parse(res).getAsJsonObject();
boolean retSignOK = signer.verifySign(resEle.get("data"), resEle.get("sign").getAsString(), pubKey);
if (!retSignOK) {
throw new RuntimeException("verify response sign fail");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("OK");
}
Example of return result:
{
"status":200,
"sign": "OTA8utI8y8G93p7RPCyb4qIilFQ0B4Aq4iUjhaXWK9m2kgektqlHOASDKXT2VE7NPNysrGycYlVfjDR2WGZn1G66phHo3qa9CcCNpG9klOBEuBEMjiVbb/d8AXcxEzvQr9OCwNsikyxonyzLiY/lsNHeGm9cC5eRvlNLdUSVBipH+ajPd0lDHCayZPs1eCMfbm/xnf8e2lfy6z0UPOpHGfyX/0+hz99Ir5Xnx+0sBBzyZZJxKm4ROid5aDv/9m9guILpURae+Yw/IrkYF4uAKGX+/44cBvtTRQSdX76CAOBSiywZa6BAgDYBLRtkAPM+i+vwNzFBovqHUvI+4Ponaw==",
"data":{
"success_data":"success"
}
}
- Asynchronous user withdrawal result notification function, the merchant will be notified of the final success or failure of the withdrawal.
- Among them, if the withdrawal fails due to the merchant's reasons, the merchant will handle it, otherwise, the platform will handle it.
HTTP Request
POST: The specific callback URL is provided by the merchant to the platform side
request parameters
| parameter name | 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 | 是 | 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 | int | 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 |
| sign | yes | string | sign the data in data |
Response parameter description
| parameter | required | type | description |
|---|---|---|---|
| status | yes | int | status code |
| data | yes | jsonObject | returns the data object |
| data.success_data | yes | sring | success Received successfully |
| sign | yes | string | signature |
- For the situation and handling method of transfer failure
| 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.