| Server IP : 172.64.80.1 / Your IP : 172.69.58.211 Web Server : Apache System : Linux mail.federalpolyede.edu.ng 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64 User : federalpolyede.edu.ng_idh35skikv ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/federalpolyede.edu.ng/httpdocs_backup/eace_admin_student/ |
Upload File : |
<?php
session_start();
ob_flush();
$curl = curl_init();
//require_once('eTranConstant.php');
$id=3;
$orderID=$_SESSION['transID']="sf-ACE19".$id.mt_rand(1000, 9999);
$payerEmail=$_POST['payerEmail'];
$payerPhone=$_POST['payerPhone'];
$formNo=$_SESSION['formNo']=$_SESSION['matNo'];
$matNo=$_SESSION['matNo'];
$amount =$_POST['amt']*100;
$real_amount=$_POST['amt'];
//$email = "[email protected]";
$_SESSION['descr']=$descr=$_POST['pt'];
//$amount = 30000; //the amount in kobo. This value is actually NGN 300
$callback_url="https://federalpolyede.edu.ng/eace_admin_student/paystack_callback.php";
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paystack.co/transaction/initialize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER=> false,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount'=>$amount,
'email'=>$payerEmail,
'callback_url'=>$callback_url,
'reference'=>$orderID
]),
CURLOPT_HTTPHEADER => [
"authorization: Bearer sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273", //replace this with your own test key
"content-type: application/json",
"cache-control: no-cache"
],
));
$response = curl_exec($curl);
$err = curl_error($curl);
if($err){
// there was an error contacting the Paystack API
die('Curl returned error: ' . $err);
}
$tranx = json_decode($response, true);
if(!$tranx->status){
// there was an error from the API
print_r('API returned error: ' . $tranx['message']);
}
// comment out this line if you want to redirect the user to the payment page
//print_r($tranx);
// redirect to page so User can pay
// uncomment this line to allow the user redirect to the payment page
require('../connect.php');
$db=db_connect();
require('../filetoU/logFile.php');
$logD='OrderID: '.$orderID.' eace_PaymentType: '.$descr;
logDetail($formNo,$logD);
$ip2=$_SERVER['HTTP_X_FORWARDED_FOR'];
$ip1=$_SERVER['REMOTE_ADDR'];
$aspoa="INSERT INTO `fedpoly`.`eace_remitaorder` (`sn`, `orderID`, `remitaRRR`, `transDate`, `transStatus`, `regNo`, `transDetail`, `amtPaid`, `paymentType`, `transApproved`,`clientIP`,`clientProxy`,`pay_session`,`channnel`) VALUES (NULL, '$orderID', '0', CURRENT_TIMESTAMP, '-1', '$formNo', 'Not Yet Approved', '$real_amount', '$descr', 'False','$ip1','$ip2','2018/2019','')";
$db->query($aspoa);
$db->query("UPDATE `fedpoly`.`eace_admitted` SET `email` = '$payerEmail',`gsm` = '$payerPhone' WHERE `eace_admitted`.`formNo` = '$formNo'");
header('Location: ' . $tranx['data']['authorization_url']);
ob_end_flush();
?>
<!--<script lang="javascript">-->
<!-- // On the inline callback function, you can redirect to another page, passing the transaction reference-->
<!-- callback: function(response){-->
<!-- window.location = "http://www.yoururl.com/file.php?reference=" + response.reference;-->
<!-- }-->
<!---->
<!-- //So on that redirected page, you can run step 2 - Verification.-->
<!---->
<!--</script>-->