分期付款

您可以定义一个分期付款计划,来确保每笔分期付款的手续费用都可以被正确收取。

要创建分期付款的付款,首先需要创建分期计划,以保证分期的附加手续费能被收取。

使用分期付款计划id(installments_id)和分期付款期数,可以继续创建分期付款。

post
创建分期计划

https://api.dlocal.com/installments-plans
创建分期计划
Request
Response
Request
Body Parameters
country
required
string
分期计划的国家
bin
required
string
信用卡BIN(卡号前6位)
amount
required
number
分期计划交易金额,数字
currency
required
string
分期计划的货币种类
Response
200: OK
{
"id" : "INS54434",
"country" : "BR",
"bin" : "435921",
"amount": 1000.00,
"currency" : "BRL",
"installments" : [
{
"id" : "INS54434-1",
"installment_amount" : 1000.00,
"installments" : 1,
"total_amount" : 1000.00
},
{
"id" : "INS54434-2",
"installment_amount" : 550.00,
"installments" : 2,
"total_amount" : 1100.00
},
{
"id" : "INS54434-3",
"installment_amount" : 383.33,
"installments" : 3,
"total_amount" : 1150.00
}
]
}

分期计划对象

Installment Plan Object
Example Installment Plan Object
Installment Plan Object

Property

Type

Description

id

String

分期计划 id。

country

String

分期计划国家。

currency

String

分期计划货币种类。

bin

String

信用卡BIN (卡号前六位)。

amount

Positive Float

分期计划的金额。

installments

Installment Object[ ]

分期付款计划信息。

installments_by_bank

Boolean

如果是 false: 分期付款利息是事先知道的,可以显示给买方。 如果是 true: 分期付款利息事先不知道,由发卡行决定。 (*)

Example Installment Plan Object
{
"id" : "INS54434",
"country" : "BR",
"bin" : "435921",
"amount": 1000.00,
"currency" : "BRL",
"installments" : [
{
"id" : "INS54434-1",
"installment_amount" : 1000.00,
"installments" : 1,
"total_amount" : 1000.00
},
{
"id" : "INS54434-2",
"installment_amount" : 550.00,
"installments" : 2,
"total_amount" : 1100.00
},
{
"id" : "INS54434-3",
"installment_amount" : 383.33,
"installments" : 3,
"total_amount" : 1150.00
}
],
"installments_by_bank": false
}

(*) 在这些情况下,最好在结账时向用户提供这些信息,以便让他们知道银行将在卡对账单中应用分期利息。

分期对象

分期对象
分期对象示例
分期对象

属性

类型

描述

id

String

分期ID。

installment_amount

Positive Float

单笔分期金额,包含分期付款当期的手续费。

total_amount

Positive Float

分期付款总额,包含分期付款的所有手续费。

installments

Integer

分期付款期数。

分期对象示例
{
"id" : "INS54434-3",
"installment_amount" : 550,
"installments" : 3,
"total_amount" : 1650
}

创建分期计划示例

Example Create Installment Plan Request
Example Create Installment Plan Response
Example Create Installment Plan Request
$ curl -X POST \
-H 'X-Date: 2018-02-20T15:44:42.310Z' \
-H 'X-Login: sak223k2wdksdl2' \
-H 'X-Trans-Key: fm12O7G9' \
-H 'X-Version: 2.1' \
-H 'User-Agent: MerchantTest / 1.0 ' \
-H 'Content-Type: application/json' \
-H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
-d '{body}'
https://api.dlocal.com/installments-plans
{
"country" : "BR",
"bin" : "411111",
"amount": 30,
"currency" : "BRL"
}
Example Create Installment Plan Response
{
"id" : "INS54434",
"country" : "BR",
"bin" : "435921",
"amount": 1000.00,
"currency" : "BRL",
"installments" : [
{
"id" : "INS54434-1",
"installment_amount" : 1000.00,
"installments" : 1,
"total_amount" : 1000.00
},
{
"id" : "INS54434-2",
"installment_amount" : 550.00,
"installments" : 2,
"total_amount" : 1100.00
},
{
"id" : "INS54434-3",
"installment_amount" : 383.33,
"installments" : 3,
"total_amount" : 1150.00
}
],
"installments_by_bank": false
}

分期付款支付示例

Example Payment Request
Example Payment Request
$ curl -X POST \
-H 'X-Date: 2018-02-20T15:44:42.310Z' \
-H 'X-Login: sak223k2wdksdl2' \
-H 'X-Trans-Key: fm12O7G9' \
-H 'X-Version: 2.1' \
-H 'User-Agent: MerchantTest / 1.0 ' \
-H 'Content-Type: application/json' \
-H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
-d '{body}'
https://api.dlocal.com/payments
{
"amount": 1000,
"currency" : "BRL",
"country": "BR",
"payment_method_id" : "CARD",
"payment_method_flow" : "DIRECT",
"payer":{
"name" : "Thiago Gabriel",
"email" : "[email protected]",
"document" : "53033315550"
},
"card":{
"holder_name" : "Thiago Gabriel",
"number" : "4111111111111111",
"cvv" : "123",
"expiration_month" : 10,
"expiration_year" : 2040,
"installments" : "3",
"installments_id" : "INS54434"
},
"order_id": "657434343",
"notification_url": "http://merchant.com/notifications"
}