文档中心/API 接口

API REFERENCE

汇率查询

POSThttps://mapi.yabandpay.com/Payments
实际接口
API PLAYGROUND · 实际接口

汇率查询

POSThttps://mapi.yabandpay.com/Payments
填写凭据后自动签名

请求参数6

先填写必填项

汇率查询

sell_currency必填stringdata.sell_currency卖出货币
buy_currency必填stringdata.buy_currency买入货币
currency必填stringdata.currency卖出货币,currency如果和sell_currency相同则为卖出货币,否则为买入货币
amount必填stringdata.amount卖出货币金额,currency如果和sell_currency相同则为卖出货币金额,否则为买入货币金额
tenor必填stringdata.tenorTOD 或者 SPOT
request_id必填stringdata.request_id请求id需保持唯一,建议24以上位数字+字母

凭据仅在当前页面使用。secret_key 不保存,也不发送给文档服务器。

该API用于汇率查询

在创建换汇订单之前,必须先调用此接口获取报价,并在获取报价后的30秒内完成订单创建。

注意事项

小贴士

注意事项

  1. 报价有效期
    每次返回的汇率报价有效期为 30 秒。超过有效期后需要重新查询汇率。

  2. 交割时间(Tenor)

  • TOD:表示实时交割,不受节假日影响。

  • SPOT:表示 T+2 工作日交割。在交割日前,请确保账户中有足够资金完成交割。如因资金不足导致交割失败,可能会根据实际损失收取相应罚金。

  1. SPOT 权限
    使用 SPOT 交割方式需要提前申请开通,并且受授信额度限制。

请使用专有账号

user=040268

参数类型描述是否必填
userStringMerchant级的UID必填
signString签名必填
methodStringv3.GetFXQuote必填
timeLong时间戳必填
  • 参数
参数类型描述是否必填
sell_currencyString卖出货币必填
buy_currencyString买入货币必填
currencyString卖出货币,currency如果和sell_currency相同则为卖出货币,否则为买入货币必填
amountString卖出货币金额,currency如果和sell_currency相同则为卖出货币金额,否则为买入货币金额必填
tenorStringTOD 或者 SPOT必填
request_idString请求id需保持唯一,建议24以上位数字+字母必填

签名示例:

拼接为URL方式并排序后的字符串

"amount=1&buy_currency=DKK&currency=GBP&method=v3.GetFXQuote&request_id=20304095064069023960369000g-42&sell_currency=GBP&tenor=TOD&time=1546588959&user=040268"

得到的 stringA 使用 secret_key做签名

得到的签名如下:

"YOUR_SIGNATURE"

提交示例:

{
  "user": "040268",
  "sign": "YOUR_SIGNATURE",
  "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"
}

更多信息:

返回结果:
  1. 调用成功,则返回"status": true
  2. 调用失败,则返回"status": false
返回代码:
StatusCodeMessage
true200
false-1000Internal error
false-403The signature Error
false-2001The UID not exist
false-3001Required field is missing
false-4118Incorrect request ID