# 1. Confirm Payment

## Confirm Payment / OTP-Based

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

{% hint style="info" %}
**Important**: In order to use the APM Confirm Payment (OTP-Based) service, you need to send the '**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 parameters (HEADERS) that need to be sent to the service are as follows:**

<table><thead><tr><th width="170">Parameter</th><th width="79">Type</th><th width="144">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 (BODY) that need to be sent to the service are as follows:**

<table><thead><tr><th width="186">Parameter</th><th width="110">Type</th><th width="143">Compulsory </th><th width="336">Description</th></tr></thead><tbody><tr><td>UniqueCode</td><td>string</td><td>Yes</td><td>It is the UniqueCode parameter of the APM payment. It is included in the response returned by the API at the time of creation.</td></tr><tr><td>Otp</td><td>string</td><td>Yes</td><td>It represents the OTP code transmitted to the user by the provider for the APM payment. It should be obtained from the user through your screens.</td></tr></tbody></table>

**An example JSON file to be sent to the service is as follows:**

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

```json5
{
    "UniqueCode": "cda31a20-5089-40c6-9fb4-7bd89b2a2a04",
    "Otp": "10188"
}
```

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

**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 '0' if the operation is successful.</td></tr><tr><td>Result</td><td>bool</td><td>It 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 is unsuccessful, this is the specified error message, providing language support according to the locale parameter.</td></tr><tr><td>Body</td><td>object</td><td>If the operation is unsuccessful, 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-9fb4-7bd89b2a2a04",
        "MerchantUniqueCode": "A1s2d3F774G5H6J7K8L9",
        "Amount": 1.00,
        "ProviderDummyResponse": {
            "ErrorCode": 0,
            "Body": {
                "ResponseCode": 0,
                "ResponseMessage": "Harcama başarılı.",
                "MerchantCode": "*********",
                "TerminalCode": "*********",
                "CardNo": "637******467",
                "SaleRefCode": "cda31a20-5089-40c6-9fb4-7bd89b2a2a04",
                "TransactionId": 111111111,
                "TransactionAmount": 1.0,
                "BatchNo": 1,
                "Balance": "19999.0",
                "CardOwner": "Paywall Payment Orchestration",
                "ProductName": ""
            },
            "HttpCode": 200
        }
    }
}
```

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