# Payments and Pre-authorization Endpoints

This reference details the endpoints used for processing sales, holding funds, and confirming pre-authorizations.

## 1. Process Payment (`/pago`)

Initiates a standard sale transaction. The terminal will prompt the customer for their card.

* **URL (Test):** `https://tpvpc-i.redsys.es:27443/TPV_PC/services/rest/tpvpcwss/v1/pago`  
* **URL (Prod):** `https://tpvpc.redsys.es/TPV_PC/services/rest/tpvpcwss/v1/pago`  
* **Method:** `POST`

### Request Parameters (`datosOperacion`)

| Field | Type | Required | Max Length | Description |
| :---- | :---- | :---- | :---- | :---- |
| `importe` | Double | Yes | 12 | Transaction amount (e.g., `10.50`, `0.01`). |
| `factura` | String | Yes | 250 | Unique invoice ID or reference for the transaction. |

### Response (`info`)

Synchronous acknowledgment of the request.

| Field | Type | Description |
| :---- | :---- | :---- |
| **resultado.codigo** | String | `0` indicates successful reception. Any other value indicates an error. |

## 2. Pre-authorization (`/preautorizacion`)

Initiates a hold on funds without capturing them immediately.

* **URL (Test):** `https://tpvpc-i.redsys.es:27443/TPV_PC/services/rest/tpvpcwss/v1/preautorizacion`  
* **URL (Prod):** `https://tpvpc.redsys.es/TPV_PC/services/rest/tpvpcwss/v1/preautorizacion`  
* **Method:** `POST`

### Request Parameters (`datosOperacion`)

| Field | Type | Required | Max Length | Description |
| :---- | :---- | :---- | :---- | :---- |
| `importe` | Double | Yes | 12 | Amount to hold. |
| `factura` | String | Yes | 250 | Unique reference. Must be preserved for the Confirmation step. |

### Response (`info`)

Synchronous acknowledgment.

| Field | Type | Description |
| :---- | :---- | :---- |
| `resultado.codigo` | String | `0` indicates successful reception. |

## 3. Confirmation (`/confirmacion`)

Captures funds previously held by a Pre-authorization.

* **URL (Test):** `https://tpvpc-i.redsys.es:27443/TPV_PC/services/rest/tpvpcwss/v1/confirmacion`  
* **URL (Prod):** `https://tpvpc.redsys.es/TPV_PC/services/rest/tpvpcwss/v1/confirmacion`
* **Method:** `POST`

### Request Parameters (datosOperacion)

| Field | Type | Required | Max Length | Description |
| :---- | :---- | :---- | :---- | :---- |
| `importe` | Double | Yes | 12 | Amount to capture. Can be less than or equal to the pre-auth amount. |
| `factura` | String | Yes | 250 | **Must match** the `factura` of the original pre-authorization. |

### Response (`info`)

Synchronous acknowledgment.

| Field | Type | Description |
| :---- | :---- | :---- |
| `resultado.codigo` | String | `0` indicates successful reception. |