# 3. Establish Connection

<mark style="color:green;">`POST`</mark> `{{Base Address}}/api/connection`

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 live environment as you wish.

{% hint style="info" %}
Important: To use the Establish **Connection service**, you must include the '**apikeyprivate**' and '**apiclientprivate**' parameters in the 'Header' field.

\
[<mark style="color:green;">**PhysicalAPI Address**</mark>](https://developer.paywall.one/payment-orchestration-integration-document/environment)
{% endhint %}

**The header information that needs to be sent to the service is as follows:**

<table><thead><tr><th width="243">Parameter</th><th width="106.33333333333331">Type</th><th width="148">Compulsory</th><th>Description</th></tr></thead><tbody><tr><td>apikeyprivate</td><td>string</td><td>Yes</td><td>The Private Key that you obtained from the merchant panel.</td></tr><tr><td>apiclientprivate</td><td>string</td><td>Yes</td><td>The Private Client that you obtained from the merchant panel.</td></tr></tbody></table>

**The body information that needs to be sent to the service is as follows:**

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

```json
{
  "BrandId": 10,
  "ProviderId": 20,
  "RegionId": 1,
  "EndOfDayId": 1,
  "DisplayName": "Uygulama İsmi",
  "IsProd": true,
  "IsReporting": true,
  "IsAsyncPayment": true,
  "IsSocketPayment": true,
  "ServiceParameters": {
    "Key1": "Value", // The Key is returned during the listing process.
    "Key2": "Value", // The Key is returned during the listing process.
    "Key3": "Value", // The Key is returned during the listing process.
    "Key4": "Value" // The Key is returned during the listing process.
  },
  "Name": "Bağlantı İsmi"
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th width="218">Parameter</th><th width="105.33333333333331">Type</th><th width="147">Compulsory</th><th width="117">Length</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>BrandId
</code></pre></td><td>int</td><td>Yes</td><td>-</td><td>Bkz: <a href="broken-reference">Brand</a></td></tr><tr><td><pre><code>ProviderId
</code></pre></td><td>int</td><td>Yes</td><td>-</td><td>Bkz: <a href="broken-reference">Provider</a></td></tr><tr><td><pre><code>RegionId
</code></pre></td><td>int</td><td>Yes</td><td>-</td><td>Bkz: <a href="broken-reference">Country/Region</a></td></tr><tr><td><pre><code>EndOfDayId
</code></pre></td><td>int</td><td>Yes</td><td>-</td><td>Bkz: <a href="broken-reference">Valu</a>e </td></tr><tr><td><pre><code>DisplayName
</code></pre></td><td>string</td><td>No</td><td>25</td><td>This information is used in situations where the application name, etc., needs to be displayed on the POS device screens.</td></tr><tr><td><pre><code>IsProd
</code></pre></td><td>bool</td><td>Yes</td><td>-</td><td>Indicates whether the connection is Live/Test.</td></tr><tr><td><pre><code>IsReporting
</code></pre></td><td>bool</td><td>Yes</td><td>-</td><td>Should the connection support reporting functionality?</td></tr><tr><td><pre><code>IsAsyncPayment
</code></pre></td><td>bool</td><td>Yes</td><td>-</td><td>Should the connection support the asynchronous payment method?</td></tr><tr><td><pre><code>IsSocketPayment
</code></pre></td><td>bool</td><td>Yes</td><td>-</td><td>Should the connection support the payment method under the socket infrastructure?</td></tr><tr><td><pre><code>ServiceParameters
</code></pre></td><td>Dictionary&#x3C;string, string></td><td>Yes</td><td>-</td><td>The parameters required by the provider you want to connect to (such as Papara, etc.) should be sent as key-value pairs.</td></tr><tr><td><pre><code>Name
</code></pre></td><td>string</td><td>Yes</td><td>100</td><td>The custom name you assigned to your connection.</td></tr></tbody></table>

**Response returned from the service:**

<table><thead><tr><th width="182">Parameter</th><th width="107.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>Result</td><td>object</td><td>Returns the details of the service.</td></tr><tr><td>ErrorCode</td><td>int</td><td>Error code. If the transaction is successful, it returns a value of '0'.</td></tr><tr><td>Succeeded</td><td>bool</td><td>It returns a true or false value. If the transaction is <mark style="color:green;">successful</mark>, it returns the value 'true'.</td></tr><tr><td>Failed</td><td>bool</td><td>It returns a true or false value. If the transaction is <mark style="color:red;">unsuccessful</mark>, it returns the value 'true'.</td></tr><tr><td>Message</td><td>string</td><td>If the transaction is erroneous, this is the message related to the error, and it provides language support based on the locale parameter.</td></tr><tr><td>ClientMessage</td><td>string</td><td>It returns the fixed values of the paywall error codes. You can perform mapping.</td></tr></tbody></table>

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

```json5
{
    "result": {
        "status": true
    },
    "failed": false,
    "message": null,
    "clientMessage": null,
    "succeeded": true
}
```

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