What I need ?

It is necessary to has "Paynet API KEY" to use Paynet payment method and access services.If you are Paynet customer you can request Paynet API keys from odeme.paynet.com.tr address.If you are not Paynet customer yet,you can request Paynet API key from destek@paynet.com.tr mail address.

It's necessary to has an static IP address to access Paynet services.

Secret Key

It is using for authenticate Paynet API Rest services.The authentication type is HTTP Basic authentication.Secret key is sent in the Authentication header of the Http Request.All sent requests must have an authentication header.

Authorization: Basic sck_pcs_jECRyoZq0khnsV9elaF/SIBVvxQI+bIW

In the following example at belove you can see how to perform basic authentication

<?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";
}
?>