创建多目的方案
通过创建单目的方案,您可以获取一个只包含单目的proposal ID,如只包含分期,或者只包含换汇。 但因一个支付请求只允许传一个proposal ID,所以当您需要在一个支付请求里面包含多目的,如包含分期和换汇一起时,您需要创建多目的方案来获取proposal ID,以创建包含多目的的支付请求。
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",
"installmentPlanId": "2daac1cf-40f0-4311-9114-fb7e10e5f682"
}
创建一个包含分期和税费的方案
Request Body
{
"amount": 100000,
"country": "BR",
"currency": "BRL",
"installmentPlanId": "fcb50514-2124-4e89-9238-8357714f1593",
"taxPlanId": "f29d3d48-0806-41ca-b3ba-cdb4228d100d"
}
创建一个包含汇率和税费的方案
Request Body
{
"amount": 100000,
"country": "BR",
"currency": "USD",
"targetCurrency": "BRL",
"taxPlanId": "f29d3d48-0806-41ca-b3ba-cdb4228d100d"
}
创建一个包含分期、汇率和税费的方案
Response
{
"id":"3c31a13f-69a2-425d-a383-1bbd697329db",
"submitTime":"2023-09-21T10:53:39Z",
"expirationTime":"2023-09-21T11:53:39Z",
"paymentIntent":{
"amount":100000,
"country":"BR",
"currency":"USD",
"targetCurrency":"BRL",
"installmentPlanId":"2daac1cf-40f0-4311-9114-fb7e10e5f682"
},
"planDetails":{
"installment":[
{
"modifierType":"RATE",
"rate":0,
"installments":1
},
{
"modifierType":"RATE",
"rate":0,
"installments":2
},
{
"modifierType":"RATE",
"rate":0,
"installments":3
}
],
"fx":[
{
"base":"USD",
"target":"BRL",
"spreadRate":0.02
},
{
"base":"USD",
"target":"MXN",
"spreadRate":0.02
}
],
"tax": [
{
"modifierType": "RATE",
"rate": 0.0038,
"type": "BR_IOF_FX_TAX"
}
]
},
"proposalDetails":{
"fxProposalDetails":{
"fxRate":{
"modifierType":"RATE",
"base":"USD",
"target":"BRL",
"timestamp":1664443743,
"exchangeRate":5.4835098
},
"baseAmount":100000,
"targetAmount":548351
},
"installmentProposalDetails":[
{
"installmentAmount":548351,
"installments":1,
"totalAmount":548351
},
{
"installmentAmount":274176,
"installments":2,
"totalAmount":548351
},
{
"installmentAmount":182784,
"installments":3,
"totalAmount":548351
}
],
"taxProposalDetails": [
{
"taxRate": {
"modifierType": "RATE",
"rate": 0.0038,
"type": "BR_IOF_FX_TAX"
},
"amount": 380
}
]
}
}
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、BRL、MXN、COP、PEN或者CLP | |
| targetCurrency | String | 目标货币代码,如BRL。需要进行货币转换时必填 | |
| installmentPlanId | String | 分期付款计划ID,当您需要包含税费计划时,此处为必填 | |
| taxPlanId | String | 税费计划ID,当您需要包含税费计划时,此处为必填 |
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 | 目标货币代码 |
| installmentPlanId | String | 分期付款计划ID |
| taxPlanId | String |
planDetails¶
| 参数 | 类型 | 描述 |
|---|---|---|
| installment | JSON Array | 分期付款计划详情 |
| fx | JSON Array | 换汇计划详情 |
| tax | JSON Array | 税费计划详情 |
installment¶
| 参数 | 类型 | 描述 |
|---|---|---|
| modifierType | String | 类型,RATE |
| rate | Positive Float | 附加费率 |
| installments | String | 分期付款期数 |
fx¶
| 参数 | 类型 | 描述 |
|---|---|---|
| base | String | 当前货币代码 |
| target | String | 目标货币代码 |
| spreadRate | Positive Float | 换汇利差率 |
tax¶
| 参数 | 类型 | 描述 |
|---|---|---|
| modifierType | String | 类型,RATE |
| rate | Positive Float | 税率 |
| type | String | 税率类型 |
proposalDetails¶
| 参数 | 类型 | 描述 |
|---|---|---|
| installmentProposalDetails | JSON Array | 分期付款方案详情 |
| fxProposalDetails | JSON Array | 换汇方案详情 |
| taxProposalDetails | JSON Array | 税费方案详情 |
installmentProposalDetails¶
| 参数 | 类型 | 描述 |
|---|---|---|
| installmentAmount | Long | 分期付款金额,单位是货币最小粒度。 如 1 = 0.01BRL |
| installments | Integer | 分期付款期数 |
| totalAmount | Long | 分期付款总金额,单位是货币最小粒度。 如 1 = 0.01BRL |
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 | 汇率 |
taxProposalDetails¶
| 参数 | 类型 | 描述 |
|---|---|---|
| taxRate | JSON | 汇率详情 |
| amount | Long | 税费金额。 |
taxRate¶
| 参数 | 类型 | 描述 |
|---|---|---|
| modifierType | String | 类型,RATE |
| rate | Positive Float | 税率 |
| type | String | 税率类型 |