Exchange Application
- Endpoint:
POST /aggregate-pay/api/gateway/exchange - Tags: Forex(Old)
Description
Currency exchange function is used to exchange the available balance between different currencies of the merchant (one of which is USD).
Parameters
| Field | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
Content-Type | header | string | Yes | ||
sign | header | string | Yes | 签名信息请参考技术文档 |
Parameter Examples
Content-Type:"application/json"sign:"FPFVT3o227JrFRbqu19boZCpVVTF9KznxyRawUmxpfXilHV/0yK46haPhAjNu1hPUMy7Vw/ILXhfzffNm4Fj0apWknlTY9OJxnSoQxS9BTFtc61tn5yV1q69x/kkBl82/qwg+XTJ4fOzy7Mar3VaC1E2PlDA6RkkKBUyNE6RYgsdB+Su7an4+4HVTNAnoe74WyvBgxTLMNg28igBTdqxaO3w/UBY6ObVp7vkqkQGdL1Y+HgmMYaAVwrM3+ALWGId0sJ+YqTY4WJ+0xCRGhaSnybiIjZsQEYyID68WNUfuavDLDsEhaMm/HfQvf5p0R1Ltovp3wwJnEbQcjY458iX5A=="
Request Body
Content-Type: application/json
| Field | Type | Required | Constraints | Description | Enum |
|---|---|---|---|---|---|
version | string | Yes | API version. Current value: 1.1 | ||
keyVersion | string | Yes | Signature Algorithm Version, Current value: 1 | ||
requestTime | string | Yes | Request time, compliant with rfc3339 specification, format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX The time must be within two minutes of the current time | ||
appId | string | Yes | Merchant AppId,The unique identifier assigned to the merchant app by PayerMax | ||
merchantNo | string | No | maxLength: 32 | Merchant Id, the unique identifier generated when the merchant signs the contract with PayerMax | |
data | object | Yes | |||
data.ccyPair | string | Yes | maxLength: 6, minLength: 6 | Currency pair | |
data.outTradeNo | string | Yes | maxLength: 64, minLength: 1 | Merchant order id | |
data.side | string | Yes | The buying and selling direction for the transaction currency,BUY,SELL | ||
data.transactionAmount | string | Yes | maxLength: 162 | Transaction amount | |
data.transactionCcy | string | Yes | maxLength: 3, minLength: 3 | Transaction currency | |
data.targetCcy | string | Yes | maxLength: 3, minLength: 3 | Target currency | |
data.rateVersion | string | No | maxLength: 64 | Exchange rate version.If this field is not entered, the transaction will be performed using the latest version. |
Example
json
{
"version": "1.1",
"keyVersion": "1",
"requestTime": "2022-11-17T09:20:21.000Z",
"appId": "2222fd568ab5452b906a3d65a1fbac19",
"merchantNo": "P01010113842047",
"data": {
"ccyPair": "USDINR",
"outTradeNo": "exchange1668765794665}",
"side": "BUY",
"targetCcy": "INR",
"transactionAmount": "0.1",
"transactionCcy": "USD"
}
}Responses
200
| Field | Type | Required | Constraints | Description | Enum |
|---|---|---|---|---|---|
code | string | Yes | Return code, ‘APPLY_SUCCESS’ means success | ||
msg | string | Yes | Return message, ‘Success.’ | ||
data | object | Yes | |||
data.transactionCcy | string | Yes | maxLength: 3 | ||
data.side | string | Yes | maxLength: 4 | ||
data.tradeNo | string | Yes | maxLength: 64 | ||
data.targetAmount | string | Yes | maxLength: 133333200 | ||
data.rateTime | string | Yes | maxLength: 13 | Compliant with rfc3339 specification, format:yyyy-MM-dd’T’HH:mm:ss.SSSXXX | |
data.completeTime | string | Yes | maxLength: 32 | Compliant with rfc3339 specification, format:yyyy-MM-dd’T’HH:mm:ss.SSSXXX | |
data.errorCode | string | Yes | maxLength: 32 | ||
data.rateVersion | string | Yes | maxLength: 64 | ||
data.targetCcy | string | Yes | maxLength: 3 | ||
data.errorMsg | string | Yes | maxLength: 256 | ||
data.ccyPair | string | Yes | maxLength: 6 | ||
data.rate | string | Yes | maxLength: 248 | ||
data.outTradeNo | string | Yes | maxLength: 64 | ||
data.transactionAmount | string | Yes | maxLength: 162 | ||
data.status | string | Yes | maxLength: 32 |
Response Example
json
{
"msg": "",
"code": "APPLY_SUCCESS",
"data": {
"transactionCcy": "USD",
"side": "BUY",
"tradeNo": "20221118100315TU69880006003061",
"targetAmount": "7.77",
"rateTime": "2022-11-18T10:03:15.000Z",
"completeTime": "2022-11-18T10:03:15.000Z",
"errorCode": "",
"rateVersion": "batch0034166876579518629680057",
"targetCcy": "INR",
"errorMsg": "",
"ccyPair": "USDINR",
"rate": "77.6983742600",
"outTradeNo": "exchange1668765794665",
"transactionAmount": "0.10",
"status": "SUCCESS"
}
}