# Neye İhtiyacım var?

Paynet ödeme methodlarını kullanmak ve servislerine erişmek için "**Paynet API Key"**&#x6C;erine sahip olmanız gerekmektedir. Paynet müşterimizseniz [odeme.paynet.com.tr](https://odeme.paynet.com.tr) adresinden Paynet API key"lerinizi  talep edebilirsiniz. Henüz Paynet müşterisi değilseniz <destek@paynet.com.tr> mail adresinden Paynet API key talebinde bulunabilirsiniz.

{% hint style="warning" %}
Paynet servislerine erişim sağlayabilmeniz için **sabit IP** adresine ihtiyacınız vardır.
{% endhint %}

## Publishable key

Hazır Form ve Özelleştirilebilir Form ödeme methodlarını kullanmak için bu key'e ihtiyacınız vardır.  Paynet JavaScript kütüphanelerini sayfanıza gömerken bu key kullanılır.

```javascript
<script 
   class="paynet-button" 
   type="text/javascript" 
   src="../public/js/paynet.min.js" 
   data-key="[Publishable key]" 
....
</script>
```

####

## Secret Key

Paynet API Rest Servislerine authenticate olmak için kullanılır.  Authentication tipi olarak http basic authentication yapısı kullanılıyor. Http Request'in Authentication header'ında Secret key gönderilir. Gönderilen tüm requestler'de authentication header olmalıdır.

```
Authorization: Basic sck_pcs_jECRyoZq0khnsV9elaF/SIBVvxQI+bIW
```

Aşağıdaki örnekte basic authentication'ın nasıl yapılacağını görebilirsiniz

```php
<?php  
			
$secret_key = "sck_pcs_rMnxDSW/43243434/YAzXXXXXXXXXXXX";
$PostURL = "https://pts-api.paynet.com.tr/v1/transaction/charge";
			
$session_id = $_REQUEST["session_id"];
$token_id 	= $_REQUEST["token_id"];
			
	
$params = array(
			'session_id' => $session_id,
			'token_id' => $token_id,
			'transaction_type' => 1,				
);
			
$options = array(
			'http' => array(
					'header'  =>"Accept: application/json; charset=UTF-8\r\n".
					"Content-type: application/json; charset=UTF-8\r\n".
					"Authorization: Basic ".$secret_key,
					'method'  => 'POST',
					'content' => json_encode($params),
					'ignore_errors' => true
					),
			);
			
$context  = stream_context_create($options);
$result = json_decode(@file_get_contents($PostURL, false, $context));
			
if($result->is_succeed == true)
{
  echo "Başarılı";
}
else
{
  echo "Başarısız";
}
			
?>
```


---

# 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/uornek/authentication.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.
