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

# Create a Refund

> Cria um refund.

Cria um `refund` para uma charge capturada. Envie `charge` ou `payment_intent`;
quando `payment_intent` é usado, a Chargefy resolve a charge capturada
automaticamente. Se `amount` não for enviado, o refund usa todo o valor ainda
disponível.

Payment intents em `requires_capture` ainda não foram capturados e não geram
refund. Nesse caso, cancele o payment intent com
[`POST /v1/payment-intents/:id/cancel`](/api-reference/payment-intents/cancel).

Fees cobradas pela Chargefy não são devolvidas quando um refund é criado.

<ParamField body="charge" type="string">
  ID da charge que será reembolsada (`ch_*`). Envie `charge` ou
  `payment_intent`, não ambos.
</ParamField>

<ParamField body="payment_intent" type="string">
  ID do payment intent (`pi_*`) cuja charge capturada será reembolsada. Envie
  `charge` ou `payment_intent`, não ambos.
</ParamField>

<ParamField body="amount" type="integer">
  Valor do refund, em centavos. Se omitido, usa o valor disponível inteiro.
</ParamField>

<ParamField body="metadata" type="object">
  Pares chave-valor livres associados ao refund.
</ParamField>

<ParamField body="reason" type="string">
  Motivo do refund: `duplicate`, `fraudulent` ou `requested_by_customer`.
  Chargeback/dispute é um fluxo separado, não um motivo de refund.
</ParamField>

<RequestExample>
  ```bash Por charge theme={}
  curl -X POST "https://api.chargefy.io/v1/refunds" \
    -H "Authorization: Bearer {{API_KEY}}" \
    -H "Content-Type: application/json" \
    -d '{
      "charge": "ch_123"
    }'
  ```

  ```bash Por payment_intent theme={}
  curl -X POST "https://api.chargefy.io/v1/refunds" \
    -H "Authorization: Bearer {{API_KEY}}" \
    -H "Content-Type: application/json" \
    -d '{
      "payment_intent": "pi_123"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response 200 theme={}
  {
    "id": "re_123",
    "object": "refund",
    "amount": 5000,
    "balance_transaction": null,
    "charge": "ch_123",
    "created_at": "2026-05-20T18:35:00Z",
    "currency": "brl",
    "customer": "cus_123",
    "description": null,
    "destination_details": null,
    "failure_balance_transaction": null,
    "failure_reason": null,
    "instructions_email": null,
    "livemode": true,
    "metadata": {
      "order_id": "1001"
    },
    "next_action": null,
    "payment_intent": "pi_123",
    "pending_reason": null,
    "reason": "requested_by_customer",
    "receipt_number": null,
    "source_transfer_reversal": null,
    "status": "succeeded",
    "transfer_reversal": null,
    "updated_at": "2026-05-20T18:35:00Z"
  }
  ```
</ResponseExample>
