汇率查询接口
该API用于查询汇率
在做换汇的时候,第一步需要做销售货币和兑换货币的汇率查询。
[!TIP|style:flat]
时间限制:该报价每次有效期为30秒。
汇兑时间:tenor值如果是ON在银行假期也可正常汇兑。
tenor值:TOD:T(当天),SPOT:T+2(次二工作日)。
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=1000&buy_currency=EUR¤cy=USD&method=v3.GetFXQuote&request_id=203040950640690239603690&sell_currency=USD&tenor=TOD&time=1546588959&user=016683"
得到的 stringA 使用 secret_key做签名
得到的签名如下:
"dda675497419e27e38de5d5cc032e5bf3595f3bf43de8e2d123bb50510e7c08a"
提交示例:
{
"user": "016683",
"sign": "dda675497419e27e38de5d5cc032e5bf3595f3bf43de8e2d123bb50510e7c08a",
"method": "v3.GetFXQuote",
"time": 1546588959,
"data": {
"sell_currency": "USD",
"buy_currency": "EUR",
"currency": "USD",
"amount": 1000,
"tenor": "TOD",
"request_id": "203040950640690239603690"
}
}
返回示例:
{
"status": true,
"code": "200",
"data": {
"type": "sell",
"sell_currency": "USD",
"buy_currency": "EUR",
"sold_currency": "USD",
"sold_amount": 1000,
"bought_currency": "EUR",
"bought_amount": 830.58,
"tenor": "TOD",
"exchange_rate": 0.8305804,
"expiry_time": 1772524951,
"quote_id": "78636c41-d214-4a8f-ae22-5c112ca0e1c7",
"response_id": "203040950640690239603690"
},
"message": ""
}
更多信息:
返回结果:
- 调用成功,则返回
"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 |