Card payments
Learn how to start receiving card payments.
Create a payment
With dLocal API you can build your own payment form and take full control over the look and feel and experience of your checkout.
Type of payment | Description |
---|---|
Pay with card information | If your business is Full PCI DSS compliant, you can use the card information for credit card payments. See example |
Pay with Smart Fields | If your business is not Full PCI DSS compliant, you need to securely collect the card information using Smart Fields. See example |
Pay with save card | For recurring payments, first save the card, and then use the card_id to charge the card.See example |
Important
If you are making a payment with credit card information or a Google Pay™ token, you need to use the following endpoint instead:
https://api.dlocal.com/secure_payments
.Card payments with a
card_id
ortoken
should use the endpoint:https://api.dlocal.com/payments
.
Ready-to-use solution
If you'd rather not build your own experience, you can process payments safely and simply with a ready-to-use design and front end. Learn more about Checkout Redirect.
Example payments
General card payment
Take the following payment request as an example of a general payment for cards
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
{
"amount": "100",
"currency": "USD",
"country": "BR",
"payment_method_id": "CARD",
"payment_method_flow": "REDIRECT",
"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"
},
"ip" : "2001:0db8:0000:0000:0000:ff00:0042:8329",
"device_id" : "2fg3d4gf234"
},
"order_id": "657434343",
"notification_url": "http://merchant.com/notifications"
}
{
"id": "D-4-9270c8c5-91b1-434d-a9cb-08ebd702b190",
"amount": 100,
"currency": "USD",
"payment_method_id": "CARD",
"payment_method_type": "CARD",
"payment_method_flow": "REDIRECT",
"country": "BR",
"created_date": "2018-12-26T20:26:09.000+0000",
"status": "PENDING",
"status_detail": "The payment is pending.",
"status_code": "100",
"order_id": "657434343",
"description": "",
"notification_url": "http://merchant.com/notifications",
"redirect_url": "https://pay.dlocal.com/collect/pay/pay/M-997f9..."
}
Pay with card information
The following example applies for credit card payments using the plain credit card information (only for Full PCI DSS merchants). To make payments using encrypted card information, simply replace the number
and cvv
parameters with encrypted_data
.
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
{
"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"
},
"ip" : "2001:0db8:0000:0000:0000:ff00:0042:8329",
"device_id" : "2fg3d4gf234"
},
"card":{
"holder_name" : "Thiago Gabriel",
"number" : "4111111111111111",
"cvv" : "123",
"expiration_month" : 10,
"expiration_year" : 2040
},
"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"
},
"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"
}
Pay with Smart fields
The following example applies for credit card payments using a Smart Fields token
.
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/payments
{
"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"
},
"ip" : "2001:0db8:0000:0000:0000:ff00:0042:8329",
"device_id" : "2fg3d4gf234"
},
"card":{
"token": "CV-124c18a5-874d-4982-89d7-b9c256e647b5"
},
"order_id": "657434343",
"notification_url": "http://merchant.com/notifications"
}
{
"id": "D-4-80ca7fbd-67ad-444a-aa88-791ca4a0c2b2",
"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"
},
"created_date": "2018-12-26T20:28:47.000+0000",
"approved_date": "2018-12-26T20:28:47.000+0000",
"status": "PAID",
"status_detail": "The payment was paid",
"status_code": "200",
"order_id": "657434343",
"notification_url": "http://merchant.com/notifications"
}
Pay with saved card
The following example applies for credit card payments using the card_id
gotten in the Create a Card method.
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/payments
{
"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"
},
"ip" : "2001:0db8:0000:0000:0000:ff00:0042:8329",
"device_id" : "2fg3d4gf234"
},
"card":{
"card_id": "CID-124c18a5-874d-4982-89d7-b9c256e647b5"
},
"order_id": "657434343",
"notification_url": "http://merchant.com/notifications"
}
{
"id": "D-4-80ca7fbd-67ad-444a-aa88-791ca4a0c2b2",
"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"
},
"created_date": "2018-12-26T20:28:47.000+0000",
"approved_date": "2018-12-26T20:28:47.000+0000",
"status": "PAID",
"status_detail": "The payment was paid",
"status_code": "200",
"order_id": "657434343",
"notification_url": "http://merchant.com/notifications"
}
Let’s collaborate to create a better experience.
Give feedbackUpdated 2 months ago