[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: payment-return.php
<?php include("functions.php"); if(!isset($_SESSION['index_no78897498'])){ header("location:index"); } else { $stu_code = $_SESSION['index_no78897498']; // ✅ Step 1: Get ReferenceId from Access Bank redirect if (!isset($_GET['referenceId'])) { echo "<h3 class='text-danger text-center mt-5'>No reference ID received.</h3>"; exit; } $referenceId = $_GET['referenceId']; // ✅ Step 2: Call Access Bank Transaction Status API $url = "https://apps.ghana.accessbankplc.com/webpay/Checkout/v1/Transaction/Status"; $data = [ "ReferenceId" => $referenceId ]; $headers = [ "Content-Type: application/json", "Authorization: Ym5Jd2IzQjNaSEYyZWpOTS5kZXYuYTNwQk5FNXFNWGQyUlZGeQ==", "User-Agent: Mozilla/5.0" ]; $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2 ]); $response = curl_exec($ch); if (curl_errno($ch)) { $errorMsg = "cURL Error: " . curl_error($ch); curl_close($ch); die("<h3 class='text-danger text-center mt-5'>$errorMsg</h3>"); } $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $result = json_decode($response, true); // Prepare variables for UI $statusText = "Unable to verify transaction."; $statusClass = "secondary"; $amount = $method = $transactionId = ""; if ($httpcode === 200 && isset($result['result']['transaction'])) { $transaction = $result['result']['transaction']; $code = $transaction['Code'] ?? ''; $status = $transaction['Status'] ?? ''; $amount = $transaction['Amount'] ?? ''; $method = $transaction['PaymentMethod'] ?? ''; $transactionId = $transaction['TransactionId'] ?? ''; if ($code === "000" && strtoupper($status) === "S") { $statusText = "Payment Successful!"; $statusClass = "success"; $indexxy = mysqli_query($new,"SELECT * FROM stud_payment WHERE indexNumber = '$stu_code'"); if(mysqli_num_rows($indexxy) > 1){ header("location:index"); exit(); } else { $indexx = mysqli_query($new,"SELECT * FROM enrol_generic WHERE indexNo = '$stu_code'"); $fetchsch = mysqli_fetch_array($indexx); $school_code = $fetchsch['s_code']; $pstatus = "Paid"; $date = date("Y-m-d"); $save = mysqli_query($new,"INSERT INTO stud_payment(s_code,indexNumber,amount,pstatus,datepaid,transaction_id,access_code)VALUES('".$school_code."','".$stu_code."','".$amount."','".$pstatus."','".$date."','".$referenceId."','".$transactionId."')"); } } else { $statusText = "Payment Failed or Pending"; $statusClass = "danger"; } } else { $statusText = "Could not verify transaction. Please try again later."; $statusClass = "warning"; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Payment Confirmation</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body class="bg-light"> <div class="container mt-5"> <div class="card shadow-sm p-4 text-center"> <h3 class="text-<?php echo $statusClass; ?>"><?php echo $statusText; ?></h3> <p><strong>Reference ID:</strong> <?php echo htmlspecialchars($referenceId); ?></p> <?php if ($transactionId): ?> <p><strong>Transaction ID:</strong> <?php echo htmlspecialchars($transactionId); ?></p> <?php endif; ?> <a href="index" class="btn btn-outline-primary mt-3">Go to dashboard</a> </div> </div> </body> </html> <?php } ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002