# Refund a Payment

The API Cloud supports returning funds to a customer through two distinct operations. Choosing the right method depends on whether the customer is physically present with their card or if you are processing a remote administrative refund.

## Method 1: Referenced Refund (No Card Required)

This is the most common method for administrative returns. It allows you to refund a transaction programmatically using the original Order ID (`pedidoBase`), without requiring the customer to insert their card at the terminal.

* **Endpoint:** `/devolucion`  
* **Method:** `POST`  
* **Use Case:** Back-office refunds, e-commerce returns, or correcting errors after the customer has left.

### Step 1: Send Refund Request

You must provide the `pedidoBase` (the unique Order ID generated by the API during the original sale) and the amount to refund.

```
{
  "info": {
    "comercio": "777888991",
    "terminal": 1,
    "timestamp": "20250428 140000",
    "datosOperacion": {
      "importe": "5.00",
      "factura": "REFUND-001",
      "pedidoBase": "916548"
    }
  },
  "signature": "YOUR_CALCULATED_SIGNATURE"
}
```

> **Partial Refunds**: You can refund an amount smaller than the original transaction (Partial Refund). However, you cannot refund more than the original amount.

### Step 2: Receive Response

Since no physical interaction is required, this operation often completes synchronously, returning the result directly in the response payload if successful.

**Success Response Example:**

```
{
  "info": {
    "resultado": { "codigo": "0" },
    "resultadoDevolucion": {
      "importe": "5.00",
      "resultado": "Autorizada",
      "estado": "F",
      "pedidoBase": "916548"
    }
  },
  "signature": "SERVER_SIGNATURE"
}
```

## Method 2: Card-Present Refund

If your business policy requires the customer to be present to verify the card, use the Card-Present method. This flow triggers the terminal to ask for the card insertion.

* **Endpoint:** `/devolucionTarjeta` 
* **Method:** `POST`  
* **Use Case:** In-store returns where card verification is mandatory.

### Step 1: Send Request

The payload is nearly identical to the referenced refund, but you must include a notification URL because the process becomes **asynchronous** (waiting for the terminal).

```
{
  "info": {
    "comercio": "777888991",
    "terminal": 1,
    "timestamp": "20250428 143000",
    "notificacion": {
      "urlNotificacion": "https://your-server.com/api/webhooks/refunds"
    },
    "datosOperacion": {
      "importe": "5.00",
      "factura": "REFUND-STORE-002",
      "pedidoBase": "916548"
    }
  },
  "signature": "YOUR_CALCULATED_SIGNATURE"
}
```

### Step 2: Handle Notification

The API will send a `POST` request to your `urlNotificacion` once the card is read and the bank authorizes the return.

## Receipt Requirements

Refund receipts have a specific compliance requirement that differs from sales receipts.

> **Merchant Signature Required**: For refund receipts provided to the customer, you **must** print a signature box. Unlike a sale where the customer signs, **the merchant must sign or stamp the refund receipt** to acknowledge the return of funds to the client.

## Troubleshooting

| Error Code | Meaning | Solution |
| :---- | :---- | :---- |
| **TPVPC0009** | *The refund amount exceeds the amount of the original operation.* | Check that the `importe` is less than or equal to the original transaction amount. |
| **TPVPC0100** | *You cannot perform a REFUND / CONFIRMATION on the specified operation.* | Confirm the `pedidoBase` and that the original transaction accepts a refund. |

## Next Steps

* [**Query Transaction History**](/en/get-smart/get-smart-api-cloud/integration-guides/query-transaction-history)**:** Verify the state of the original order to get the correct `pedidoBase` before refunding.  
* [**Receipt Printing Specifications**](/en/get-smart/get-smart-api-cloud/reference/receipt-printing-specifications)**:** See the specific layout for refund tickets.