dLocal China
Search…
⌃K

保存银行卡

post
https://api.dlocal.com/
secure_cards
保存银行卡

银行卡对象

属性
类型
描述
holder_name
String
持卡人全名,当未提供卡token时必填
expiration_month
Integer
银行卡有效期月份(1-12)。当未提供卡token时必填
expiration_year
Integer
银行卡有效期年份(4位数字,如2020)。当未提供卡token时必填。
number
String
银行卡号,不包含任何分隔符的字符串。encrypted_datatoken未提供时必填
cvv
String
信用卡安全码。encrypted_data token未提供时必填。
encrypted_data
String
JWE 加密参数, 选填.
token
String
使用Smart Fields 功能创建的临时信用卡token,选填。

付款人对象

属性
类型
描述
name
String
付款人姓名,必填
document
String
付款人身份编号,必填
email
String
付款人邮箱地址,选填。

请求示例

curl -X POST \
-H 'X-Date: 2018-02-20T15:44:42.310Z' \
-H 'X-Login: sak223k2wdksdl2' \
-H 'X-Trans-Key: fm12O7G9' \
-H 'Content-Type: application/json' \
-H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
-d '{body}'
https://api.dlocal.com/secure_cards
请求 body 示例
{
"country": "BR",
"card": {
"holder_name": "Thiago Gabriel",
"expiration_month": 10,
"expiration_year": 2040,
"number": "4111111111111111",
"cvv": "123"
},
"payer": {
"name": "Luis Gabriel",
"document": "53033315550",
"email": "[email protected]"
}
}

发起付款时保存银行卡

你也可以选择在发起付款/预授权时保存用户的银行卡。如需保存,只需要在请求中的card对象中增加参数:"save" : true
如果操作成功(例如:付款状态为PAID, 或者预授权请求状态为 AUTHORIZED) ,那么响应报文中就会返回此用户银行卡的card_id ,此后,您就可以使用此ID来发起更多付款。如果操作失败(例如:付款状态为REJECTED), 那么请求响应中不会返回card_id

请求示例

请求示例
响应示例

请求示例

curl -X POST \
-H 'X-Date: 2018-02-20T15:44:42.310Z' \
-H 'X-Login: sak223k2wdksdl2' \
-H 'X-Trans-Key: fm12O7G9' \
-H 'Content-Type: application/json' \
-H 'X-Version: 2.1' \
-H 'User-Agent: MerchantTest / 1.0 ' \
-H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
-d '{body}'
https://api.dlocal.com/secure_payments

请求Body示例

{
"amount": 120.00,
"currency" : "USD",
"country": "BR",
"payment_method_id" : "CARD",
"payment_method_flow" : "DIRECT",
"payer":{
"name" : "Thiago Gabriel",
"email" : "[email protected]",
"document" : "53033315550",
"user_reference": "12345",
"address": {
"state" : "Rio de Janeiro",
"city" : "Volta Redonda",
"zip_code" : "27275-595",
"street" : "Servidao B-1",
"number" : "1106"
}
},
"card":{
"holder_name" : "Thiago Gabriel",
"number" : "4111111111111111",
"cvv" : "123",
"expiration_month" : 10,
"expiration_year" : 2040,
"save" : true
},
"order_id": "657434343",
"notification_url": "http://merchant.com/notifications"
}

响应示例

{
"id": "D-4-cf8eef6b-52d5-4320-b5ea-f5e0bbe4343f",
"amount": 120,
"currency": "USD",
"payment_method_id": "CARD",
"payment_method_type": "CARD",
"payment_method_flow": "DIRECT",
"country": "BR",
"card": {
"holder_name": "Thiago Gabriel",
"expiration_month": 10,
"expiration_year": 2040,
"brand": "VI",
"last4": "1111",
"card_id" : "CID-124c18a5-874d-4982-89d7-b9c256e647b5"
},
"created_date": "2018-12-26T20:26:09.000+0000",
"approved_date": "2018-12-26T20:26:09.000+0000",
"status": "PAID",
"status_detail": "The payment was paid",
"status_code": "200",
"order_id": "657434343",
"notification_url": "http://merchant.com/notifications"
}
get
https://api.dlocal.com/cards/
{card_id}
查询银行卡

请求示例

$ curl \
-H 'X-Date: 2018-02-20T15:44:42.310Z' \
-H 'X-Login: sak223k2wdksdl2' \
-H 'X-Trans-Key: fm12O7G9' \
-H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
https://api.dlocal.com/cards/CV-e90078f7-e027-4ce4-84cb-534c877be33c
delete
https://api.dlocal.com/secure_cards/
{card_id}
删除银行卡

请求示例

curl -X DELETE \
-H 'X-Date: 2018-02-20T15:44:42.310Z' \
-H 'X-Login: sak223k2wdksdl2' \
-H 'X-Trans-Key: fm12O7G9' \
-H 'Content-Type: application/json' \
-H 'X-Version: 2.1' \
-H 'User-Agent: MerchantTest / 1.0 ' \
-H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
-d '{body}'
https://api.dlocal.com/secure_cards/CV-af85ddba-f5f4-4644-b3fa-3c922e0687e9

HTTP 错误

HTTP 状态码
错误代码
错误详情
403 Forbidden
3001
Invalid Credentials.
3002
Unregistered IP address.
3003
Merchant has no authorization to use this API.
400 Bad Request
5000
Invalid request.
5001
Invalid parameter.
5003
Country not supported.
5005
User unauthorized due to cadastral situation.
5008
Token not found or inactive.
5015
The card was rejected by the bank.