> ## Documentation Index
> Fetch the complete documentation index at: https://scaleup-c34c4386.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /api/v1/refunds/

> Cria um novo reembolso para uma venda

Processa um reembolso para uma venda existente. Permite reembolso total ou parcial.

## Autenticação

> [!NOTE]
>
> Requer um token de acesso válido (`CHARGEFY_ACCESS_TOKEN`) no header `Authorization`.

## Parâmetros do Body

| Parâmetro | Tipo | Obrigatório | Descrição |
| - | - | - | - |
| `saleId` | `string` | Sim | ID da venda a ser reembolsada |
| `amount` | `integer` | Não | Valor em centavos (omitir para reembolso total) |
| `reason` | `string` | Não | Motivo do reembolso |

## Campos da Resposta

| Campo | Tipo | Descrição |
| - | - | - |
| `id` | `string` | ID do reembolso |
| `saleId` | `string` | ID da venda |
| `amount` | `integer` | Valor reembolsado em centavos |
| `currency` | `string` | Moeda |
| `reason` | `string` | Motivo do reembolso |
| `status` | `string` | Status (`pending`, `succeeded`, `failed`) |
| `createdAt` | `datetime` | Data de criação |

## Exemplo de Requisição

```bash cURL theme={null}
curl -X POST "https://api.chargefy.io/api/v1/refunds/" \
  -H "Authorization: Bearer $CHARGEFY_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "saleId": "sale_abc123",
    "amount": 5000,
    "reason": "Cliente solicitou cancelamento"
  }'
```

```typescript SDK theme={null}
import { Chargefy } from '@chargefy/sdk';

const chargefy = new Chargefy({
  accessToken: process.env.CHARGEFY_ACCESS_TOKEN,
});

const refund = await chargefy.sales.refund('sale_abc123', {
  amount: 5000,
  reason: 'Cliente solicitou cancelamento',
});
```

## Exemplo de Resposta

```json theme={null}
{
  "id": "ref_xyz789",
  "saleId": "sale_abc123",
  "amount": 5000,
  "currency": "brl",
  "reason": "Cliente solicitou cancelamento",
  "status": "succeeded",
  "createdAt": "2026-03-12T14:30:00Z"
}
```


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