> For the complete documentation index, see [llms.txt](https://developers.hyp.co.il/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.hyp.co.il/enterprise/documents-and-invoicing/refund-invoices.md).

# Invoicing for Refunds

To issue an invoice for a refund or cancellation transaction, use the `refundCgInvoice` command.

Send a [standard Hyp Enterprise API request](https://developers.hyp.co.il/enterprise/introduction/request-and-response-general-structure.md) and, in the `int_in` parameter, include an XML payload for the `refundCgInvoice` command:

```xml
<ashrait>
    <request>
        <version>2000</version>
        <language>ENG</language>
        <command>refundCgInvoice</command>
        <refundCgInvoice>
            <invoiceAtranId>{refundTransactionId}</invoiceAtranId>
            <invoice>
                ...
            </invoice>
        </refundCgInvoice>
    </request>
</ashrait>
```

`invoiceAtranId` should contain the transaction ID (`tranId`) from the response of the refund transaction you're issuing an invoice for. If you don't have the transaction ID, perform a [transaction inquiry](https://developers.hyp.co.il/enterprise/inquiring-transactions/overview.md) to obtain it.

What you include in the `invoice` element of the payload depends on whether you want to reuse the invoice parameters from the original [debit transaction invoice](https://developers.hyp.co.il/enterprise/documents-and-invoicing/issuing-invoices.md).

If you do want to reuse the original debit invoice parameters, such as item properties, date, and email address, then add `createInvoice` with a value of `1` inside the `invoice` element:

```xml
<ashrait>
    <request>
        <version>2000</version>
        <language>ENG</language>
        <command>refundCgInvoice</command>
        <refundCgInvoice>
            <invoiceAtranId>{refundTransactionId}</invoiceAtranId>
            <invoice>
                <createInvoice>1</createInvoice>
            </invoice>
        </refundCgInvoice>
    </request>
</ashrait>
```

If you want to create a refund invoice that uses new invoice parameters (for example, when performing a partial refund), set `createInvoice` to `2` and include the new invoice parameters in the `invoice` element. The set of supported invoice parameters is the same as in the [`addCgInvoice` command](https://developers.hyp.co.il/enterprise/documents-and-invoicing/issuing-invoices.md):

```xml
<ashrait>
    <request>
        <version>2000</version>
        <language>ENG</language>
        <command>refundCgInvoice</command>
        <refundCgInvoice>
            <invoiceAtranId>{refundTransactionId}</invoiceAtranId>
            <terminalNumber>{terminalNumber}</terminalNumber>
            <invoice>
                <createInvoice>2</createInvoice>
                <invoiceCreationMethod>wait</invoiceCreationMethod>
                <invoiceSubject>Your vinyl store refund</invoiceSubject>
                <invoiceItemCode>12345</invoiceItemCode>
                <invoiceItemDescription>Fleetwood Mac. Rumours</invoiceItemDescription>
                <invoiceItemQuantity>1</invoiceItemQuantity>
                <invoiceItemPrice>5700</invoiceItemPrice>
                <companyInfo>Invoice recipient</companyInfo>
                <mailTo>example@acme.io</mailTo>
                <isItemPriceWithTax>1</isItemPriceWithTax>
                <ccDate>2025-08-12</ccDate>
            </invoice>
        </refundCgInvoice>
    </request>
</ashrait>
```

The response structure is similar in both scenarios and matches the one returned after [sending the `addCgInvoice` command](https://developers.hyp.co.il/enterprise/documents-and-invoicing/issuing-invoices.md#response-structure):

```xml
<?xml version='1.0'?>
<ashrait>
    <response>
        <command>refundCgInvoice</command>
        <dateTime>2025-08-12 13:36</dateTime>
        <requestId/>
        <tranId>119427414</tranId>
        <result>000</result>
        <message>Permitted transaction</message>
        <userMessage>Permitted transaction</userMessage>
        <additionalInfo/>
        <version>2000</version>
        <language>Eng</language>
        <refundCgInvoice>
            <invoice>
                <invoiceCreationMethod>wait</invoiceCreationMethod>
                <invoiceResponseCode>100</invoiceResponseCode>
                <invoiceResponseName>Proper Invoice Request</invoiceResponseName>
                <invoiceDocNumber>23940</invoiceDocNumber>
                <invoiceDocUrl>
                    https://demo.ezcount.co.il/front/documents/get/6830ab55-b051-4daf-8de8-d6593f2180df/copy_en
                </invoiceDocUrl>
                <invoiceAtranId>119427406</invoiceAtranId>
                <invoiceCreationDate>1754994995</invoiceCreationDate>
                <mailTo>example@acme.io</mailTo>
                <invoiceCreationCode>000</invoiceCreationCode>
            </invoice>
        </refundCgInvoice>
    </response>
</ashrait>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.hyp.co.il/enterprise/documents-and-invoicing/refund-invoices.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
