# Cancelling Transactions

Sometimes a customer needs to cancel a purchase. When this happens, there are **two ways to handle it** depending on whether the transaction has been sent to the card company for settlement (a process called transmission):

1. If the transaction **hasn't been transmitted yet**, it is fully cancellable. The best part is that you won't be charged the credit card company's commission for it. You can cancel a transaction up until 22:00 Israel time on the same business day it was made.
2. If the transaction **has already been transmitted**, you can't cancel it anymore. In this case, you'll need to [refund your customer](/pay/common-use-cases/refunds.md) instead.

## How to cancel a transaction

To cancel a transaction before it's transmitted, just make a GET request to `https://pay.hyp.co.il/p/` with the `action` parameter set to `CancelTrans`:

{% code overflow="wrap" %}

```http
https://pay.hyp.co.il/p/?action=CancelTrans&Masof=0010131918&PassP=your-api-password&TransId=405532558
```

{% endcode %}

The request uses these parameters:

* `action`: Set this to `CancelTrans`.
* `Masof`: Your terminal number.
* `PassP`: Your API password.
* `TransId`: The unique ID of the transaction you want to cancel. You can find this in the [payment completion redirect](/pay/getting-started/creating-a-payment-page.md#handle-the-redirect-back-to-your-website) as the `Id` parameter.

Here's what a successful cancellation response looks like:

```
TransId=405532558&CCode=0&Hesh=EZ&ReversalStatus=777
```

If the cancellation works, the system returns `CCode=0` and `ReversalStatus=777`.

If the cancellation can't be cancelled — either because it was already transmitted or it doesn't exist — you'll receive `CCode=920` instead. You can find more information in our [Status Codes](/pay/reference/response-status-codes.md) reference.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.hyp.co.il/pay/common-use-cases/cancellations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
