# 2. Cancellation (List)

## Cancellation (List) Service

<mark style="color:green;">`POST`</mark> `{{Base Adres}}/api/paywall/payment/bulk/batch/cancel`

{% hint style="info" %}
Important: To use the batch cancellation service, you must include the parameters **apikeypublic** and **apiclientpublic** in the Header section.

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

{% hint style="warning" %}
Cancellation requests must be sent on the same day the payments occur. After the end of the day, to ensure smooth refunds to credit cards, it is industry standard to use [refund](#cancellation-list-service) services instead of cancellation services.
{% endhint %}

{% hint style="info" %}
You can cancel individual transactions within batch payments one by one. To do this, you should use the [cancellation](#cancellation-list-service) service.
{% endhint %}

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

<table><thead><tr><th width="191">Parameter</th><th width="106">Type</th><th width="125.35546875">Compolsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>apikeypublic</td><td>string</td><td>Yes</td><td>The Public Key you obtained from the merchant panel.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Yes</td><td>The Public Client you obtained from the merchant panel.</td></tr></tbody></table>

**Cancellation Details:**

<table><thead><tr><th width="215">Parameter</th><th width="167">Type</th><th width="129.82421875">Compolsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>Payments</td><td>Array&#x3C;Payment></td><td>Yes</td><td>The list containing the details of the payments to be canceled.</td></tr><tr><td>CallbackUrl</td><td>string</td><td>Yes</td><td>The API endpoint where information will be sent after the batch cancellation process.</td></tr></tbody></table>

**The sample JSON and example codes to be sent to the service are as follows:**

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

```json5
{
    "Payments": [
        {
            "MerchantUniqueCode": "PWL-010101010101",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010102",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010103",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010104",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010105",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010106",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010107",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010108",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010109",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010110",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010111",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010112",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010113",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010114",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010115",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010116",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010117",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010118",
            "Date": "2025-01-01"
        },
        {
            "MerchantUniqueCode": "PWL-010101010119",
            "Date": "2025-01-01"
        },
    ],
    "CallbackUrl": "https://yourwebsite.com/paywall/callback"
}
```

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

**Parameters Returned from the Service**

<table><thead><tr><th width="280">Parameter</th><th width="129.33333333333331">Type</th><th>Compolsory</th></tr></thead><tbody><tr><td>ErrorCode</td><td>int</td><td>Error code. Returns '0' if the operation is successful.</td></tr><tr><td>Result</td><td>bool</td><td>Returns <code>true</code> if the operation is successful, and <code>false</code> if it fails.</td></tr><tr><td>Message</td><td>string</td><td>Contains information or an error message related to the operation.</td></tr><tr><td><mark style="color:orange;">Body</mark> > Result</td><td>bool</td><td>Indicates whether the operation was successfully received. If <code>true</code>, it means Paywall has successfully received the request and placed it into the queue mechanism. Results will be delivered via callback notifications.</td></tr><tr><td><mark style="color:orange;">Body</mark> > TotalPaymentCount</td><td>int</td><td>Total transactions</td></tr></tbody></table>

**Example JSON Returned from the Service**

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

```json
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 0,
    "Result": true,
    "Message": "Batch cancel created and enqueued",
    "Body": {
        "Result": true,
        "PaymentResults": [
            {
                "MerchantUniqueCode": "MCB1M36H3VLUO717FN7Y2ZE3EBN313DXG4OLXSLLDED7T",
                "Status": 1,
                "Message": "Added to normal bulk cancel process",
                "BulkPaymentId": 2683,
                "ErrorMessage": null,
                "BulkPaymentJobId": 0
            },
            {
                "MerchantUniqueCode": "MCB1M36H3VLUO717FN7Y2ZE3E2O5EFKX7L2ZG5WA52HB7",
                "Status": 1,
                "Message": "Added to normal bulk cancel process",
                "BulkPaymentId": 2683,
                "ErrorMessage": null,
                "BulkPaymentJobId": 0
            },
            {
                "MerchantUniqueCode": "MCB1M36H3VLUO717FN7Y2ZE3ETRUS2O6UQ9F5YPU2BDSA",
                "Status": 1,
                "Message": "Added to normal bulk cancel process",
                "BulkPaymentId": 2683,
                "ErrorMessage": null,
                "BulkPaymentJobId": 0
            },
            {
                "MerchantUniqueCode": "MCB1M36H3VLUO717FN7Y2ZE3E32PUM7BB2FCTH1B13C3G",
                "Status": 1,
                "Message": "Added to normal bulk cancel process",
                "BulkPaymentId": 2683,
                "ErrorMessage": null,
                "BulkPaymentJobId": 0
            }
        ]
    }
}
```

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