# 4. Partial Refund

## Partial Payment Refund Process

<mark style="color:green;">`POST`</mark> `{{Base Adres}}/api/paywall/apm/refund/partial`

{% tabs %}
{% tab title="200: OK return parameters are as follows" %}
{% code overflow="wrap" lineNumbers="true" %}

```json
{
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": "1.0.0"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Important**: To use the APM Partial Payment Refund service, you need to include '**apikeypublic**' and '**apiclientpublic**' parameters in the 'Header' field.

\
[<mark style="color:green;">**PaymentAPI Address**</mark>](https://developer.paywall.one/payment-orchestration-integration-document/environment)
{% endhint %}

**The header parameters that need to be sent to the service are as follows:**

<table><thead><tr><th width="221">Parameter (Headers)</th><th width="92">Type </th><th width="143">Compulsory</th><th width="403">Description</th></tr></thead><tbody><tr><td>apikeypublic</td><td>string</td><td>Yes</td><td>The Public Key obtained from the merchant panel.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Yes</td><td>The Public Client obtained from the merchant panel.</td></tr></tbody></table>

**The parameters that need to be sent to the service in the (BODY) are as follows:**

<table><thead><tr><th width="225">Parameter</th><th width="107">Type</th><th width="135">Compulsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>UniqueCode</td><td>string</td><td>Yes</td><td>The UniqueCode parameter for the APM payment. It is included in the response returned by the API at the time of creation.</td></tr><tr><td>Amount</td><td>decimal</td><td>Yes</td><td>The partial refund amount intended for the payment.</td></tr></tbody></table>

**The parameters returned from the service are as follows:**

<table><thead><tr><th width="189">Parameter</th><th width="100.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ErrorCode</td><td>int</td><td>Error code. Returns a value of '0' if the operation is successful.</td></tr><tr><td>Result</td><td>bool</td><td>Returns a value of true or false. Returns true if the operation is successful.</td></tr><tr><td>Message</td><td>string</td><td>If the operation fails, this message specifies the error and provides language support according to the locale parameter.</td></tr><tr><td>Body</td><td>object</td><td>If the operation fails, this is the detailed object regarding the error.</td></tr></tbody></table>

{% tabs %}
{% tab title="JSON" %}
{% code lineNumbers="true" %}

```json
{
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": {
        "ApmKey": "FoodCardProvider",
        "ApmConnectionId": 19,
        "ApmTransactionId": 4292,
        "UniqueCode": "cda31a20-5089-40c6-9fb*********",
        "MerchantUniqueCode": "A1s2d3F774G5H6J7K8L9",
        "Amount": 1.00,
        "ProviderDummyResponse": {
            "ErrorCode": 0,
            "Body": { // Varies from provider to provider
                "ResponseCode": 0,
                "ResponseMessage": "İptal işlemi başarılı bir şekilde gerçekleştirilmiştir.",
                "MerchantCode": "*********",
                "TerminalCode": "*********",
                "SaleRefCode": "cda31a20-5089-40c6*********",
                "TransactionId": 111111111111,
                "ReturnType": 1
            },
            "HttpCode": 200
        }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
