# 1. Initiate Payment

## Initiate Payment

<mark style="color:green;">`POST`</mark> `{{Base Adres}}/api/paywall/payment/start/split`

{% hint style="info" %}
Important: To use the partial payment initiation service, you must include the parameters **apikeypublic** and **apiclientpublic** in the Header section.

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

<table><thead><tr><th width="188">Parameter</th><th width="79">Type</th><th width="107">Compolsory</th><th width="403">Description</th></tr></thead><tbody><tr><td>apikeypublic</td><td>string</td><td>Yes</td><td>The Public Key you obtained from the merchant panel.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Yes</td><td>The Public Client you obtained from the merchant panel.</td></tr></tbody></table>

The sample <mark style="color:green;">JSON</mark> and <mark style="color:green;">example codes</mark> to be sent to the service are as follows:

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

```json5
{
    "PaymentDetail": {
        "Amount": 600.00,
        "MerchantUniqueCode": "{{$guid}}",
        "CurrencyId": 1,
        "Installment": 1,
        "CallbackAddress": "https://webhook.site/6dbedd75-2e39-47cf-a389-4a2e4b1afdd4", // sadece rollback senaryosu için 
        "ClientIP": "1.1.1.1",
        "Half2D": false,
        "ProviderBased": false,
        "ProviderKey": "test",
        "TrackingCode": "tracking-code-1234567830",
        "PosBased": false,
        "PosId": 4712,
        "AutoRollback": false
    },
    "CardModel": 1, //Ecommerce Insurance
    "Payments": [
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 150
            },
            "Card": {
                "OwnerName": "Enes Tütüncü",
                "Number": "5528790000000008",
                "ExpireMonth": "12",
                "ExpireYear": "2026",
                "Cvv": "123"
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "OwnerName": "Melih Talu",
                "Number": "5528790000000008",
                "ExpireMonth": "12",
                "ExpireYear": "2030",
                "Cvv": "000"
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "OwnerName": "Melih Talu",
                "Number": "5528790000000008",
                "ExpireMonth": "12",
                "ExpireYear": "2030",
                "Cvv": "000"
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "OwnerName": "Melih Talu",
                "Number": "5528790000000008",
                "ExpireMonth": "12",
                "ExpireYear": "2030",
                "Cvv": "000"
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "OwnerName": "Melih Talu",
                "Number": "5528790000000008",
                "ExpireMonth": "12",
                "ExpireYear": "2030",
                "Cvv": "000"
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "OwnerName": "Melih Talu",
                "Number": "5528790000000008",
                "ExpireMonth": "12",
                "ExpireYear": "2030",
                "Cvv": "000"
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "OwnerName": "Melih Talu",
                "Number": "5528790000000008",
                "ExpireMonth": "12",
                "ExpireYear": "2030",
                "Cvv": "000"
            }
        }
    ]
}
```

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

**Transaction Performed with a Saved Card –&#x20;**<mark style="color:green;">**JSON**</mark>**&#x20;Format**

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

```json5
{
    "PaymentDetail": {
        "Amount": 400.00,
        "MerchantUniqueCode": "{{$guid}}",
        "CurrencyId": 1,
        "Installment": 1,
        "CallbackAddress": "https://webhook.site/6dbedd75-2e39-47cf-a389-4a2e4b1afdd4", // sadece rollback senaryosu için 
        "ClientIP": "1.1.1.1",
        "Half2D": false,
        "ProviderBased": false,
        "ProviderKey": "test",
        "TrackingCode": "tracking-code-1234567830",
        "PosBased": false,
        "PosId": 4712,
        "AutoRollback": false
    },
    "CardModel": 1, //Ecommerce Insurance
    "Payments": [
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 150
            },
            "Card": {
                "UniqueCode": "6gjQkZvrZiYfghmyF2ZZiZVeCYeekubCzBcgEaOrpesMKzedwR8rHw=="
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "UniqueCode": "6gjQkZvrZiYfghmyF2ZZiZVeCYeekubCzBcgEaOrpesMKzedwR8rHw=="
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "UniqueCode": "6gjQkZvrZiYfghmyF2ZZiZVeCYeekubCzBcgEaOrpesMKzedwR8rHw=="
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "UniqueCode": "6gjQkZvrZiYfghmyF2ZZiZVeCYeekubCzBcgEaOrpesMKzedwR8rHw=="
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "UniqueCode": "6gjQkZvrZiYfghmyF2ZZiZVeCYeekubCzBcgEaOrpesMKzedwR8rHw=="
            }
        },
        {
            "Customer": {
                "FullName": "FullName",
                "Phone": "5336662211",
                "Email": "enes@paywall.one",
                "Country": "Country",
                "City": "City",
                "Address": "Address",
                "IdentityNumber": "11111111111",
                "TaxNumber": "TaxNumber"
            },
            "Product": {
                "ProductId": "ProductId",
                "ProductName": "ProductName",
                "ProductCategory": "ProductCategory",
                "ProductDescription": "ProductDescription",
                "ProductAmount": 50
            },
            "Card": {
                "UniqueCode": "6gjQkZvrZiYfghmyF2ZZiZVeCYeekubCzBcgEaOrpesMKzedwR8rHw=="
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

<mark style="color:blue;">Root Directory</mark>

<table><thead><tr><th width="238">Parameter</th><th width="153">Type</th><th width="113">Compolsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>PaymentDetail</td><td>PaymentDetail</td><td>Yes</td><td>The JSON object where the payment details will be placed.</td></tr><tr><td>CardModel</td><td>int</td><td>Yes</td><td>The card method through which the payment will be collected.<br><br><a href="broken-reference">Types</a></td></tr><tr><td>Payments</td><td>List&#x3C;Payment></td><td>Yes</td><td>A JSON object in the form of a list containing the payments to be collected under the partial payment process.</td></tr></tbody></table>

<mark style="color:blue;">Root Directory:</mark> <mark style="color:orange;">`PaymentDetail`</mark>

<table><thead><tr><th width="235">Parameter</th><th width="106">Type</th><th width="139.12890625">Compolsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>Amount</td><td>string</td><td>Yes</td><td>The total amount to be collected in the payment transaction.</td></tr><tr><td>MerchantUniqueCode</td><td>decimal</td><td>Yes</td><td>A unique code defined specifically for the merchant.</td></tr><tr><td>CurrencyId</td><td>string</td><td>Yes</td><td>Represents the currency in which the transaction will be carried out.<br><br><a href="../../system-data/currency">Currency</a></td></tr><tr><td>Installement</td><td>integer</td><td>Yes</td><td>Indicates the number of installments selected by the customer in their payment plan.</td></tr><tr><td>CallbackAddress</td><td>string</td><td>Yes</td><td>The address to which the system will send the result information after the transaction is completed.</td></tr><tr><td>ClientIP</td><td>string</td><td>Yes</td><td>Represents the IP address of the user performing the transaction.</td></tr><tr><td>Half2D</td><td>bool</td><td>No</td><td>This parameter supports you in finalizing your payments with a separate request. If you send the <strong>Half2D</strong> parameter as <strong>true</strong>, the payment will remain in <mark style="color:yellow;">authorization</mark> at the bank until you make the finalization call.</td></tr><tr><td>ProviderBased</td><td>bool</td><td>No</td><td>This is used when you decide on your side which provider your payment should be processed through.</td></tr><tr><td>ProviderKey</td><td>string</td><td>Conditional</td><td>The key of the provider through which you want your payment to be processed.</td></tr><tr><td>PosBased</td><td>bool</td><td>No</td><td>It is used when you decide on your side which provider your payment should be processed through.</td></tr><tr><td>PosId</td><td>int</td><td>Conditional</td><td>It is the connection ID number of the provider through which you want your payment to be processed. This can be found in the list of connected providers obtained from the Paywall panel.</td></tr><tr><td>AutoRollback</td><td>bool</td><td>No</td><td>Should successful partial payments be automatically rolled back if any of the partial transactions fail?</td></tr></tbody></table>

<mark style="color:blue;">Root Directory:</mark> <mark style="color:orange;">`Payments`</mark>

<table><thead><tr><th width="198">Parameter</th><th width="106">Type</th><th width="139">Compolsory</th><th width="336">Description</th></tr></thead><tbody><tr><td><mark style="color:yellow;">Customer</mark> > FullName</td><td>string</td><td>Yes</td><td>Customer full name</td></tr><tr><td><mark style="color:yellow;">Customer</mark> > Phone</td><td>string</td><td>Yes</td><td>Customer phone number</td></tr><tr><td><mark style="color:yellow;">Customer</mark> > Email</td><td>string</td><td>Yes</td><td>Customer email address</td></tr><tr><td><mark style="color:yellow;">Customer</mark> > Country</td><td>string</td><td>Yes</td><td>Customer country</td></tr><tr><td><mark style="color:yellow;">Customer</mark> > City</td><td>string</td><td>Yes</td><td>Customer city information</td></tr><tr><td><mark style="color:yellow;">Customer</mark> > Address</td><td>string</td><td>No</td><td>Customer address information</td></tr><tr><td><mark style="color:yellow;">Customer</mark> > IdentityNumber</td><td>string</td><td>No</td><td>Customer identification information</td></tr><tr><td><mark style="color:yellow;">Customer</mark> > TaxNumber</td><td>string</td><td>No</td><td>Customer tax number information</td></tr><tr><td><mark style="color:orange;">Product</mark> > ProductId</td><td>string</td><td>Yes</td><td>Sold product identification information</td></tr><tr><td><mark style="color:orange;">Product</mark> > ProductName</td><td>string</td><td>Yes</td><td>Sold product name</td></tr><tr><td><mark style="color:orange;">Product</mark> > ProductCategory</td><td>string</td><td>Yes</td><td>Category information of the sold product</td></tr><tr><td><mark style="color:orange;">Product</mark> > ProductDescription</td><td>string</td><td>No</td><td>Description information of the sold product</td></tr><tr><td><mark style="color:orange;">Product</mark> > ProductAmount</td><td>decimal</td><td>Yes</td><td><p>Amount information of the sold product</p><p><br><strong>Note: The total amount of all products must equal the main amount</strong></p></td></tr><tr><td><mark style="color:red;">Card</mark> > OwnerName</td><td>string</td><td><mark style="color:purple;">Conditional</mark></td><td>Cardholder name</td></tr><tr><td><mark style="color:red;">Card</mark> > Number</td><td>string</td><td><mark style="color:purple;">Conditional</mark></td><td>Card number</td></tr><tr><td><mark style="color:red;">Card</mark> > IdentityNumber</td><td>string</td><td><mark style="color:purple;">Conditional</mark></td><td>Cardholder identification information</td></tr><tr><td><mark style="color:red;">Card</mark> > CardNoFirst</td><td>string</td><td><mark style="color:purple;">Conditional</mark></td><td>First 8 digits of the card</td></tr><tr><td><mark style="color:red;">Card</mark> > CardNoLast</td><td>string</td><td><mark style="color:purple;">Conditional</mark></td><td>Last 4 digits of the card</td></tr><tr><td><mark style="color:red;">Card</mark> > ExpireMonth</td><td>string</td><td><mark style="color:purple;">Conditional</mark></td><td>Card expiration month information</td></tr><tr><td><mark style="color:red;">Card</mark> > ExpireYear</td><td>string</td><td><mark style="color:purple;">Conditional</mark></td><td>Card expiration year information</td></tr><tr><td><mark style="color:red;">Card</mark> > Cvv</td><td>string</td><td><mark style="color:purple;">Conditional</mark></td><td>Card CVV information</td></tr></tbody></table>

**Response returned from the service:**

<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>Returns <strong>true</strong> if the operation is successful, and <strong>false</strong> if it fails.</td></tr><tr><td>Message</td><td>string</td><td>Contains information or an error message related to the operation.</td></tr><tr><td>Body</td><td>json</td><td>Detailed information related to the batch payment transaction.</td></tr></tbody></table>

**Response returned from the service:** <mark style="color:orange;">`Body`</mark>

<table><thead><tr><th width="203">Parameter</th><th width="145.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>SplitPaymentId</td><td>int</td><td>Partial payment identification information</td></tr><tr><td>MerchantUniqueCode</td><td>string</td><td>The unique tracking number you provide at the initiation of the partial payment.</td></tr><tr><td>Status</td><td>int</td><td>Partial payment status information</td></tr><tr><td>Payments</td><td>List&#x3C;Payment></td><td>Detailed information for each transaction processed within the partial payment.</td></tr></tbody></table>

**Example Code:**

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

```json5
{
    "ErrorCodeType": 1,
    "ErrorMessage": null,
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": {
        "SplitPaymentId": 238,
        "MerchantUniqueCode": "65451a10-7e26-4df7-9149-7d6d3d35de56",
        "Status": 5,
        "Payments": [
            {
                "PaymentId": 4045720,
                "UniqueCode": "90d0b03e-3ab8-418a-aedb-6d808437d43d",
                "MerchantUniqueCode": "0c4f61e1-4ee7-4ad3-868a-f7b3e0558434",
                "IsSuccessful": true,
                "StatusMessage": "Success",
                "Error": null
            },
            {
                "PaymentId": 4045721,
                "UniqueCode": "5db8b112-6554-48ab-b4f8-9e7b3f85393b",
                "MerchantUniqueCode": "6a3c7464-5f9d-4ef3-a8cb-66e17327d743",
                "IsSuccessful": false,
                "StatusMessage": "Failed",
                "Error": null
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}
