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

# Estornar cobrança avulsa

> Estorno total ou parcial de cobrança já paga.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://api.goatpay.com.br/v1/billings/refund/clx_billing' \
    -H 'X-API-Key: gp_live_SUA_CHAVE' \
    -H 'Content-Type: application/json' \
    -d '{ "amount": 50 }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true,
    "message": "Cobrança estornada",
    "data": {
      "id": "clx_billing",
      "status": "REFUNDED",
      "statusLabel": "Estornado",
      "billingType": "PIX",
      "amount": 79.9,
      "netAmount": 76.91,
      "feeAmount": 2.99,
      "notificationFeeAmount": 0,
      "installmentCount": 1,
      "description": "Pedido 123",
      "dueAt": "2026-06-15T23:59:59.000Z",
      "dueDate": "2026-06-15",
      "paidAt": "2026-05-31T14:22:00.000Z",
      "estimatedCreditDate": "2026-06-02T00:00:00.000Z",
      "invoiceUrl": "https://...",
      "bankSlipUrl": null,
      "digitableLine": null,
      "pixCopyPaste": "00020101021226730014br.gov.bcb.pix...",
      "pixEncodedImage": "iVBORw0KGgo...",
      "accountTransactionId": "clx_ledger",
      "externalReference": "pedido-123",
      "createdAt": "2026-05-30T10:00:00.000Z",
      "customer": {
        "id": "clx_customer",
        "name": "Cliente Exemplo",
        "taxId": "12345678909"
      }
    },
    "requestId": "req_abc123"
  }
  ```
</ResponseExample>

### Corpo da requisição

<ParamField body="amount" type="number">
  Valor parcial em reais; omita para estorno total.
</ParamField>

### Parâmetros de rota

<ParamField path="id" type="string" required>
  ID interno da cobrança ou `pay_...`.
</ParamField>

<Note>
  Estorno disponível para cobranças com status RECEIVED ou CONFIRMED.
</Note>
