---
title: "Cancels a pending charge when the payment dialog closes."
method: POST
path: "/api/credito/asaas/{id}/cancelar"
---

# Cancels a pending charge when the payment dialog closes.

`POST /api/credito/asaas/{id}/cancelar`

## Request

- Base URL: `https://okfindex.com`
- URL: `https://okfindex.com/api/credito/asaas/{id}/cancelar`
- Auth: none declared

Requires the `cancelamento` capability returned at creation. An older credit charge accepts its token in `credito`. The product and environment must match. This does not refund payments or remove records. 202 means cancellation is pending; the scheduled worker retries provider failures.
Returns: { id, estado }

## Path parameters

- `id` string, required

## Response `200`

{ id, estado }

- object
  - `id` string, required: Charge id.
  - `estado` string, required: `cancelando`, `vencido`, or the confirmed final state.

## Other responses

- `404`: Invalid charge or capability, or a different product or environment.

---

[API](https://skmtc.dev/okfindex/apis/okf-index.md) · [All operations](https://skmtc.dev/okfindex/apis/okf-index/llms.txt) · [OpenAPI document](https://skmtc.dev/okfindex/apis/okf-index/revisions/4b13ca3c739f?raw)
