# 7. Establish Account Connectione

## Establish Account Connection

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

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 - Establish Account Connection service, you must include the parameters **'apikeyprivate'** and **'apiclientprivate'** in the 'Header' field.\
\
[<mark style="color:green;">**PaymentAPI Address**</mark>](https://developer.paywall.one/payment-orchestration-integration-document/environment)
{% endhint %}

<table><thead><tr><th width="182">Parameter</th><th width="106.33333333333331">Type</th><th width="141.09375">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="broken-reference">Session ID</a> information</td></tr></tbody></table>

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

```json5
{
    "SessionId": "2193433e-f36b-1410-825e-001264113a90"
}
```

{% 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>

{% hint style="info" %}
**`Body > Masterpass > Result > StatusCode` ve `Body > Masterpass > Result > ResponseCode`**&#x54;he flow must be established by checking the parameter under the directory.

* [**Masterpass ResponseCode List**](https://developer.paywall.one/payment-orchestration-integration-document/masterpass-integration/broken-reference)
  {% endhint %}

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

```json5
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": {
        "Session": {
            "SessionRenewed": false,
            "SessionId": "b827433e-f36b-1410-80e5-004205aa382d"
        },
        "Masterpass": {
            "Result": {
                "RetrievalReferenceNumber": "100005844117",
                "ResponseCode": "5001",
                "Description": "Telefonunuza gelen tek kullanımlık şifreyi girerek kart doğrulama işlemini tamamlayınız",
                "Token": "c0645409b83f4344bf588ef4142559a9",
                "CardIssuerName": "Akbank",
                "MaskedPan": "************0016"
            },
            "BuildId": "83",
            "CorrelationId": "261efc9a-7296-42ef-b5b7-0ee0ca512e6b",
            "Exception": null,
            "Message": "Accepted",
            "RequestId": null,
            "StatusCode": 202,
            "Version": null
        }
    }
}
```

{% endtab %}

{% tab title="Failed  ❌" %}

```json
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": {
        "Session": {
            "SessionRenewed": false,
            "SessionId": "c227433e-f36b-1410-80e5-004205aa382d"
        },
        "Masterpass": {
            "Result": null,
            "BuildId": "83",
            "CorrelationId": null,
            "Exception": {
                "Level": "NotFound",
                "Code": "ACCOUNT_NOT_FOUND",
                "Message": "Hesap bulunamadı."
            },
            "Message": "NotFound",
            "RequestId": null,
            "StatusCode": 404,
            "Version": null
        }
    }
}
```

{% endtab %}
{% endtabs %}
