define("APP_ID", "XXXXXXXXXXXXX");
define("APP_SECRET", "XXXXXXXXXXXXX");
define("CALLBACK_URL", "https://website.com/callback.php");
$pyz_data = [
'app_id' => APP_ID,
'app_secret' => APP_SECRET
];
$hCon = curl_init("https://api.paynoloji.com/token");
curl_setopt_array($hCon, [
CURLOPT_USERAGENT => APP_ID,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => ['Content-Type:application/json'],
CURLOPT_POSTFIELDS => json_encode($pyz_data)
]);
$hRet = curl_exec($hCon);
curl_close($hCon);
$pyz_res = json_decode($hRet, true);
if ($pyz_res['code'] == 200) {
$authToken = $pyz_res['token'];
$data = [
'card_number' => $_POST['number'],
'amount' => $_POST['amount']
];
$hCon = curl_init("https://api.paynoloji.com/installments");
curl_setopt_array($hCon, [
CURLOPT_USERAGENT => APP_ID,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => ['Content-Type:application/json', "Authorization: Bearer " . $authToken],
CURLOPT_POSTFIELDS => json_encode($data)
]);
$hRet = curl_exec($hCon);
curl_close($hCon);
$pyz_res = json_decode($hRet, true);
if ($pyz_res['code'] == 200) {
$payToken = $pyz_res['payToken'];
$other_code = md5(time());
$pyz_data = [
'card_holder' => $_POST['name'],
'card_number' => $_POST['number'],
'exp_month' => $_POST['expiry_month'],
'exp_year' => $_POST['expiry_year'],
'cvv' => $_POST['cvv'],
'amount' => $_POST['amount'],
'redirectOkUrl' => redirectOkUrl,
'redirectFailUrl' => redirectFailUrl,
'redirectOkUrl' => notifyUrl,
'paymentID' => paymentID,
'note' => note,
'currency' => currency,
'installment' => $_POST['installment'], // Taksitli kurgu yoksa 1 olarak gönderiniz.
];
$hCon = curl_init("https://api.paynoloji.com/pay3D");
curl_setopt_array($hCon, [
CURLOPT_USERAGENT => APP_ID,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => ['Content-Type:application/json', "Authorization: Bearer " . $authToken],
CURLOPT_POSTFIELDS => json_encode($pyz_data)
]);
$hRet = curl_exec($hCon);
curl_close($hCon);
$pyz_res = json_decode($hRet, true);
$redirectUrl = $pyz_res['redirectUrl'];
header("Location: {$redirectUrl}");
exit();
} else {
exit("payToken: jeton alınamadı.");
}
} else {
exit("authToken: jeton alınamadı.");
}
Örnek Php Kodu
Php ile geri dönüş kodlarını inceleyebilir dilerseniz buraya tıklayarak indirebilirsiniz.
define("APP_ID", "XXXXXXXXXXXXX");
define("APP_SECRET", "XXXXXXXXXXXXX");
if (isset($_POST['VerifyHash']) AND isset($_POST['otherCode'])) {
$status = $_POST['status'];
$VerifyHash = $_POST['VerifyHash'];
$otherCode = $_POST['otherCode'];
$saleID = $_POST['saleID'];
$verify_key = APP_ID . '|' . APP_SECRET . '|' . $otherCode . '|true';
if ($status == 1 AND $VerifyHash == hash("sha256", $verify_key)) {
print("Ödemeniz başarılı.");
}else{
$result_code = $_POST['resultCode'];
$result_message = $_POST['resultMessage'];
print($result_code, $result_message);
exit();
}
}