> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compago.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Refunds

> Refund any payment by its id, whichever way it was charged

## Overview

`POST /developer/v1/refund` refunds a sale by its payment id. It works the same for every way a payment is charged: a payment link, a one-time payment, a terminal charge sent as a payment intent, or a charge to a saved card. Your integration does not need to know which endpoint created the sale, only the `id` that [`GET /developer/v1/payment`](https://docs.compago.com/developer/payments) returns.

> [!NOTE]
>
> These examples call the production host. While you build, replace `https://api-harmony.compago.com` with `https://demo-api-harmony.compago.com` and use a key from the Demo dashboard. See [Environments](https://docs.compago.com/get-started/environments.md).

## Refund a payment

```bash theme={null}
curl -X POST https://api-harmony.compago.com/api/developer/v1/refund \
  -H "x-api-key: $COMPAGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "paymentId": "11111111-2222-3333-4444-555555555555" }'
```

```json theme={null}
{
  "id": "9f1c2d3e-4b5a-4c6d-8e7f-0a1b2c3d4e5f",
  "object": "refund",
  "paymentId": "11111111-2222-3333-4444-555555555555",
  "amount": 1150,
  "currency": "MXN",
  "status": "SUCCEEDED",
  "failureReason": null,
  "createdAt": "2026-11-06T18:04:11.000Z",
  "updatedAt": "2026-11-06T18:04:11.000Z"
}
```

Once the bank was asked, the answer is `201` with the refund, whatever the bank said. A refund that went through reads `SUCCEEDED` and the payment now reads `status: "REFUNDED"` with its `refundedAt`. A refund the bank declined reads `FAILED` with `failureReason: "DECLINED"`, and the sale stays paid.

| Field | Meaning |
| - | - |
| `id` | The refund's identifier. Read it again with `GET /developer/v1/refund/{id}` |
| `paymentId` | The sale refunded |
| `amount` | What went back to the customer: the sale and its tip |
| `status` | `SUCCEEDED` once the bank accepted it. `PENDING` while a bank transfer (SPEI) refund is on its way, `FAILED` if the bank refused it |
| `failureReason` | `DECLINED` when the bank declined the card refund, `RETURN_FAILED` when a transfer could not be sent back. `null` otherwise |

## Full refunds only, for now

Every sale is refunded in full: the whole charge, sale and tip, goes back to the card or account it came from. `amount` is optional. If you send it, it must be the payment's `chargedAmount`; any other amount is refused with `400 PARTIAL_REFUND_NOT_SUPPORTED` and nothing is refunded. Partial refunds will be accepted here, with the same request, for the payment methods that support them.

## The rules

The same rules apply as to every refund through the API:

* **The same day.** A sale can be refunded until 10:30 PM Mexico City time on the day it was approved (10:00 PM for American Express). After that, refund it from the dashboard.
* **Meses sin intereses.** A Super MSI sale cannot be refunded through the API once a monthly installment was collected.
* **Compago's fee.** When your refund terms keep the fee, it is taken from what you have pending to settle. See [Refunds and fees](https://docs.compago.com/refunds/refunds-and-fees.md).
* **Store integrations.** A sale charged by an integration that refunds its own orders (such as Shopify) is refunded there, so the order and the money never disagree.

## Errors

Every error body is `{ "message", "code" }`. Branch on `code`.

| Status | Code | Meaning |
| - | - | - |
| `400` | `PARTIAL_REFUND_NOT_SUPPORTED` | `amount` is not the whole charge |
| `400` | `NOT_REFUNDABLE` | The payment was not approved (declined, cancelled, a hold not captured) |
| `400` | `REFUND_WINDOW_EXPIRED` | Past the same-day window |
| `400` | `REFUND_INSTALLMENTS_COLLECTED` | Installments were already collected on the sale |
| `403` | `INSUFFICIENT_SCOPE` | The key lacks the `refund:write` scope («Reembolsar pagos») |
| `404` | `NOT_FOUND` | No such payment in your organization |
| `409` | `ALREADY_REFUNDED` | The sale was already refunded. Safe to treat as done |
| `409` | `REFUND_FEE_NOT_COVERED` | What you have pending to settle does not cover Compago's fee. Nothing reached the bank |
| `409` | `REFUND_THROUGH_INTEGRATION` | The sale was charged by an integration that refunds its own orders. Refund it there |

> [!TIP]
>
> A request that times out may still have refunded the sale. Retry it: a sale already refunded answers `409 ALREADY_REFUNDED`, never a second refund. Then read the refund with `GET /developer/v1/refund?paymentId=...`.

## List and read refunds

```bash theme={null}
curl "https://api-harmony.compago.com/api/developer/v1/refund?paymentId=11111111-2222-3333-4444-555555555555" \
  -H "x-api-key: $COMPAGO_API_KEY"
```

`GET /developer/v1/refund` lists your organization's refunds, newest first, with the same [pagination](https://docs.compago.com/core-concepts/pagination.md) as every other list. Filter by `paymentId` to get the refund of one sale. `GET /developer/v1/refund/{id}` reads one.

## Next steps

> [card] [Refund API reference](https://docs.compago.com/api-reference/developer/refund/create.md)
>
> The endpoint's full schema.

> [card] [Refunds and fees](https://docs.compago.com/refunds/refunds-and-fees.md)
>
> What a refund costs and when it is refused.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.