---
updatedAt: 2026-07-27T09:12:27.000Z
agentTools:
  projectIndex: https://docs.dlocal.com/llms.txt
---

# Authorization and capture

Understand the payment process that allows you to authorize funds before capturing them.

Authorizing a card payment allows you to reserve funds in a customer's bank account, days before the actual payment occurs – for example when making hotel reservations or booking car rentals.

# How does it work

It's a two-step process. First, you need to create an Authorization, and then you need to Capture it.

# Create an authorization

To create an authorization, simply [create a regular card payment](https://docs.dlocal.com/reference/create-payment) with the parameter `capture = FALSE` within the `card` object.

## Example

Send this request to `https://api.dlocal.com/secure_payments`.

```json Example Authorization request
{
    "amount": 120,
    "currency" : "USD",
    "country": "BR",
    "payment_method_id" : "CARD",
    "payment_method_flow" : "DIRECT",
    "payer":{
        "name" : "Thiago Gabriel",
        "email" : "thiago@example.com",
        "document" : "53033315550"
    },
    "card":{
        "holder_name" : "Thiago Gabriel",
        "number" : "4111111111111111",
        "cvv" : "123",
        "expiration_month" : 10,
        "expiration_year" : 2040,
        "capture" : false
    },
    "order_id": "657434343",
    "notification_url": "http://merchant.com/notifications"
}
```
```json Example Authorization response
{
    "id": "D-4-e2227981-8ec8-48fd-8e9a-19fedb08d73a",
    "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": "2019-02-06T21:04:43.000+0000",
    "approved_date": "2019-02-06T21:04:44.000+0000",
    "status": "AUTHORIZED",
    "status_detail": "The payment was authorized",
    "status_code": "600",
    "order_id": "657434343",
    "notification_url": "http://merchant.com/notifications"
}
```

The `id` returned corresponds to the unique identifier of the Authorization (`authorization_id`).

# Capture an authorization

## Example

[block:html]
{
  "html": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>URL Selector with Opacity</title>\n  <style>\n    .url-container {\n      display: flex;\n      align-items: center;\n      border-radius: 16px;\n      background-color: #fff;\n      padding: 10px;\n      box-shadow: 0 0 0px 1px #F5F5F5;\n      box-sizing: border-box;\n      border-color: transparent;\n      margin-top: 20px;\n      margin-bottom: 20px;\n      gap: 10px;\n      width: 100%;\n    }\n    \n         [data-color-mode=\"dark\"] .url-container {\n      background-color: #F7F7F7;\n    }\n\n    .url-container .url-selector {\n      display: none;\n    }\n\n    .url-container label {\n      padding: 5px 5px;\n      border: 1px solid #ccc;\n      border-radius: 8px;\n      font-size: 11px;\n      color: #333;\n      background-color: #f9f9f9;\n      cursor: pointer;\n      transition: opacity 0.3s ease;\n    }\n\n    /* Reduce opacity for unselected labels */\n    #base-a:not(:checked) ~ label[for=\"base-a\"],\n    #sandbox-a:not(:checked) ~ label[for=\"sandbox-a\"] {\n      opacity: 0.5;\n    }\n\n    .url-container .pill-button {\n      border: none;\n      box-shadow: var(--box-shadow-pill);\n      background-color: #0171c2;\n      color: white;\n      padding: 5px 15px;\n      font-size: 14px;\n      border-radius: 25px;\n      text-transform: uppercase;\n      cursor: default; /* Cambia el cursor para indicar que no es clickeable */\n      text-shadow: 1px 1px 0 #0168b3, 0 1px 0 #0168b3, 1px 0 0 #0168b3;\n      margin-left: 5px;\n      white-space: nowrap !important;\n    }\n\n\n    .url-input {\n      display: none;\n      flex-grow: 1; /* Permitir que el input ocupe todo el espacio disponible */\n    }\n\n    #base-a:checked ~ .url-input[data-url=\"base-a\"],\n    #sandbox-a:checked ~ .url-input[data-url=\"sandbox-a\"] {\n     display: block;\n    }\n\n    .url-input input {\n      width: 100%;\n      border: none;\n      outline: none;\n      flex-grow: 1;\n      border-radius: 8px;\n      padding: 5px;\n      font-size: 12px;\n      color: #333;\n      user-select: all;\n    }\n\n    .url-input input:focus {\n      outline: 1px solid #F5F5F5;\n      border-radius: 16px;\n    }\n    \n\n/* Mobile-specific styles */\n@media screen and (max-width: 768px) {\n.url-container {\n    display: flex;\n    align-items: center;\n    flex-wrap: wrap; \n    width: 100%; \n    max-width: 100%; \n    box-sizing: border-box; \n}\n  \n.url-input input {\n    border: none;\n    outline: none;\n    border-radius: 8px;\n    padding: 5px;\n    font-size: 12px;\n    color: #333;\n    user-select: all;\n    width: 100%; /* Ocupa todo el ancho disponible */\n    max-width: 100%; /* No permite desbordarse */\n}\n}\n  </style>\n</head>\n<body>\n  <div class=\"url-container\">\n    <!-- Botón visual -->\n    <div class=\"pill-button\">Post</div>\n    \n    <!-- Radio inputs for URL options -->\n    <input id=\"base-a\" type=\"radio\" name=\"url\" class=\"url-selector\" checked>\n    <label for=\"base-a\">Production URL</label>\n    <input id=\"sandbox-a\" type=\"radio\" name=\"url\" class=\"url-selector\">\n    <label for=\"sandbox-a\">Sandbox URL</label>\n\n    <!-- URL Display (readonly inputs) -->\n    <div class=\"url-input\" data-url=\"base-a\">\n      <input type=\"text\" readonly value=\"https://api.dlocal.com/payments\">\n    </div>\n    <div class=\"url-input\" data-url=\"sandbox-a\">\n      <input type=\"text\" readonly value=\"https://sandbox.dlocal.com/payments\">\n    </div>\n  </div>\n</body>\n</html>"
}
[/block]

```json Example capture request
{
    "authorization_id": "D-4-e2227981-8ec8-48fd-8e9a-19fedb08d73a",
    "amount": 120,
    "currency": "USD",
    "order_id": "657434343-1"
}
```
```json Example capture response
{
    "id": "D-4-09f52dd0-5cfa-4b0e-a471-1608ea0dba24",
    "amount": 120,
    "currency": "USD",
    "country": "BR",
    "created_date": "2019-02-07T13:47:06.000+0000",
    "approved_date": "2019-02-07T13:47:06.000+0000",
    "status": "PAID",
    "status_detail": "The payment was paid",
    "status_code": "200",
    "order_id": "657434343-1",
    "authorization_id": "D-4-e2227981-8ec8-48fd-8e9a-19fedb08d73a"
}
```

## Parameter details

### Body

| Property             | Type   | Description                                                                                                                                                                                                  |
| :------------------- | :----- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `authorization_id`\* | string | ID of the Authorization to be captured.                                                                                                                                                                      |
| `amount`\*           | number | Amount to be captured (in the `currency` specified in currency). Must be equal to or less than the authorized amount.<br>**If not included, the capture will be for the total amount of the authorization.** |
| `currency`           | string | Transaction currency in [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217). Each country accepts USD and local currency.<br>**Required if amount is present**.                                                |
| `order_id`           | string | ID of the capture given by the merchant in their system. Think of it as an external id of the capture.                                                                                                       |

* Required

# Authorization Cancellation

Authorization can be canceled before it is captured if the payment is no longer needed.

## Example

Send this request to `https://api.dlocal.com/payments/{authorization_id}/cancel`.

```json Example cancel 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 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec'
```
```json Example cancel response
{
    "id": "D-4-09f52dd0-5cfa-4b0e-a471-1608ea0dba24",
    "amount": 120,
    "currency": "USD",
    "payment_method_id": "CARD",
    "payment_method_type": "CARD",
    "payment_method_flow": "DIRECT",
    "country": "BR",
    "created_date": "2019-02-07T17:37:36.000+0000",
    "approved_date": "2019-02-07T17:37:36.000+0000",
    "status": "CANCELLED",
    "status_detail": "The payment was cancelled",
    "status_code": "400",
    "order_id": "be2fbac6-6114-44dc-a5f5-c4cdc38dda57",
    "notification_url": "http://conductor.sandbox.internal/robot-server/rest/generic/notification/new"
} 
```

## Parameter details

### Path

| Property             | Type   | Description           |
| :------------------- | :----- | :-------------------- |
| `authorization_id`\* | string | The Authorization ID. |

* Required

# $0 Authorization

Use a $0 Authorization to validate the user's card. You need to create an Authorization as explained above, but with `amount = 0` and `verify = true` within the `card` object:

```json Example request
{
    "amount": 0,
    "currency": "BRL",
    "country": "BR",
    "payment_method_id": "CARD",
    "payment_method_flow": "DIRECT",
    "payer": {
        "name": "MXFGpBEw AJsGTALt",
        "email": "0yesa0xbd3g2-autest@dlocal.com",
        "phone": "4832695335",
        "address": {
            "country": "BR",
            "state": "Santa Catarina",
            "city": "Florianopolis",
            "zip_code": "88058",
            "street": "Rodovia Armando Calil Bulos",
            "number": "5940"
        },
        "document": 26410722
    },
    "card": {
        "holder_name" : "Thiago Gabriel",
        "expiration_month": 7,
        "expiration_year": 2024,
        "brand": "Visa",
        "verify": true,
        "capture": false,
        "cvv": "***",
        "number": "42976**********"
    },
    "order_id": "BENtest-h8fJ8blUTjY",
    "description": "LO4nLkTqt2tt",
    "notification_url": "https://postman-echo.com/post"
}
```
```json Example response
{
    "id": "T-40004-eebc14d9-8381-4bf6-b8b7-82acbb06f166",
    "amount": 0,
    "currency": "BRL",
    "payment_method_id": "CARD",
    "payment_method_type": "CARD",
    "payment_method_flow": "DIRECT",
    "country": "BR",
    "card": {
        "holder_name" : "Thiago Gabriel",
        "expiration_month": 7,
        "expiration_year": 2024,
        "brand": "VI",
        "last4": "8528",
        "verify": true
    },
    "created_date": "2020-09-29T17:42:40.000+0000",
    "approved_date": "2020-09-29T17:42:40.000+0000",
    "status": "VERIFIED",
    "status_detail": "The payment was verified.",
    "status_code": "700",
    "order_id": "BENtest-h8fJ8blU",
    "description": "LO4nLkTqt2tt",
    "notification_url": "https://postman-echo.com/post"
}
```

# Refunds for captures

> Refunds are applied to the Captures, not the Authorization.

## Make a refund

On the `payment_id` parameter, make sure to include the `id` of the Capture, not the Authorization.

## Parameter details

### Body

| Property             | Type   | Description                                                                                                                                                   |
| :------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `payment_id`\*       | string | The ID of the capture.                                                                                                                                        |
| `notification_url`\* | string | If a refund is `PENDING`, the refund confirmation is sent asynchronously to this URL.                                                                         |
| `amount`\*           | number | Amount to refund. If the amount is empty, then the default is the total amount of the payment.<br>**Required if `currency` is present**.                      |
| `currency`           | string | Transaction currency in [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217). Each country accepts USD and local currency.<br>**Required if amount is present**. |
| `description`        | string | Description of the refund.                                                                                                                                    |

* Required

## Example

```json Example response
{
   "id" : "REF42342",
   "payment_id" : "D-4-09f52dd0-5cfa-4b0e-a471-1608ea0dba24",
   "notification_url" : "http://some.url",
   "amount" : 803.04,
   "currency" : "BRL",
   "status" : "SUCCESS",
   "status_code" : 200,
   "status_detail" : "The refund was paid",
   "created_date" : "2018-09-06T22:03:03.000+0000",
   "amount_refunded" : 803.04
}
```

Read more about the [Refunds request](https://docs.dlocal.com/reference/refunds-reference).