# 2. Cancel

<mark style="color:green;">`POST`</mark> `{{Base Address}}/api/payment/async/cancel`

It will be sufficient to send a request to the address provided above. You can use the 'Base Address' as you wish for both the Test environment and the Production environment.

{% hint style="info" %}
Important: To use the **Async Cancel** service, you must send the '**apikeyprivate**' and '**apiclientprivate**' parameters in the 'Header' field.\
\
[<mark style="color:green;">**PhysicalAPI Address**</mark>](https://developer.paywall.one/payment-orchestration-integration-document/environment)
{% endhint %}

**The header information that needs to be sent to the service is as follows:**

<table><thead><tr><th width="243">Parameter</th><th width="106.33333333333331">Type</th><th width="166">Compulsory</th><th>Description</th></tr></thead><tbody><tr><td>apikeyprivate</td><td>string</td><td>Yes</td><td>The Private Key obtained from your merchant panel.</td></tr><tr><td>apiclientprivate</td><td>string</td><td>Yes</td><td>The Private Client obtained from your merchant panel.</td></tr></tbody></table>

**The body information that needs to be sent to the service is as follows:**

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

```json
{
    "PaymentRequestId": "7cc7c8e8-9d92-41b6-9378-e9ecef5a7812"
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th width="268">Parameter</th><th width="98.33333333333331">Type</th><th width="154">Compulsory</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>PaymentRequestId
</code></pre></td><td>Guid</td><td>Yes</td><td>It is the identity information returned from Paywall at the time of the sales order.</td></tr></tbody></table>

**Response returned from the service:**

<table><thead><tr><th width="182">Parameter</th><th width="107.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>Result</td><td>object</td><td>Returns the details in the service response.</td></tr><tr><td>ErrorCode</td><td>int</td><td>Error code. If the transaction is successful, it returns a value of '0'.</td></tr><tr><td>Succeeded</td><td>bool</td><td>It returns a value of true or false. If the transaction is <mark style="color:green;">successful</mark>, it returns a value of 'true'.</td></tr><tr><td>Failed</td><td>bool</td><td>It returns a value of true or false. If the transaction is <mark style="color:red;">unsuccessful</mark>, it returns a value of 'true'.</td></tr><tr><td>Message</td><td>string</td><td>If the transaction is faulty, this is the error message provided, and it offers language support according to the locale parameter.</td></tr><tr><td>ClientMessage</td><td>string</td><td>It returns the fixed values of the Paywall error codes. You can perform mapping.</td></tr></tbody></table>

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

```json5
{
    "result": {
        "paymentRequestId": "72ec8714-d116-4306-8881-38a43c485da9",
        "paymentRequestActivityId": "3a7deace-d437-4d3f-8ef8-1cba82f18e8f",
        "paymentRequestActivityTypeId": 2,
        "paymentStatus": 4
    },
    "failed": false,
    "message": null,
    "clientMessage": null,
    "succeeded": true
}
```

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

<table><thead><tr><th width="263">Parameter</th><th width="139.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>PaymentRequestId
</code></pre></td><td>Guid</td><td>It is the identity information of the Async payment in Paywall. It <strong>should be stored.</strong></td></tr><tr><td><pre><code>PaymentRequestActivityId
</code></pre></td><td>Guid</td><td>It is the identity information of the last transaction of the Async payment.</td></tr><tr><td><pre><code>PaymentRequestActivityTypeId
</code></pre></td><td>int</td><td><p>The type of the last transaction of the Async payment.</p><p><br>Bkz: <a href="broken-reference">Payment Type</a></p></td></tr><tr><td><pre><code>PaymentStatus
</code></pre></td><td>int</td><td><p>The final status of the async payment.</p><p><br>Bkz: <a href="broken-reference">Ödeme Durumu</a></p></td></tr></tbody></table>
