# Handle Pre-authorizations and Confirmations

The Pre-authorization flow allows you to reserve funds on a customer's card (Hold) and capture them later (Confirm). This is distinct from a standard "Sale" where the funds are captured immediately.

This process involves two distinct API operations:

1. **Pre-authorization (`/preautorizacion`):** The terminal verifies the card and holds the funds.  
2. **Confirmation (`/confirmacion`):** You explicitly capture the funds (in full or in part) to complete the transaction.

## Phase 1: Create the Pre-authorization

The first step is to initiate the hold. This looks very similar to a standard payment request but uses a different endpoint.

* **Endpoint:** `/preautorizacion`
* **Method:** `POST`

### Step 1.1: Send Request

Send the amount you wish to hold. You must provide a unique factura (Invoice ID) which will serve as the reference for the future confirmation.

```
{
  "info": {
    "comercio": "777888991",
    "terminal": 1,
    "timestamp": "20250428 120000",
    "notificacion": {
      "urlNotificacion": "https://your-server.com/api/webhooks/preauth",
      "correoNotificacion": "admin@merchant.com"
    },
    "datosOperacion": {
      "importe": "100.00",
      "factura": "RES-Hotel-001"
    }
  },
  "signature": "YOUR_CALCULATED_SIGNATURE"
}
```

### Step 1.2: Receive Notification

Just like a standard payment, the physical terminal interaction is asynchronous. You will receive a notification at your `urlNotificacion`.

* `tipoPago`: Will be `PREAUTORIZACION`.  
* `resultado`: Look for `Autorizada`.  
* **Action**: Do **not** consider the money received. Only considered the funds "reserved" or "held".

## Phase 2: Confirm the Transaction

When you are ready to charge the customer (e.g., guest check-out, car return), you must send a confirmation request.

> **Matching References**: The `factura` (Invoice ID) used in the confirmation **must** match the `factura` used in the original pre-authorization. This is how the system links the capture to the hold.

* **Endpoint:** `/confirmacion`  
* **Method:** `POST`

### Step 2.1: Send Confirmation Request

You specify the amount to capture.

```
{
  "info": {
    "comercio": "777888991",
    "terminal": 1,
    "timestamp": "20250429 080000",
    "datosOperacion": {
      "importe": "100.00",
      "factura": "RES-Hotel-001"
    }
  },
  "signature": "YOUR_CALCULATED_SIGNATURE"
}
```

### Step 2.2: Handle Response

Unlike the initial interaction, the Confirmation is often processed server-to-server without requiring the cardholder to re-insert their card.

You will receive a notification confirming the capture:

* `resultado`: `Autorizada`.

## Important Considerations

* **Error Handling:** If you try to confirm an operation that does not exist or has already been confirmed, you may receive specific error codes.  
  * `TPVPC0094`: "No es posible realizar más confirmaciones sobre la preautorización original" (Cannot perform more confirmations on the original pre-authorization).

## Next Steps

* [**Refund a Payment**](/en/get-smart/get-smart-api-cloud/integration-guides/refund-a-payment)**:** Learn how to return funds if a confirmation was made in error.  
* [**Query Transaction History**](/en/get-smart/get-smart-api-cloud/integration-guides/query-transaction-history)**:** Check the status of your pre-authorizations if you are unsure if they are confirmed.