# Confirmation of funds debit

{% hint style="danger" %}
**ATTENTION: New Error Response Format**\
In the near future, errors in our system will be classified as **expected** and **unexpected**. Depending on the type of error, the format of the JSON response will be changed. Please review the new formats on the [**Error Codes**](https://docs.tarlanpayments.kz/eng/agws/error-codes) page. This change will be applied to all APIs in the AGWS system **except** ''[Make a payment](https://docs.tarlanpayments.kz/eng/agws/make-a-payment)'.

Click [here ](#examples-of-error-responses-before-the-changes)to view the old and new JSON error responses. Please take note of this update and ensure your system is ready for these changes, if necessary.
{% endhint %}

<mark style="color:green;">`POST`</mark> <https://agwsapi.tarlanpayments.kz/showcase-gateway/api/v1/action/confirm/invoice>

**Headers**

| Name         | Value                                                                              |
| ------------ | ---------------------------------------------------------------------------------- |
| Content-Type | `application/json`                                                                 |
| X-Signature  | [Authorization hash](https://docs.tarlanpayments.kz/eng/agws/creating-a-signature) |

**Body**

| Name                                             | Type   | Description                                |
| ------------------------------------------------ | ------ | ------------------------------------------ |
| `agent`<mark style="color:red;">`*`</mark>       | String | Showcase code in the Tarlanpayments system |
| `confirm_code`                                   | String | Payment confirmation code                  |
| `external_id`<mark style="color:red;">`*`</mark> | String | Payment ID on the showcase side            |

**Response**

<table><thead><tr><th width="215">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>status</td><td>bool</td><td>Request processing status</td></tr><tr><td>status_code</td><td>uint</td><td>Error code</td></tr><tr><td>message</td><td>string</td><td>Description of error</td></tr><tr><td>result</td><td>Object</td><td>An object storing payment information</td></tr><tr><td>-is_success</td><td>String</td><td>Payment success flag</td></tr><tr><td>-transaction_status_id</td><td>String</td><td><a href="transaction-status-guide">Transaction status</a></td></tr><tr><td>-external_id</td><td>String</td><td>Payment ID on the showcase side</td></tr><tr><td>-otp_status</td><td>bool</td><td>otp check success flag</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK Example of a successful response" %}

```json
{
    "status": true,
    "status_code": 0,
    "message": "Success",
    "result": {
        "is_success": true,
        "transaction_status_id": "1",
        "external_id": "200001",
        "message": "",
        "otp_status": true
    }
}
```

{% endtab %}
{% endtabs %}

#### Examples of error responses *before* the changes

{% tabs %}
{% tab title="400 Bad Request" %}

```json
{
    "status": false,
    "status_code": 1041,
    "message": "Order not found",
    "result": {}
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```json
{
    "status": false,
    "status_code": 1014,
    "message": "Invalid signature",
    "result": {}
}
```

{% endtab %}
{% endtabs %}

#### Examples of error responses *after* the changes

{% tabs %}
{% tab title="200 OK: Expected error" %}

```json
{
    "status": true,
    "status_code": 0,
    "message": "Success",
    "result": {
        "error_code": 1041,
        "message": "Order not found",
        "data": null
    }
}
```

{% endtab %}

{% tab title="400 Bad Request: Unexpected Error" %}

```json
{
    "status": false,
    "status_code": 1014,
    "message": "Invalid signature",
    "result": {}
}
```

{% endtab %}
{% endtabs %}

```
curl --location 'https://agwsapi.tarlanpayments.kz/showcase-gateway/api/v1/action/confirm/invoice' \
--header 'Content-Type: application/json' \
--header 'X-Signature: your_signature_here' \
--data '{
    "agent": "test_agent",
    "confirm_code": "104000",
    "external_id": "externa312"
}'

```
