收款人
设置退款账户
将已验证的收款人指定为商户的退款账户。当订单被撤销时,VelaFi 会自动将资金发送到此账户。
POST
/
v2
/
payments
/
refund_account
设置退款账户
curl --request POST \
--url https://api-test.velafi.com/v2/payments/refund_account \
--header 'Content-Type: application/json' \
--header 'X-BH-TOKEN: <api-key>' \
--data '
{
"userPaymentId": 123,
"merchantId": 123
}
'import requests
url = "https://api-test.velafi.com/v2/payments/refund_account"
payload = {
"userPaymentId": 123,
"merchantId": 123
}
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({userPaymentId: 123, merchantId: 123})
};
fetch('https://api-test.velafi.com/v2/payments/refund_account', 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/payments/refund_account")
.header("X-BH-TOKEN", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userPaymentId\": 123,\n \"merchantId\": 123\n}")
.asString();{
"code": 123,
"msg": "<string>",
"data": true
}当法币兑加密货币订单或全球支付订单被撤销或退款时,VelaFi 需要知道将资金发送到哪里。使用此端点可将任何先前已验证的收款人指定为某个商户的退款账户。每个商户同一时间只能有一个有效的退款账户——使用不同的
userPaymentId 再次调用此端点将替换之前的指定。
端点
POST https://api.velafi.com/v2/payments/refund_account
沙盒环境测试请使用
https://api-test.velafi.com/v2/payments/refund_account。请求头
| 请求头 | 值 |
|---|---|
X-BH-TOKEN | 通过 GET /v2/token/generate 获取的令牌 |
Content-Type | application/json |
请求体参数
integer
必填
要指定为退款账户的收款人的唯一数字 ID。该收款人必须为
status: 1(有效)。integer
必填
要为其设置退款账户的商户的数字 ID。
响应字段
integer
响应状态码。
200 表示成功。string
人类可读的响应消息。
boolean
如果成功指定退款账户,则为
true。示例
curl -X POST "https://api.velafi.com/v2/payments/refund_account" \
-H "X-BH-TOKEN: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"merchantId": 456,
"userPaymentId": 123
}'
{
"code": 200,
"msg": "SUCCESS",
"data": true
}
设置退款账户后,对应收款人的
hasRefundAccount 字段在 GET /v2/payments 响应中将返回 1。⌘I
设置退款账户
curl --request POST \
--url https://api-test.velafi.com/v2/payments/refund_account \
--header 'Content-Type: application/json' \
--header 'X-BH-TOKEN: <api-key>' \
--data '
{
"userPaymentId": 123,
"merchantId": 123
}
'import requests
url = "https://api-test.velafi.com/v2/payments/refund_account"
payload = {
"userPaymentId": 123,
"merchantId": 123
}
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({userPaymentId: 123, merchantId: 123})
};
fetch('https://api-test.velafi.com/v2/payments/refund_account', 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/payments/refund_account")
.header("X-BH-TOKEN", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userPaymentId\": 123,\n \"merchantId\": 123\n}")
.asString();{
"code": 123,
"msg": "<string>",
"data": true
}
