# 11. Verify Payment (OTP)

## Verify Payment (OTP)

<mark style="color:green;">`POST`</mark> `{{Base Address}}/api/paywall/masterpass/payment/verify`

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

{% hint style="info" %}
Important: To use the Masterpass - Verify Payment (OTP) service, you must include the parameters **'apikeyprivate'** and **'apiclientprivate'** in the 'Header' field.\
\
[<mark style="color:green;">**PaymentAPI Address**</mark>](/payment-orchestration-integration-document/environment.md)
{% endhint %}

<table><thead><tr><th width="182">Parameter</th><th width="106.33333333333331">Type</th><th width="163.62890625">Mondatory</th><th>Description</th></tr></thead><tbody><tr><td>apikeyprivate</td><td>string</td><td>Yes</td><td>The Private Key obtained from the merchant panel.</td></tr><tr><td>apiclientprivate</td><td>string</td><td>Yes</td><td>The Private Client obtained from the merchant panel.</td></tr></tbody></table>

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

<table><thead><tr><th width="228">Parameter</th><th width="106">Type</th><th width="123">Mondatory</th><th>Description</th></tr></thead><tbody><tr><td>SessionId</td><td>Guid</td><td>Yes</td><td><a href="/pages/xpRDdgZPoDKXW4msT7aK">Session ID</a>information</td></tr><tr><td>MasterpassPaymentId</td><td>Guid</td><td><strong>Yes</strong></td><td>It is included in the response returned from the Paywall services at the time of initiating the payment.</td></tr><tr><td>OtpToken</td><td>string</td><td><strong>Yes</strong></td><td>The relevant value from the Initiate Payment service is returned if the payment needs to proceed with OTP.</td></tr><tr><td>OtpCode</td><td>string</td><td><strong>Yes</strong></td><td>This is the verification code information obtained from the user on the payment screen.</td></tr></tbody></table>

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

```json5
{
    "OtpToken": "f6b4401774f544dc8ec958dbe7a8470f",
    "OtpCode": "123456",
    "SessionId": "5895433e-f36b-1410-825e-001264113a90",
    "MasterpassPaymentId": "ce55004d-888c-416f-84d7-ed2873531fe7"
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
// Soon
```

{% endtab %}

{% tab title="GO" %}

```go
// Soon
```

{% endtab %}

{% tab title="Java" %}

```java
// Soon
```

{% endtab %}

{% tab title="PHP" %}

```php
// Soon
```

{% endtab %}

{% tab title="Python" %}

```python
// Soon
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
// Soon
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
// Soon
```

{% endtab %}

{% tab title="Curl" %}

```sh
// Soon
```

{% endtab %}
{% endtabs %}

**Response returned from the service:**

<table><thead><tr><th width="156">Parameter</th><th width="83.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>Body</td><td>object</td><td>JSON containing payment details (optional)</td></tr><tr><td>ErrorCode</td><td>int</td><td>Error code. Returns '0' if the transaction is successful.</td></tr><tr><td>Result</td><td>bool</td><td>Returns either true or false. If the transaction is successful, it returns true.</td></tr><tr><td>Message</td><td>string</td><td>If the transaction fails, this is the error message provided, with language support according to the locale parameter.</td></tr></tbody></table>

{% tabs %}
{% tab title="Successful  ✅" %}

```json5
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": {
        "Session": {
            "SessionRenewed": false,
            "SessionId": "a527433e-f36b-1410-80e5-004205aa382d"
        },
        "Masterpass": {
            "Result": {
                "RetrievalReferenceNumber": "100005844112",
                "IsVerified": true,
                "Url3d": null,
                "Url3dSuccess": null,
                "Url3dFail": null,
                "CardUniqueNumber": "382C4D4AA6AA93C7CF2D613BB144AA6305A46FDCD40B795C40B97A486D8E2BE2",
                "Token": "057227d485424da0a3394056b8c21bdc",
                "ResponseCode": "0000",
                "Description": "OTP verified successfully."
            },
            "BuildId": "78",
            "CorrelationId": "6ba60890-6f0e-479d-8987-c1cfd4cf4abc",
            "Exception": null,
            "Message": "OK",
            "RequestId": null,
            "StatusCode": 200,
            "Version": null
        }
    }
}
```

{% endtab %}

{% tab title="Failed  ❌" %}

```json5
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 1,
    "Result": false,
    "Message": "",
    "Body": {
        "Session": {
            "SessionRenewed": true,
            "SessionId": "a527433e-f36b-1410-80e5-004205aa382d"
        },
        "Masterpass": {
            "Result": null,
            "BuildId": "78",
            "CorrelationId": null,
            "Exception": {
                "Level": "Unauthorized",
                "Code": "TOKEN_HAS_EXPIRED",
                "Message": "Tokenın süresi doldu."
            },
            "Message": "Unauthorized",
            "RequestId": null,
            "StatusCode": 401,
            "Version": null
        }
    }
}
```

{% 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/masterpass-integration/11.-verify-payment-otp.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.
