Saving cards
Learn how to securely store and manage payment cards for future transactions with dLocal.
Create a card
Securely register a card with dLocal and get a card_id you can use for future payments.
This allows you to securely save card details beforehand, without processing them until you are ready to initiate a transaction.
Example request
curl -X POST \
   -H 'X-Date: {X-Date}' \
   -H 'X-Login: {X-Login}' \
   -H 'X-Trans-Key: {X-Trans-Key}' \
   -H 'Content-Type: application/json' \
   -H 'X-Version: 2.1' \
   -H 'User-Agent: MerchantTest / 1.0 ' \
   -H 'Authorization: V2-HMAC-SHA256, Signature: {Signature}' \
   -d '{body}'
    https://api.dlocal.com/secure_cards
{
  "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]"
  }
}
See how to create a card in the API Reference section.
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 payment or authorization is successful (e.g. status is 
PAIDorAUTHORIZED), the response will include acard_idyou can reuse in future transactions. - If the operation fails (e.g. status is 
REJECTED), nocard_idwill be generated. 
Example request
curl -X POST \
   -H 'X-Date: {X-Date}' \
   -H 'X-Login: {X-Login}' \
   -H 'X-Trans-Key: {X-Trans-Key}' \
   -H 'Content-Type: application/json' \
   -H 'X-Version: 2.1' \
   -H 'User-Agent: MerchantTest / 1.0 ' \
   -H 'Authorization: V2-HMAC-SHA256, Signature: {Signature}' \
   -d '{body}'
    https://api.dlocal.com/secure_payments
{
  "amount": 120,
  "currency": "USD",
  "country": "BR",
  "payment_method_id": "VD",
  "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"
}
Retrieve a card
Fetch details of a previously saved card using its card_id.
Example request
curl -X GET \
   -H 'X-Date: {X-Date}' \
   -H 'X-Login: {X-Login}' \
   -H 'X-Trans-Key: {X-Trans-Key}' \
   -H 'X-Version: 2.1' \
   -H 'User-Agent: MerchantTest / 1.0 ' \
   -H 'Authorization: V2-HMAC-SHA256, Signature: {Signature}' \
    https://api.dlocal.com/cards/{card_id}
Delete a card
Remove a saved card from dLocal's vault using its card_id.
Example request
curl -X DELETE \
   -H 'X-Date: {X-Date}' \
   -H 'X-Login: {X-Login}' \
   -H 'X-Trans-Key: {X-Trans-Key}' \
   -H 'X-Version: 2.1' \
   -H 'User-Agent: MerchantTest / 1.0 ' \
   -H 'Authorization: V2-HMAC-SHA256, Signature: {Signature}' \
   -d '{body}'
    https://api.dlocal.com/secure_cards/{card_id}
See how to retrieve a card in the API Reference section.
HTTP Errors
See all the HTTP Errors in the API Reference section.
Updated 12 days ago
