%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/www/website_6ca89795/ |
Upload File : |
<?php
session_start();
include('dbcon.php');
$access_token = "wcXHOTsOIsFCyCQxzrfzlek5xvknklUmyV3W5oTxL6eJxiAna+1ZVeIZ/OLcEKOA";
$order_id = isset($_GET['order_id']) ? (int)$_GET['order_id'] : 0;
if (!$order_id) {
die("Invalid Order ID");
}
// Fetch order
$stmt = $conn->prepare("
SELECT total_amount, unique_order_id
FROM orders
WHERE id = ?
");
if (!$stmt) {
die("DB Error: " . $conn->error);
}
$stmt->bind_param("i", $order_id);
$stmt->execute();
$order = $stmt->get_result()->fetch_assoc();
$stmt->close();
if (!$order) {
die("Order not found");
}
$amount = (float)$order['total_amount'];
$unique_order_id = !empty($order['unique_order_id'])
? $order['unique_order_id']
: $order_id;
// Payment data
$data = [
"amount" => (int)($amount * 100),
"currency_code" => "USD",
"message" => "Order #" . $unique_order_id,
"success_url" => "https://jgttourism.com/payment-success.php?order_id=" . $order_id,
"failure_url" => "https://jgttourism.com/payment-failed.php?order_id=" . $order_id
];
// API call
$ch = curl_init("https://api-v2.ziina.com/api/payment_intent");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . $access_token,
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
if (curl_errno($ch)) {
die("Curl Error: " . curl_error($ch));
}
curl_close($ch);
$result = json_decode($response, true);
// Redirect to Ziina Payment Page
if (isset($result['redirect_url'])) {
header("Location: " . $result['redirect_url']);
exit;
} else {
echo "<pre>";
print_r($result);
echo "</pre>";
exit("Payment Failed");
}
?>