> 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/odeme-servisi/14.-odeme-onaylama/2.-platform-hesaplayici/2.-odeme-bazli.md).

# 2. Ödeme Bazlı

## Ödeme Bazlı Ödeme Onayla

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

{% hint style="info" %}
Önemli: **Ödeme** servisini kullanabilmeniz için 'Header' alanında '**apikeypublic**' ve '**apiclientpublic**' parametrelerini göndermeniz gerekmektedir.\
\
[<mark style="color:green;">**PaymentAPI Adresi**</mark>](/ortam.md)
{% endhint %}

<table><thead><tr><th width="188">Parametre</th><th width="79">Tip</th><th width="107">Zorunlu</th><th width="403">Açıklama</th></tr></thead><tbody><tr><td>apikeypublic</td><td>string</td><td>Evet</td><td>Üye işyeri panelinden temin etmiş olduğunuz Public Key.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Evet</td><td>Üye işyeri panelinden temin etmiş olduğunuz Public Client.</td></tr></tbody></table>

**Servise gönderilmesi gereken parametreler şu şekildedir:**

<details>

<summary>Parametreler ve açıklamalar</summary>

<table><thead><tr><th width="223.15234375">Parametre</th><th width="140">Tip</th><th width="93">Zorunlu</th><th width="336">Açıklama</th></tr></thead><tbody><tr><td>PaymentId</td><td>int</td><td>Evet</td><td>Ödemenin Paywall tarafındaki Id bilgisi kullanılmalıdır</td></tr><tr><td>Payout</td><td>PayoutModel</td><td>Hayır</td><td>Ödemeye ilişkin hakediş dağıtımı anında yapılabilecek ayarlar bu parametre altında yer almaktadır. Örnek: Para transferi anında ödemenin dekontuna özel bir açıklama konumlandırılmak kullanılabilmektedir.<br><br>Aldığı değerleri görebilmek için aşağıdaki JSON'ı inceleyebilirsiniz.</td></tr><tr><td>SameReflectionDateWithMember</td><td>bool</td><td>Hayır</td><td><p></p><p></p><p></p><p>Pazar yeri hakedişlerinizin, üye işyerinizin yansıma tarihi ile aynı gün gerçekleşmesini istiyorsanız bu parametreyi <code>true</code>olarak göndermeniz gerekmektedir.<br><br></p><ul><li><p>Valör günü her zaman üye işyerinin valör tarihi baz alınır.</p><ul><li>Örneğin; üye işyerinin yansıma tarihi 01.01, sizin ise 05.01 ise, bu parametre sayesinde hem üye işyerinin hem de platformun yansıma tarihi 01.01 olacaktır.</li></ul></li><li>Parametre yalnızca tek bir üye için geçerlidir. Ödeme isteği içerisinde birden fazla üye bulunması halinde parametre devre dışı kalır.</li></ul></td></tr></tbody></table>

</details>

**Servise gönderilecek örnek&#x20;**<mark style="color:green;">**JSON**</mark>**&#x20;ve&#x20;**<mark style="color:green;">**örnek kodlar**</mark>**&#x20;aşağıdaki gibidir.**

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

```json5
{
    "PaymentId": 1644501,
    "SameReflectionDateWithMember": false,
    "Payout": {
        "DescriptionApply": true,
        "Description": "Ödemeye özel para transferi açıklaması"
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text;

public class Program
{
    private static readonly HttpClient client = new HttpClient();

    private static async Task Main()
    {
        var request = new HttpRequestMessage(HttpMethod.Post, "{{Base Adres}}/api/paywall/marketplace/approve/self/product");
        request.Headers.Add("apikeypublic", "%PUBLICKEY%");
        request.Headers.Add("apiclientpublic", "%PUBLICCLIENT%");

        var json = @"{
            ""PaymentId"": 1784197,
            ""SameReflectionDateWithMember"": false,
            ""ProductIds"": [
                1626127,
                1626128,
                1626129,
                1626130,
                1626131
            ],
            ""Payout"": {
                ""DescriptionApply"": true,
                ""Description"": ""Ödemeye özel para transferi açıklaması""
            }
        }";
        request.Content = new StringContent(json, Encoding.UTF8, "application/json");

        var response = await client.SendAsync(request);

        var responseString = await response.Content.ReadAsStringAsync();
        Console.WriteLine(responseString);
    }
}
```

{% endtab %}

{% tab title="GO" %}

```go
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
    "strings"
)

func main() {
    url := "{{Base Adres}}/api/paywall/marketplace/approve/self/product"

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

    req, _ := http.NewRequest("POST", url, payload)
    req.Header.Set("apikeypublic", "%PUBLICKEY%")
    req.Header.Set("apiclientpublic", "%PUBLICCLIENT%")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();

        String json = "{\n" +
                "    \"PaymentId\": 1784197,\n" +
                "    \"SameReflectionDateWithMember\": false,\n" +
                "    \"ProductIds\": [\n" +
                "        1626127,\n" +
                "        1626128,\n" +
                "        1626129,\n" +
                "        1626130,\n" +
                "        1626131\n" +
                "    ],\n" +
                "    \"Payout\": {\n" +
                "        \"DescriptionApply\": true,\n" +
                "        \"Description\": \"Ödemeye özel para transferi açıklaması\"\n" +
                "    }\n" +
                "}";

        HttpRequest request = HttpRequest.newBuilder()
                .uri(new URI("{{Base Adres}}/api/paywall/marketplace/approve/self/product"))
                .header("apikeypublic", "%PUBLICKEY%")
                .header("apiclientpublic", "%PUBLICCLIENT%")
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(json))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$url = '{{Base Adres}}/api/paywall/marketplace/approve/self/product';

$data = array(
    "PaymentId" => 1784197,
    "SameReflectionDateWithMember" => false,
    "ProductIds" => array(1626127, 1626128, 1626129, 1626130, 1626131),
    "Payout" => array(
        "DescriptionApply" => true,
        "Description" => "Ödemeye özel para transferi açıklaması"
    )
);

$options = array(
    'http' => array(
        'header' => "apikeypublic: %PUBLICKEY%\r\n" .
            "apiclientpublic: %PUBLICCLIENT%\r\n" .
            "Content-Type: application/json\r\n",
        'method' => 'POST',
        'content' => json_encode($data)
    )
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);

if ($result === FALSE) {
    /* Handle error */
}

echo $result;
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = '{{Base Adres}}/api/paywall/marketplace/approve/self/product'
headers = {
    'apikeypublic': '%PUBLICKEY%',
    'apiclientpublic': '%PUBLICCLIENT%',
    'Content-Type': 'application/json'
}

data = {
    "PaymentId": 1784197,
    "SameReflectionDateWithMember": False,
    "ProductIds": [
        1626127,
        1626128,
        1626129,
        1626130,
        1626131
    ],
    "Payout": {
        "DescriptionApply": True,
        "Description": "Ödemeye özel para transferi açıklaması"
    }
}

response = requests.post(url, headers=headers, json=data)
print(response.text)
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("{{Base Adres}}/api/paywall/marketplace/approve/self/product")
http = Net::HTTP.new(uri.host, uri.port)

request = Net::HTTP::Post.new(uri.request_uri)
request["apikeypublic"] = "%PUBLICKEY%"
request["apiclientpublic"] = "%PUBLICCLIENT%"
request["Content-Type"] = "application/json"

request.body = JSON.dump({
  "PaymentId" => 1784197,
  "SameReflectionDateWithMember" => false,
  "ProductIds" => [
    1626127,
    1626128,
    1626129,
    1626130,
    1626131
  ],
  "Payout" => {
    "DescriptionApply" => true,
    "Description" => "Ödemeye özel para transferi açıklaması"
  }
})

response = http.request(request)
puts response.body
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import axios from 'axios';

axios.post('{{Base Adres}}/api/paywall/marketplace/approve/self/product', {
    "PaymentId": 1784197,
    "SameReflectionDateWithMember": false,
    "ProductIds": [
        1626127,
        1626128,
        1626129,
        1626130,
        1626131
    ],
    "Payout": {
        "DescriptionApply": true,
        "Description": "Ödemeye özel para transferi açıklaması"
    }
}, {
    headers: {
        'apikeypublic': '%PUBLICKEY%',
        'apiclientpublic': '%PUBLICCLIENT%'
    }
})
    .then((response: any) => {
        console.log(response.data);
    })
    .catch((error: any) => {
        console.error(error);
    });
```

{% endtab %}

{% tab title="Curl" %}

```sh
curl -X POST "{{Base Adres}}/api/paywall/marketplace/approve/self/product" \
-H "apikeypublic: %PUBLICKEY%" \
-H "apiclientpublic: %PUBLICCLIENT%" \
-H "Content-Type: application/json" \
-d '{
    "PaymentId": 1784197,
    "SameReflectionDateWithMember": false,
    "ProductIds": [
        1626127,
        1626128,
        1626129,
        1626130,
        1626131
    ],
    "Payout": {
        "DescriptionApply": true,
        "Description": "Ödemeye özel para transferi açıklaması"
    }
}'
```

{% endtab %}
{% endtabs %}

**Servisten dönen cevap:**

<table><thead><tr><th width="189">Parametre</th><th width="100.33333333333331">Tip</th><th>Açıklama</th></tr></thead><tbody><tr><td>ErrorCode</td><td>int</td><td>Hata kodu. İşlem başarılı ise '0' değerini döner.</td></tr><tr><td>Result</td><td>bool</td><td>True ya da false değeri döner. İşlem başarılı iste 'true' değerini döner.</td></tr><tr><td>Message</td><td>string</td><td>İşlem hatalıysa, bu hataya dair belirtilen mesajdır, locale parametresine göre dil desteği sunar.</td></tr><tr><td>Body</td><td>nesne</td><td>İşlem detay bilgileri</td></tr></tbody></table>

{% hint style="success" %}
Başarılı için örnek cevap
{% endhint %}

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

```json
{
    "ErrorCode": 0,
    "Result": true,
    "Message": "",
    "Body": {
        "Success": [
            {
                "ProductId": 1626132
            },
            {
                "ProductId": 1626133
            },
            {
                "ProductId": 1626134
            },
            {
                "ProductId": 1626135
            },
            {
                "ProductId": 1626136
            }
        ],
        "Fail": []
    }
}
```

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

{% hint style="danger" %}
Başarısız için örnek cevap
{% endhint %}

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

```json
{
    "ErrorCode": 1,
    "Result": false,
    "Message": "",
    "Body": {
        "Success": [],
        "Fail": [
            {
                "ProductId": 1626132,
                "Reason": "This product already approved"
            },
            {
                "ProductId": 1626133,
                "Reason": "This product already approved"
            },
            {
                "ProductId": 1626134,
                "Reason": "This product already approved"
            },
            {
                "ProductId": 1626135,
                "Reason": "This product already approved"
            },
            {
                "ProductId": 1626136,
                "Reason": "This product already approved"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}
