# 1. Cancellation (Batch)

## Batch Cancellation Service

<mark style="color:green;">`POST`</mark> `{{Base Adres}}/api/paywall/payment/bulk/payment/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>](/payment-orchestration-integration-document/environment.md)
{% 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](#batch-cancellation-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 [<mark style="color:blue;">cancellation</mark>](#batch-cancellation-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="124.09375">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="106">Type</th><th width="125">Compolsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>Date</td><td>DateTime</td><td>Yes</td><td>The date on which the batch payment you want to cancel was made.</td></tr><tr><td>MerchantUniqueCode</td><td>string</td><td>Yes</td><td>The tracking number you provided at the time of the batch payment.</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
{
    "Date": "2024-12-12",
    "MerchantUniqueCode": "8279c96e-2775-4ecf-b594-3cb8fb265f88"
}
```

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

**Parameters Returned from the Service**

<table><thead><tr><th width="280">Parameter</th><th width="129.33333333333331">Type</th><th>Description</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 true, 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": "Bulk payment created and enqueued",
    "Body": {
        "Result": true,
        "BulkPaymentId": 389,
        "TotalPaymentCount": 6
    }
}
```

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


---

# 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://developer.paywall.one/payment-orchestration-integration-document/payment-service/18.-batch-processing-method/2.-cancellation/1.-cancellation-batch.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.
