# Payment Refund

To make a refund, run a GET request:

```
https://unitpay.ru/api?method=refundPayment    
    params[paymentId]=1234512345
    params[secretKey]=x6bh0qbewehfppogkz6lufartkzyv7o0
    params[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**

```
{ 
    "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 %}


---

# 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://help.unitpay.ru/en/payments/payment-refund.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.
