汇率查询
该API用于汇率查询
在创建换汇订单之前,必须先调用此接口获取报价,并在获取报价后的30秒内完成订单创建。
注意事项
[!TIP|style:flat]
注意事项
报价有效期
每次返回的汇率报价有效期为 30 秒。超过有效期后需要重新查询汇率。交割时间(Tenor)
- TOD:表示实时交割,不受节假日影响。
SPOT:表示 T+2 工作日交割。在交割日前,请确保账户中有足够资金完成交割。如因资金不足导致交割失败,可能会根据实际损失收取相应罚金。
SPOT 权限
使用 SPOT 交割方式需要提前申请开通,并且受授信额度限制。请使用专有账号
user=040268
API URL:https://mapi.yabandpay.com/Payments
Method:POST
POST data type:Json
| 参数 | 类型 | 描述 | 是否必填 |
|---|---|---|---|
| user | String | Merchant级的UID | 必填 |
| sign | String | 签名 | 必填 |
| method | String | v3.GetFXQuote | 必填 |
| time | Long | 时间戳 | 必填 |
- 参数
| 参数 | 类型 | 描述 | 是否必填 |
|---|---|---|---|
| sell_currency | String | 卖出货币 | 必填 |
| buy_currency | String | 买入货币 | 必填 |
| currency | String | 卖出货币,currency如果和sell_currency相同则为卖出货币,否则为买入货币 | 必填 |
| amount | String | 卖出货币金额,currency如果和sell_currency相同则为卖出货币金额,否则为买入货币金额 | 必填 |
| tenor | String | TOD 或者 SPOT | 必填 |
| request_id | String | 请求id需保持唯一,建议24以上位数字+字母 | 必填 |
签名示例:
拼接为URL方式并排序后的字符串
"amount=1&buy_currency=DKK¤cy=GBP&method=v3.GetFXQuote&request_id=20304095064069023960369000g-42&sell_currency=GBP&tenor=TOD&time=1546588959&user=040268"
得到的 stringA 使用 secret_key做签名
得到的签名如下:
"b6f9779a454eaf606606bcbd754dd7afc9c290ac9907a23363226499910b852e"
提交示例:
{
"user": "040268",
"sign": "b6f9779a454eaf606606bcbd754dd7afc9c290ac9907a23363226499910b852e",
"method": "v3.GetFXQuote",
"time": 1546588959,
"data": {
"sell_currency": "GBP",
"buy_currency": "DKK",
"currency": "GBP",
"amount": "1",
"tenor": "TOD",
"request_id": "20304095064069023960369000g-42"
}
}
返回示例:
{
"status": true,
"code": "200",
"data": {
"type": "sell",
"sell_currency": "GBP",
"buy_currency": "DKK",
"sold_currency": "GBP",
"sold_amount": "1.00",
"bought_currency": "DKK",
"bought_amount": "8.54",
"tenor": "TOD",
"exchange_rate": 8.544924729,
"quote_id": "83e96dc0-8f8e-48c7-9bc4-6acc1019fced",
"expiry_time": 1773824647
},
"message": "",
"response_id": "202603181703362736334439"
}
更多信息:
返回结果:
- 调用成功,则返回
"status": true - 调用失败,则返回
"status": false
返回代码:
| Status | Code | Message |
|---|---|---|
| true | 200 | |
| false | -1000 | Internal error |
| false | -403 | The signature Error |
| false | -2001 | The UID not exist |
| false | -3001 | Required field is missing |
| false | -4118 | Incorrect request ID |