> For the complete documentation index, see [llms.txt](https://developer.paywall.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.paywall.one/payment-orchestration-integration-document/masterpass-integration/3.-complete-payment/1.-complete-payment-paymentid.md).

# 1. Complete Payment (PaymentId)

## **Complete Payment**

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

It is sufficient to send a request to the address provided above. You can use the **Base Address** as needed for both the Test environment and the Production environment.

{% hint style="info" %}
**Important:** In order to use the Masterpass - Complete Payment (PaymentId) service, you must include the **'apikeyprivate'** and **'apiclientprivate'** parameters in the **Header**.\
\
[<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="144.48046875">Compolsory</th><th>Description</th></tr></thead><tbody><tr><td>apikeyprivate</td><td>string</td><td>Yes</td><td>Private Key obtained from the merchant panel.</td></tr><tr><td>apiclientprivate</td><td>string</td><td>Yes</td><td>Private Client obtained from the merchant panel.</td></tr></tbody></table>

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

<table><thead><tr><th width="187.2421875">Parameter</th><th width="106">Type</th><th width="150.46875">Compolsory</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>PaymentId</td><td>bigint</td><td>Yes</td><td>It is included in the response returned by Paywall services at the time of payment initiation.</td></tr></tbody></table>

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

```json5
{
    "SessionId": "512b673e-f36b-1410-80e8-004205aa382d",
    "PaymentId": 8013143466
}
```

{% 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-related details (optional)</td></tr><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 true or false. If the operation is successful, it returns 'true'</td></tr><tr><td>Message</td><td>string</td><td>If the operation fails, this is the message describing the error, with language support based on the locale parameter</td></tr></tbody></table>

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

```json5
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 0,
    "Result": true,
    "Message": "Commit successful",
    "Body": {
        "Session": {
            "SessionRenewed": false,
            "SessionId": "55555555-4444-3333-222222-11111111"
        },
        "Masterpass": {
            "Result": true,
            "Detail": {
                "PaymentId": 8013143466,
                "PaymentActivityId": 4413674,
                "UniqueCode": "aaaaaaa-33333-32222-0000-11111111111",
                "MerchantUniqueCode": "0000000-2664-4d3c-ae6e-000000000000",
                "TrackingCode": "0-0-0-0-0-0-0-0-0-0-0-0-0-0-0"
            },
            "Error": {
                "ProviderErrorCode": null,
                "ProviderErrorMessage": null
            }
        }
    }
}
```

{% endtab %}

{% tab title="Failed ❌" %}

1. **Payment Not Found**

```json5
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 56,
    "Result": false,
    "Message": "Masterpass payment not found",
    "Body": {
        "Session": {
            "SessionRenewed": false,
            "SessionId": "dc27433e-f36b-1410-80e5-004205aa382d"
        },
        "Masterpass": null
    }
}
```

1. **AutoCommit payments cannot be completed again.**

```json5
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 92,
    "Result": false,
    "Message": "Auto commit payment cannot commit again",
    "Body": {
        "Session": {
            "SessionRenewed": false,
            "SessionId": "dc27433e-f36b-1410-80e5-004205aa382d"
        },
        "Masterpass": null
    }
}
```

{% endtab %}
{% endtabs %}
