# Performing Refunds

Sometimes you'll need to send money back to a customer after a purchase has already been completed and settled. While both cancellations and refunds result in the customer getting their money back, they work differently behind the scenes.

A [cancellation](/pay/common-use-cases/cancellations.md) is like "undoing" a charge before it's finalized (transmitted) to the credit card company. A refund, on the other hand, is for transactions that have **already been settled**. Unlike a cancellation, a **refund creates a brand-new transaction** in the system that credits the customer's card.

A refund is also different from a [payout](/pay/advanced-features/payouts.md), which is a proactive credit to a customer that isn't linked to a previous purchase.

The great thing about refunds is their flexibility: you can choose to refund the **entire amount or just a portion of it**. Just keep in mind that you can't refund more than the original transaction's value.

## How to make a refund

To make a refund, send a GET request to `https://pay.hyp.co.il/p/` with these parameters:

* `action`: Set this to `zikoyAPI`.
* `Masof`: Your terminal number.
* `PassP`: Your API password.
* `TransId`: The unique ID of the original transaction you want to refund. You'll 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.
* `Amount`: The amount you want to refund. This can be equal to or less than the original transaction's amount.

Here's an example of an API request to perform a refund:

{% code overflow="wrap" %}

```http
https://pay.hyp.co.il/p/?action=zikoyAPI&Masof=0010131918&PassP=your-api-password&TransId=12290620&Amount=10
```

{% endcode %}

When a refund is successful, you'll get a response that looks like this:

```
Id=405577499&CCode=0&ACode=0476241&HeshASM=EZ
```

The response includes a new `Id`, which is the unique identifier for the refund itself.

If everything goes according to plan, the system returns `CCode=0`. If there's an issue, you'll see a different [error code](/pay/reference/response-status-codes.md) that indicates what went wrong. For example, code `33` means you're trying to refund more than the original transaction was worth.


---

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