汇率查询
请求地址
[POST] /v1/mid-open-api/exchange/rate需要验证签名
接口描述
查询支持的币种之间的汇率
提示
- 支持的货币对需要在接入时联系PingPong产品经理沟通确认后,由PingPong配置。
- 查询到的汇率需要在过期时间之前使用。
请求头
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string | M | access_token |
| Content-Type | string | M | application/json |
请求参数
| Parameter | Type | Required | Description |
|---|---|---|---|
| client_id | string(64) | M | 客户ID,客户在平台唯一ID |
| sell_currency | string(3) | M | 卖出币种 ,不可与买入币种一致 |
| buy_currency | string(3) | M | 买入币种 ,不可与卖出币种一致 |
| extra_info | string(128) | O | 预留扩展字段 |
返回响应
| Parameter | Type | Required | Description |
|---|---|---|---|
| client_id | string(64) | M | 客户在PP唯一ID |
| sell_currency | string(3) | M | 卖出币种 |
| buy_currency | string(3) | M | 买入币种 |
| rate_id | long | M | 汇率ID |
| rate | decimal(18,9) | M | 汇率 |
| expire_time | long | M | 汇率过期时间,毫秒 |
返回示例
- 成功
- 失败
{
"code": 200,
"message": "SUCCESS",
"data": {
"rate": 0.912659,
"client_id": "IT8623081103775418152",
"sell_currency": "USD",
"buy_currency": "EUR",
"rate_id": 1699260141909504002,
"expire_time": 1693970280068
}
}
{
"code": 900002,
"message": "buy_currency can't be empty",
"data": null
}
错误码
| 错误码 | 描述 | 解决方案 |
|---|---|---|
| 900000 | system error | 系统错误,请联系PingPong技术人员核查 |
| 900002 | illegal param | 参数有误,请根据提示更正信息 |
| 953003 | exchange rate not found | 汇率未查询到,联系PingPong技术人员核查是否配置相应货币对 |
| 953004 | inquire exchange rate error | 汇率查询错误,请稍后重试或联系PingPong技术人员核查 |