# 1. Product-Based

## **Confirm Payment Based on Product**

<mark style="color:green;">`POST`</mark> `{{Base Adres}}/api/paywall/marketplace/approve/pw/product`

{% hint style="info" %}
**Important:** To use the Payment service, you must include the **apikeypublic** and **apiclientpublic** parameters 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">Compulsory</th><th width="403">Description</th></tr></thead><tbody><tr><td>apikeypublic</td><td>string</td><td>Yes</td><td>Public Key obtained from the merchant panel.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Yes</td><td>Public 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="246.5546875">Parameter</th><th width="126.21875">Type</th><th width="148.57421875">Compulsory</th><th width="336">Description</th></tr></thead><tbody><tr><td>PaymentId</td><td>int</td><td>Yes</td><td>The payment's ID information on the Paywall side should be used.</td></tr><tr><td>ProductIds</td><td>List&#x3C;int></td><td>Yes</td><td><p>The ID information of the product(s) sent during the payment must be used in the Paywall system. This ID is returned in the response related to the product.</p><p></p><p>If you cannot store these ID details on your side, you can use the "Payment-Based" confirmation method.</p></td></tr><tr><td>Payout</td><td>PayoutModel</td><td>No</td><td><p>Settings that can be configured at the time of earnings distribution related to the payment are included under this parameter. For example, a special note can be added to the payment receipt at the time of the money transfer.</p><p></p><p>You can review the following JSON to see the values it accepts.</p></td></tr><tr><td><p>SameReflectionDateWithMember</p><p></p></td><td>bool</td><td>No</td><td><p>If you want your marketplace settlements to occur on the same day as the reflection date of your merchant, you must send this parameter as <strong>true</strong>.</p><p>The value date is always based on the merchant’s value date.<br>For example; if the merchant’s reflection date is <strong>01.01</strong> and yours is <strong>05.01</strong>, with this parameter both the merchant’s and the platform’s reflection date will be <strong>01.01</strong>.</p><p>This parameter is only valid for a single merchant. If there is more than one merchant included in the payment request, the parameter will be disabled.</p></td></tr></tbody></table>

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

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

```json5
{
    "PaymentId": 1784197,
    "SameReflectionDateWithMember": false,
    "ProductIds": [
        1626127,
        1626128,
        1626129,
        1626130,
        1626131
    ],
    "Payout": {
        "DescriptionApply": true,
        "Description": "Ödemeye özel para transferi açıklaması"
    }
}
```

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

**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 a true or false value. Returns 'true' if the operation is successful.</td></tr><tr><td>Message</td><td>string</td><td>If the operation fails, this is the message describing the error, and it supports localization based on the locale parameter.</td></tr><tr><td>Body</td><td>object</td><td>Detailed information about the transaction</td></tr></tbody></table>

{% hint style="success" %}
**Example response for a successful operation**
{% endhint %}

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

```json
{
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": {
        "Success": [
            {
                "ProductId": 1626127
            },
            {
                "ProductId": 1626128
            },
            {
                "ProductId": 1626129
            },
            {
                "ProductId": 1626130
            },
            {
                "ProductId": 1626131
            }
        ],
        "Fail": []
    }
}
```

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

{% hint style="danger" %}
**Example response for a failed operation**
{% endhint %}

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

```json
{
    "ErrorCode": 1,
    "Result": false,
    "Message": "",
    "Body": {
        "Success": [],
        "Fail": [
            {
                "ProductId": 1626127,
                "Reason": "This product already approved"
            },
            {
                "ProductId": 1626128,
                "Reason": "This product already approved"
            },
            {
                "ProductId": 1626129,
                "Reason": "This product already approved"
            },
            {
                "ProductId": 1626130,
                "Reason": "This product already approved"
            },
            {
                "ProductId": 1626131,
                "Reason": "This product already approved"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}
