加密钱包
创建加密货币提现
将加密货币从商户的 VelaFi 托管钱包提现至提现白名单中的地址。
POST
/
v2
/
assets
/
withdraw
创建加密货币提现
curl --request POST \
--url https://api-test.velafi.com/v2/assets/withdraw \
--header 'Content-Type: application/json' \
--header 'X-BH-TOKEN: <api-key>' \
--data '
{
"merchantId": 123,
"clientId": "<string>",
"crypto": "<string>",
"chainType": "<string>",
"address": "<string>",
"addressTag": "<string>",
"cryptoAmount": 123,
"remark": "<string>"
}
'import requests
url = "https://api-test.velafi.com/v2/assets/withdraw"
payload = {
"merchantId": 123,
"clientId": "<string>",
"crypto": "<string>",
"chainType": "<string>",
"address": "<string>",
"addressTag": "<string>",
"cryptoAmount": 123,
"remark": "<string>"
}
headers = {
"X-BH-TOKEN": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-BH-TOKEN': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantId: 123,
clientId: '<string>',
crypto: '<string>',
chainType: '<string>',
address: '<string>',
addressTag: '<string>',
cryptoAmount: 123,
remark: '<string>'
})
};
fetch('https://api-test.velafi.com/v2/assets/withdraw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api-test.velafi.com/v2/assets/withdraw")
.header("X-BH-TOKEN", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchantId\": 123,\n \"clientId\": \"<string>\",\n \"crypto\": \"<string>\",\n \"chainType\": \"<string>\",\n \"address\": \"<string>\",\n \"addressTag\": \"<string>\",\n \"cryptoAmount\": 123,\n \"remark\": \"<string>\"\n}")
.asString();{
"code": 123,
"msg": "<string>",
"data": {
"orderId": 123
}
}使用此端点将加密货币从商户的 VelaFi 钱包发送至其他地址。目标地址必须已在您的提现地址白名单中。调用前,请先使用获取提现额度查询有效的
chainType 值和最低金额。
所有请求都必须在
X-BH-TOKEN 请求头中携带通过 GET /v2/token/generate 获取的业务令牌,并设置 Content-Type: application/json。端点
POST https://api.velafi.com/v2/assets/withdraw
请求参数
您为此次提现设置的唯一标识符。如果该商户此前同类提现(外部地址或 VelaFi 目标地址)已使用过某个
clientId,重复使用将被拒绝并返回 Duplicate withdrawal request。响应字段
示例
cURL
curl -X POST https://api.velafi.com/v2/assets/withdraw \
-H "X-BH-TOKEN: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"merchantId": 151209,
"clientId": "withdraw-0001",
"crypto": "USDT",
"chainType": "TRC20",
"address": "YOUR_WHITELISTED_ADDRESS",
"cryptoAmount": 100,
"remark": "supplier payout"
}'
校验与行为
除非您的白名单中存在与
address、chainType 和 addressTag 匹配且涵盖该 crypto 的有效条目,否则请求将被拒绝。白名单条目归属于您的 API 用户,因此适用于其下的所有商户。账户级别的管控(例如提现冻结)也可能拒绝发送至白名单地址的请求。- 加密货币限额。 提现金额计入商户的加密货币限额。超出限额的请求将被拒绝。
- 外部地址。 以下规则仅在目标地址不是 VelaFi 钱包地址时适用:
- 金额会按代币的小数精度截断。
- 金额必须大于网络手续费,否则请求失败并返回
The quantity cannot be less than the handling fee。 - 如果代币设有最低金额(
minCryptoAmount大于0),金额必须不低于该最低值,否则请求失败并返回Order amount is too small。 - 如果代币设有单笔最大提现金额,超出该金额的请求将失败并返回
The quantity cannot exceed the maximum quantity。 - 如果该网络已禁用链上提现(获取提现额度中
allowWithdraw为false),请求将失败并返回Withdrawals are temporarily unavailable due to system maintenance.
- VelaFi 目标地址。 如果目标地址是 VelaFi 钱包地址,则不会发起链上交易。该提现将记为内部划转,网络手续费为零,并显示在加密货币划转记录中。
⌘I
创建加密货币提现
curl --request POST \
--url https://api-test.velafi.com/v2/assets/withdraw \
--header 'Content-Type: application/json' \
--header 'X-BH-TOKEN: <api-key>' \
--data '
{
"merchantId": 123,
"clientId": "<string>",
"crypto": "<string>",
"chainType": "<string>",
"address": "<string>",
"addressTag": "<string>",
"cryptoAmount": 123,
"remark": "<string>"
}
'import requests
url = "https://api-test.velafi.com/v2/assets/withdraw"
payload = {
"merchantId": 123,
"clientId": "<string>",
"crypto": "<string>",
"chainType": "<string>",
"address": "<string>",
"addressTag": "<string>",
"cryptoAmount": 123,
"remark": "<string>"
}
headers = {
"X-BH-TOKEN": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-BH-TOKEN': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantId: 123,
clientId: '<string>',
crypto: '<string>',
chainType: '<string>',
address: '<string>',
addressTag: '<string>',
cryptoAmount: 123,
remark: '<string>'
})
};
fetch('https://api-test.velafi.com/v2/assets/withdraw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api-test.velafi.com/v2/assets/withdraw")
.header("X-BH-TOKEN", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchantId\": 123,\n \"clientId\": \"<string>\",\n \"crypto\": \"<string>\",\n \"chainType\": \"<string>\",\n \"address\": \"<string>\",\n \"addressTag\": \"<string>\",\n \"cryptoAmount\": 123,\n \"remark\": \"<string>\"\n}")
.asString();{
"code": 123,
"msg": "<string>",
"data": {
"orderId": 123
}
}