> For the complete documentation index, see [llms.txt](https://help.unitpay.ru/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.unitpay.ru/en/payments/payment-refund.md).

# Payment Refund

To make a refund, run a GET request:

```bash
GET https://unitpay.ru/api

method    = refundPayment
paymentId = 1234512345
secretKey = x6bh0qbewehfppogkz6lufartkzyv7o0
sum       = 100
```

#### Mandatory parameters

<table data-header-hidden><thead><tr><th width="171.55556233723956">name</th><th width="125.7777099609375">Value</th><th>Description</th></tr></thead><tbody><tr><td><strong>paymentId</strong></td><td>number</td><td>Payment ID in the UnitPay system</td></tr><tr><td><strong>secretKey</strong></td><td>line</td><td>Project secret key</td></tr></tbody></table>

#### Optional parameters

<table><thead><tr><th width="174.5555419921875">name</th><th width="124.888916015625">type</th><th>deescription</th></tr></thead><tbody><tr><td><strong>sum</strong></td><td>number</td><td>Refund amount, if a partial refund is required.<br>If the parameter is not passed, the full amount of the payment will be refunded.</td></tr></tbody></table>

{% hint style="danger" %}
You can only make one full or partial refund per payment.
{% endhint %}

{% hint style="info" %}
**IMPORTANT NOTE:** In case of a partial refund of the original amount, there is no protection against duplication for repeated refunds! The only check that is implemented for a partial refund is that you cannot return the same amount within half an hour for the same transaction: an error message will appear.
{% endhint %}

{% hint style="success" %}
If you have connected an online cash register in your personal cabinet, you must additionally pass a number of [parameters](/en/online-cash-desk/parameters-for-generating-a-receipt.md) to generate cash receipts.
{% endhint %}

**Successful response**

```json
{ 
    "result": {
        "message": "The refund was successful",
}}
```

<table data-header-hidden><thead><tr><th width="152.66664632161456">name</th><th width="100.33331298828125">Value</th><th>Description</th></tr></thead><tbody><tr><td><strong>message</strong></td><td>line</td><td>The comment of a successful transaction can be used as a hint to the user after completing the request</td></tr></tbody></table>

**Error response**

```
{
    "error": {
        "message": "Invalid secret key",
        "code": -32000
    }
}
```

<table data-header-hidden><thead><tr><th width="154.88887532552081">name</th><th width="99.33331298828125">Value</th><th>Description</th></tr></thead><tbody><tr><td><strong>message</strong></td><td>line</td><td>Information with a description of the request error</td></tr></tbody></table>

{% hint style="info" %}
You can run the query in test mode. [Learn more](/en/book-of-reference/test-api.md)
{% endhint %}
