Saving Cards
post
https://api.dlocal.com/
secure_cards
Create a Card

The Card Object

Argument
Type
Description
holder_name
String
Cardholder's full name. Required if token not present.
expiration_month
Integer
Number representing the card's expiration month (start in 1). Required if token not present.
expiration_year
Integer
Number representing the card's expiration year. Required if token not present.
number
String
The card number, as a string without any separators. Required if encrypted_data or token not present.
cvv
String
Credit card verification value. Required if encrypted_data or token not present.
encrypted_data
String
JWE encrypted params. Optional.
token
String
Temporary credit card token created using Smart Fields. Optional.

The Payer Object

Argument
Type
Description
name
String
Payer's name. Required.
document
String
Payer's document. Required.
email
String
Payer's email address. Optional.

Example Request

1
curl -X POST \
2
-H 'X-Date: 2018-02-20T15:44:42.310Z' \
3
-H 'X-Login: sak223k2wdksdl2' \
4
-H 'X-Trans-Key: fm12O7G9' \
5
-H 'Content-Type: application/json' \
6
-H 'X-Version: 2.1' \
7
-H 'User-Agent: MerchantTest / 1.0 ' \
8
-H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
9
-d '{body}'
10
https://api.dlocal.com/secure_cards
Copied!
Example request body
1
{
2
"country": "BR",
3
"card": {
4
"holder_name": "Thiago Gabriel",
5
"expiration_month": 10,
6
"expiration_year": 2040,
7
"number": "4111111111111111",
8
"cvv": "123"
9
},
10
"payer": {
11
"name": "Luis Gabriel",
12
"document": "53033315550",
13
"email": "[email protected]"
14
}
15
}
Copied!

Save a Card on a Payment

You can save a card while making a Payment / Authorization. To do so, simply add a "save" : true parameter in the card object of the request.
If the operation was successful (eg: Payment is PAID, or Authorization is AUTHORIZED) The response will include the card_id that you can use for further payments. If the operation failed (eg: Payment REJECTED), no card_id will be generated.

Example Request

Example Request
Example Response

Example Request

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

Example Request Body

1
{
2
"amount": 120.00,
3
"currency" : "USD",
4
"country": "BR",
5
"payment_method_id" : "VD",
6
"payment_method_flow" : "DIRECT",
7
"payer":{
8
"name" : "Thiago Gabriel",
9
"email" : "[email protected]",
10
"document" : "53033315550",
11
"user_reference": "12345",
12
"address": {
13
"state" : "Rio de Janeiro",
14
"city" : "Volta Redonda",
15
"zip_code" : "27275-595",
16
"street" : "Servidao B-1",
17
"number" : "1106"
18
}
19
},
20
"card":{
21
"holder_name" : "Thiago Gabriel",
22
"number" : "4111111111111111",
23
"cvv" : "123",
24
"expiration_month" : 10,
25
"expiration_year" : 2040,
26
"save" : true
27
},
28
"order_id": "657434343",
29
"notification_url": "http://merchant.com/notifications"
30
}
Copied!

Example Response

1
{
2
"id": "D-4-cf8eef6b-52d5-4320-b5ea-f5e0bbe4343f",
3
"amount": 120,
4
"currency": "USD",
5
"payment_method_id": "CARD",
6
"payment_method_type": "CARD",
7
"payment_method_flow": "DIRECT",
8
"country": "BR",
9
"card": {
10
"holder_name": "Thiago Gabriel",
11
"expiration_month": 10,
12
"expiration_year": 2040,
13
"brand": "VI",
14
"last4": "1111",
15
"card_id" : "CID-124c18a5-874d-4982-89d7-b9c256e647b5"
16
},
17
"created_date": "2018-12-26T20:26:09.000+0000",
18
"approved_date": "2018-12-26T20:26:09.000+0000",
19
"status": "PAID",
20
"status_detail": "The payment was paid",
21
"status_code": "200",
22
"order_id": "657434343",
23
"notification_url": "http://merchant.com/notifications"
24
}
Copied!

get
https://api.dlocal.com/cards/
{card_id}
Retrieve a Card

Example Request

1
curl -X POST \
2
-H 'X-Date: 2018-02-20T15:44:42.310Z' \
3
-H 'X-Login: sak223k2wdksdl2' \
4
-H 'X-Trans-Key: fm12O7G9' \
5
-H 'Content-Type: application/json' \
6
-H 'X-Version: 2.1' \
7
-H 'User-Agent: MerchantTest / 1.0 ' \
8
-H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
9
-d '{body}'
10
https://api.dlocal.com/secure_cards
Copied!
delete
https://api.dlocal.com/secure_cards/
{card_id}
Delete a card

Example Request

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

Http Errors

HTTP Status Code
Error Code
Error Detail
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.
Last modified 9d ago