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

# Payment refund

The refund can be partial or full and can only be made once.

If the payment was partially refunded and later the need came to refund the rest of the amount, you will have to contact the **maib ecomm** [support team](mailto:ecom@maib.md).

| API endpoint (POST)                      |
| ---------------------------------------- |
| <https://api.maibmerchants.md/v1/refund> |

### **Request parameters**

<table><thead><tr><th width="178">Parameter</th><th width="128">Required</th><th width="174">Type</th><th>Description</th></tr></thead><tbody><tr><td>payId</td><td>YES</td><td>String<br></td><td>The identifier of the transaction to be refunded.</td></tr><tr><td>refundAmount</td><td>NO</td><td><br>Number(decimal)</td><td><p>Amount to be returned to Costumer. Format: <strong>X.XX</strong></p><p>E.g: <strong>10.25</strong> (currency=USD) means $10 and 25 cents.</p><p></p><p>It can be less than or equal to the transaction amount.</p><p>If this parameter is not present, the full transaction amount will be refunded.</p></td></tr></tbody></table>

**Example**

```json
{
"payId": "f16a9006-128a-46bc-8e2a-77a6ee99df75",
"refundAmount": 10.25
}
```

### **Response parameters**

<table><thead><tr><th width="204.33333333333331">Parameter</th><th width="188">Type</th><th>Description</th></tr></thead><tbody><tr><td>result</td><td>Object</td><td>Object containing transaction data.</td></tr><tr><td><ul><li>payId</li></ul></td><td>String</td><td>Transaction identifier assigned by <strong>maib ecomm</strong><em><strong>.</strong></em></td></tr><tr><td><ul><li>orderId</li></ul></td><td>String</td><td>Order ID generated by Merchant website/app.</td></tr><tr><td><ul><li>status</li></ul></td><td>String</td><td><p>Refund status.</p><p>OK - successfully refunded.</p><p>REVERSED - the transaction has previously been refunded; repeated refund are not allowed.</p></td></tr><tr><td><ul><li>statusCode</li></ul></td><td>String</td><td>Transaction status code</td></tr><tr><td><ul><li>statusMessage</li></ul></td><td>String</td><td>Transaction status information message</td></tr><tr><td><ul><li>refundAmount</li></ul></td><td>Number(decimal)</td><td>Amount returned to Costumer. Format: <strong>X.XX</strong></td></tr><tr><td>ok</td><td>Boolean</td><td><p>Request/transaction processing status.</p><p><em>true</em> - no errors</p><p><em>false -</em> an error occurred (error details will be in <em>errors)</em></p></td></tr><tr><td>errors</td><td>Array</td><td>Request/transaction processing errors. <a href="/pages/DCjblsWjWxuRYokUtopZ"><mark style="color:blue;">Errors table</mark></a></td></tr><tr><td><ul><li>errorCode</li></ul></td><td>String</td><td>Error code</td></tr><tr><td><ul><li>errorMessage</li></ul></td><td>String</td><td>Error description</td></tr><tr><td><ul><li>errorArgs</li></ul></td><td>Object</td><td>Object contains parameters with error details</td></tr></tbody></table>

**Example**

{% tabs %}
{% tab title="Successful" %}

```json
{
"result": {
"payId": "f16a9006-128a-46bc-8e2a-77a6ee99df75",
"orderId": "123",
"status": "OK",
"statusCode": "400",
"statusMessage": "Accepted",
"refundAmount": 10.25
},
"ok": true
}
```

{% endtab %}

{% tab title="Error" %}

```json
{
    "errors": [
        {
            "errorCode": "12001",
            "errorMessage": "Parameter 'refundAmount' is invalid",
            "errorArgs": {
                "parameter": "refundAmount"
            }
        }
    ],
    "ok": false
}
```

{% endtab %}
{% endtabs %}
