> ## 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.

# Cancelar boleto

> Solicita o cancelamento do boleto e mantém o pagamento disponível para outra tentativa.

Cancela somente o boleto da tentativa atual. A fatura continua aberta, e o
pagamento volta a `requires_payment_method` assim que o pedido é registrado.
Outro boleto ou método pode ser usado sem esperar a confirmação. Se o banco não
responder na hora, a Chargefy repete o pedido sozinha.

A charge mantém o estado pendente e recebe `cancellation_requested_at`.
Somente a confirmação bancária muda o boleto para `canceled`. Até lá, ele
pode ser pago; o recebimento sempre é registrado. A ação não se aplica a
pagamentos de sessões de checkout.

**id** `string` *required*

ID do pagamento que possui o boleto pendente.

```bash cURL theme={"theme":"css-variables"}
curl -X POST "https://api.chargefy.io/v1/payment-intents/pi_enozN8CHArFsMBxB/cancel_boleto" \
  -H "Authorization: Bearer {{API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```json 200 theme={"theme":"css-variables"}
{
  "id": "pi_enozN8CHArFsMBxB",
  "object": "payment_intent",
  "affiliates": [],
  "amount": 9990,
  "amount_capturable": 0,
  "amount_details": {
    "amount": 9990,
    "installment_interest_amount": 0,
    "principal_amount": 9990,
    "surcharge_amount": 0
  },
  "amount_received": 0,
  "canceled_at": null,
  "cancellation_reason": null,
  "cancellation_requested_at": null,
  "capture_method": "automatic",
  "client_secret": "pi_enozN8CHArFsMBxB_secret_49b1173cbbaf87493fc8b12b4688d5a896fb257435e3901d",
  "confirmation_method": "automatic",
  "created_at": "2026-05-16T18:34:58Z",
  "currency": "brl",
  "customer": "cus_FAJsSbN8eNAL9Ak1",
  "installment_interest_amount": 0,
  "installments": 1,
  "invoice": null,
  "last_payment_error": null,
  "latest_charge": null,
  "livemode": true,
  "metadata": {},
  "next_action": null,
  "number": "EDV7ZD",
  "payment_method": "pm_KK8kxXVcPzoeGpzM",
  "payment_method_options": {
    "credit_card": {
      "installments": {
        "amount": 9990,
        "count": 1,
        "installment_interest_amount": 0,
        "interest_payer": "buyer",
        "principal_amount": 9990,
        "surcharge_amount": 0
      }
    }
  },
  "payment_method_types": [
    "credit_card"
  ],
  "principal_amount": 9990,
  "status": "requires_payment_method",
  "surcharge_amount": 0,
  "updated_at": "2026-05-16T19:00:00Z"
}
```

```json 400 theme={"theme":"css-variables"}
{
  "error": {
    "code": "invalid_request",
    "message": "Invalid request.",
    "type": "invalid_request_error"
  }
}
```

```json 401 theme={"theme":"css-variables"}
{
  "error": {
    "code": "authentication_failed",
    "message": "Invalid API key provided.",
    "type": "authentication_error"
  }
}
```

```json 404 theme={"theme":"css-variables"}
{
  "error": {
    "code": "resource_missing",
    "message": "Payment intent not found.",
    "type": "invalid_request_error"
  }
}
```

```json 409 theme={"theme":"css-variables"}
{
  "error": {
    "code": "boleto_already_paid",
    "message": "This boleto has already been paid.",
    "type": "invalid_request_error"
  }
}
```

## Erros

| Código | Consequência |
| - | - |
| `boleto_not_available` | O pagamento não possui boleto emitido ou já está sendo cancelado por inteiro. |
| `boleto_already_paid` | O banco já confirmou o pagamento; o boleto não pode ser cancelado. |
| `boleto_expired` | O vencimento passou; aguarde o desfecho bancário. |
| `payment_intent_owned_by_checkout_session` | O pagamento pertence a uma sessão de checkout. |

## Eventos

O pedido emite `charge.updated` e `payment.intent.updated`. A confirmação
emite `charge.updated`. Cancelar apenas o boleto não emite
`payment.intent.canceled`. Para encerrar o pagamento inteiro, use
[Cancelar pagamento](https://docs.chargefy.io/api-reference/payment-intents/cancel.md).


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