订单
确认订单
从您的一侧确认订单:将手动支付订单标记为已支付,或完成已支付的出金订单。具体效果取决于 orderType。
POST
/
v2
/
order
/
confirm
确认订单
curl --request POST \
--url https://api-test.velafi.com/v2/order/confirm \
--header 'Content-Type: application/json' \
--header 'X-BH-TOKEN: <api-key>' \
--data '
{
"orderId": 123,
"orderType": "<string>",
"direction": "<string>"
}
'import requests
url = "https://api-test.velafi.com/v2/order/confirm"
payload = {
"orderId": 123,
"orderType": "<string>",
"direction": "<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({orderId: 123, orderType: '<string>', direction: '<string>'})
};
fetch('https://api-test.velafi.com/v2/order/confirm', 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/order/confirm")
.header("X-BH-TOKEN", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"orderId\": 123,\n \"orderType\": \"<string>\",\n \"direction\": \"<string>\"\n}")
.asString();{
"code": 123,
"msg": "<string>",
"data": true
}调用此端点从您的一侧确认订单。其具体作用取决于
对于
orderType,对于 fiat_to_fiat 订单还取决于 direction(on_ramp 或 off_ramp),该类型订单必须提供此参数:
orderType | direction | 效果 | 接受条件 |
|---|---|---|---|
fiat_to_crypto | — | 在您发送法币后,将订单标记为已支付(status: 50)。 | 订单处于 status: 40 且使用手动支付方式。如果订单显示 status: 31,请先上传所需文件。 |
crypto_to_fiat | — | 完成订单(status: 60)。 | 订单处于 status: 50。 |
fiat_to_fiat | on_ramp | 在您发送法币后,将入金环节标记为已支付。 | 订单处于 status: 41,使用手动入金支付方式,尚未被确认,且所需的证明文件均已上传。 |
fiat_to_fiat | off_ramp | 无效果;返回 true。 | 始终接受。 |
fiat_to_crypto 和 crypto_to_fiat,操作以订单的实际类型为准。使用自动支付方式的订单由 VelaFi 的银行集成自动转为已支付状态,无法通过此端点标记为已支付。
端点
POST https://api.velafi.com/v2/order/confirm
沙盒环境测试请使用
https://api-test.velafi.com/v2/order/confirm。请求头
| 请求头 | 值 |
|---|---|
X-BH-TOKEN | 通过 GET /v2/token/generate 获取的令牌 |
Content-Type | application/json |
请求体参数
integer
必填
要确认的订单的唯一数字 ID。
string
必填
订单类型。必须是
fiat_to_crypto、crypto_to_fiat 或 fiat_to_fiat 之一。string
仅当
orderType 为 fiat_to_fiat 时必填。指定要确认的环节:on_ramp 或 off_ramp。响应字段
integer
响应状态码。
200 表示成功。string
可读的响应消息。
boolean
如果订单确认成功,则为
true。示例
- 加密货币兑法币订单
- 法币兑法币订单(入金环节)
curl -X POST "https://api.velafi.com/v2/order/confirm" \
-H "X-BH-TOKEN: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderId": 1123123123,
"orderType": "crypto_to_fiat"
}'
{
"code": 200,
"msg": "SUCCESS",
"data": true
}
curl -X POST "https://api.velafi.com/v2/order/confirm" \
-H "X-BH-TOKEN: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderId": 493829236956962817,
"orderType": "fiat_to_fiat",
"direction": "on_ramp"
}'
{
"code": 200,
"msg": "SUCCESS",
"data": true
}
不满足上表条件的请求将返回错误。调用此端点前,请先通过
GET /v2/order/detail 获取订单当前状态。⌘I
确认订单
curl --request POST \
--url https://api-test.velafi.com/v2/order/confirm \
--header 'Content-Type: application/json' \
--header 'X-BH-TOKEN: <api-key>' \
--data '
{
"orderId": 123,
"orderType": "<string>",
"direction": "<string>"
}
'import requests
url = "https://api-test.velafi.com/v2/order/confirm"
payload = {
"orderId": 123,
"orderType": "<string>",
"direction": "<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({orderId: 123, orderType: '<string>', direction: '<string>'})
};
fetch('https://api-test.velafi.com/v2/order/confirm', 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/order/confirm")
.header("X-BH-TOKEN", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"orderId\": 123,\n \"orderType\": \"<string>\",\n \"direction\": \"<string>\"\n}")
.asString();{
"code": 123,
"msg": "<string>",
"data": true
}
