跳转至

创建换汇方案

目前我们只支持从美金换汇到当地币的换汇方案,即意味着当前货币只能是USD,目标货币只能是BRL, MXN, COP, CLP这四种的其中一种。 请注意,若您需要在方案里面包含除了换汇之外的其他目的方案,那么您需要通过创建多目的方案来创建方案。

HTTP请求

POST /v1/payments/proposals

Request Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer {{access_token}}",
    "x-api-key": "{{api_key}}"
}
Request Body
{
    "amount": 100000,
    "country": "BR",
    "currency": "USD",
    "targetCurrency": "BRL"
}
Response
{
  "id": "f261a2dd-b719-4afb-ad54-c52cef8ba8d2",
  "submitTime": "2023-09-21T08:44:45Z",
  "expirationTime": "2023-09-21T09:44:45Z",
  "paymentIntent": {
      "amount": 100000,
      "country": "BR",
      "currency": "USD",
      "targetCurrency": "BRL"
  },
  "planDetails": {
      "fx": [
          {
              "base": "USD",
              "target": "BRL",
              "spreadRate": 0.02
          },
          {
              "base": "USD",
              "target": "MXN",
              "spreadRate": 0.02
          }
      ]
  },
  "proposalDetails": {
      "fxProposalDetails": {
          "fxRate": {
              "modifierType": "RATE",
              "base": "USD",
              "target": "BRL",
              "timestamp": 1664443743,
              "exchangeRate": 5.48350980
          },
          "baseAmount": 100000,
          "targetAmount": 548351
      }
  }
}

HTTP Headers 字段说明

Key Value
Authorization "bearer" + " " + {{access_token}}
x-api-key {{api_key}}

Request Body 字段说明

参数 必填 类型 描述
amount Long 金额,单位是货币最小粒度。 如 1 = 0.01BRL
country String 国家编号国际缩写码,遵循ISO 3166-1 alpha-2 code标准, 如巴西BR
currency String 当前币种编码,此处只能是USD。
targetCurrency String 目标币种编码,只能是BRL、MXN、COP或者CLP。

Response Body 字段说明

参数 类型 描述
id String 方案ID
submitTime String 方案提交时间
expirationTime String 方案过期时间
paymentIntent JSON 方案内容
planDetails JSON 计划详情
proposalDetails JSON 方案详情

对象字段说明

paymentIntent
参数 类型 描述
amount Long 金额,单位是货币最小粒度。 如 1 = 0.01BRL
country String 国家编号国际缩写码,遵循ISO 3166-1 alpha-2 code标准, 如巴西BR
currency String 货币代码
targetCurrency String 目标货币代码
planDetails
参数 类型 描述
fx JSON Array 换汇计划详情
fx
参数 类型 描述
base String 当前货币代码
target String 目标货币代码
spreadRate Positive Float 换汇利差率
proposalDetails
参数 类型 描述
fxProposalDetails JSON Array 换汇方案详情
fxProposalDetails
参数 类型 描述
fxRate JSON 汇率详情
baseAmount Long 当前货币的金额,单位是货币最小粒度。 如 1 = 0.01USD
targetAmount Long 目标货币的金额,单位是货币最小粒度。 如 1 = 0.01BRL
fxRate
参数 类型 描述
modifierType String 类型,RATE
base String 当前货币代码,如 USD
target String 目标货币代码,如 BRL
timestamp Long 货币转换时的时间戳
exchangeRate Positive Float 汇率
回到页面顶部