# Cari Hesap Entegrasyonu

Cari hesap entegrasyonu ile bayileriniz PayPortal üzerinden işlem yaptıklarında cari hesap bilgilerini (borç/alacak) ve kur bilgilerini görebilir.&#x20;

Aşağıdaki formatta hazırlayacağınız bir REST servis ile PayPortal sisteminize bağlanıp bayilerinizin cari hesap bilgilerini çeker.

PayPortal sizin sisteminize bağlanıp bilgileri çekeceği için; sizin sisteminizde oluşacak problemlerden etkilenmemek için "[Circuit Braker"](https://martinfowler.com/bliki/CircuitBreaker.html) design yöntemi ile çalışır.

{% tabs %}
{% tab title="İstek Parametreleri" %}

| Parametre İsmi    | Tip    | Zorunlu | Açıklama                  |
| ----------------- | ------ | ------- | ------------------------- |
| **company\_code** | string |         | Paynet ana firma kodu     |
| **agent\_id**     | string |         | Paynet bayi kodu          |
| **reference\_no** | string |         | Bayinin referans numarası |
| {% endtab %}      |        |         |                           |

{% tab title="Dönüş Parametreleri" %}

| Parametre İsmi                | Tip     | Açıklama                                                                                                               |
| ----------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------- |
| **note**                      | string  | Ekranda servisle ilgili gösterimde gösterilmesi gereken not bilgisi var ise bu parametre ile gönderilebilir.           |
| **accounts**                  | string  | Bayiye ait hesap tutarı                                                                                                |
| **show\_accounts**            | boolean | Hesap ile ilgili bilgilerin ekranda gösterilip gösterilmeyeceğine dair boolean değer.                                  |
| **first\_column\_title**      | string  | İlk sütunda dönülecek sayısal değerlerin başlığı                                                                       |
| **second\_column\_title**     | string  | İkinci sütunda dönülecek sayısal değerlerin başlığı                                                                    |
| **accounts.items**            | dizi    | Bayinin belli bir para birimine göre hesap bilgilerinin listesidir.                                                    |
| **currency**                  | string  | TRY,USD,EUR değerlerini alabilir.                                                                                      |
| **first\_column\_value**      | decimal | Ekranda ilk başlık altında gösterilmek istenen sayısal değer                                                           |
| **second\_column\_value**     | decimal | Ekranda ikinci başlık altında gösterilmek istenen sayısal değer                                                        |
| **currencies**                | string  | Ekranda değerleri gösterilmek istenen ve Paynet içinde hesaplamalarda kullanılmak üzere kur oranlarını dönen parametre |
| **show\_currencies**          | boolean | Kur oranlarının ekranda görünüp görünmeyeceğini belirtir.True/false                                                    |
| **show\_currency\_selection** | boolean | Kur seçiminin ekranda görünüp görünmeyeceğini belirtir.                                                                |
| **exchange\_rate**            | decimal | Kur oranı                                                                                                              |
| **is\_default**               | boolean | Kurun varsayılan olup olmadığını belirtir.                                                                             |
| {% endtab %}                  |         |                                                                                                                        |

{% tab title="Request" %}

```javascript
{  
   "agent_id":"53983",
   "company_code":"1000",
   "reference_no":"12471"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{  
   "note":"*Vadesi Dolan Borç",
   "accounts":{  
      "show_accounts":true,
      "first_column_title":"Bakiye",
      "second_column_title":"*V.D. Borç",
      "items":[  
         {  
            "currency":"TRY",
            "first_column_value":94793.81,
            "second_column_value":10336.78
         },
         {  
            "currency":"EUR",
            "first_column_value":0,
            "second_column_value":0
         },
         {  
            "currency":"USD",
            "first_column_value":4629.3,
            "second_column_value":2777.58
         }
      ]
   },
   "currencies":{  
      "show_currencies":true,
      "show_currency_selection":true,
      "items":[  
         {  
            "currency":"USD",
            "exchange_rate":5.9999,
            "is_default":false
         },
         {  
            "currency":"EUR",
            "exchange_rate":8,
            "is_default":false
         },
         {  
            "currency":"TRY",
            "exchange_rate":1,
            "is_default":true
         }
      ]
   }
}

```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Dikkat edilmesi gereken hususlar:**

1. &#x20;Başarısız olunan durumlarda Http status code 200 dışında herhangi bir parameter kodu ile dönülmeli( 500 gibi ).
2. Servis istekleri maximum 10 saniyede data dönmeli.
   {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.paynet.com.tr/servisler/cari-hesap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
