# Cancel an Operation in Progress

This guide shows how to abort a command that is already running on the terminal — for example, a Sale sent with the wrong amount — and return the terminal to the POS Connected screen.

## How it works

`Cancel` interrupts the command currently in progress and releases the terminal. Only three commands accept cancellation:

* **Sale** (card or QR)
* **Refund**
* **Pre-authorization**

Anything else refuses the request. Cancel takes no parameters: it always targets whatever is running now.

## Before you begin

You need a Connector created and validated with `Polling`, and a cancellable command actually in progress on the terminal.

## Step 1: Send the cancel request

```csharp
var cancelResult = await connector.CancelAsync();
```

## Step 2: Handle both responses

A successful cancellation returns **two** responses, and your application must be ready for both:

1. The response of the `Cancel` command itself.
2. The response of the command that was cancelled, which returns `Code` `2` (canceled).

| Field | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| `Code` | int | Yes | Response code. See [Response and Error Codes](/en/integrated-pos/reference/response-error-codes). |
| `Message` | String | Yes | Text message representing the operation result. |

Two failure cases return a message instead:

* Cancelling a command that does not accept cancellation returns `The operation isn't cancellable`.
* Cancelling with nothing in progress returns `There's no active operation to cancel`.

If the cancellation succeeds, the terminal returns to the POS Connected screen. If it fails, the terminal keeps the UI flow of the command already running.

## Next steps

* [Response and Error Codes](/en/integrated-pos/reference/response-error-codes) - interpret the codes returned by both responses.
* [Check a Transaction Status](/en/integrated-pos/operational-guides/check-transaction-status) - confirm the final state of a transaction you tried to cancel.