File: /var/www/vhosts/sethsawariyabizmart.com/httpdocs/masterAir/masterCheckout/test/private-test.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include('../../errorPage.php');
include('../../functions.php');
include('../../cred-config.php');
include('../../datalist.php');
$orderId = trim($_POST['oid']);
$providerId = trim($_POST['provider_id']);
$amount = floatval($_POST['amount']);
if (empty($orderId) || empty($amount) || $amount <= 0) {
errorPage('Invalid order ID or amount.');
exit;
}
$formattedAmount = number_format($amount, 2);
$profile = generateFakeIndianProfile();
$payerEmail = trim($profile['email']);
$payerMobile = trim($profile['phone']);
$data = generateOrder($orderId, $formattedAmount, $payerMobile, $payerEmail, $providerId);
if (!isset($data['status']) || $data['status'] != 200) {
errorPage('Transaction failed, please try again.');
exit;
}
$upiLink = $data['QRCODE_STRING'];
$queryPart = explode('upi://pay?', $upiLink)[1] ?? '';
// Build UPI app links
$gpayLink = 'tez://upi/pay?' . $queryPart;
$phonepeLink = 'phonepe://pay?' . $queryPart;
$paytmLink = 'paytmmp://pay?' . $queryPart;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Payment Links</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background: #f8f9fa;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background: #fff;
padding: 25px;
border-radius: 12px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 480px;
width: 100%;
text-align: center;
}
h2 {
margin-bottom: 15px;
}
.btn {
display: block;
width: 100%;
padding: 12px;
margin: 10px 0;
border: none;
border-radius: 6px;
color: white;
font-size: 16px;
cursor: pointer;
transition: transform 0.2s ease, background 0.3s ease;
}
.btn:hover {
transform: scale(1.03);
}
.gpay {
background: #4285F4;
}
.gpay:hover {
background: #3367d6;
}
.phonepe {
background: #5f259f;
}
.phonepe:hover {
background: #471c78;
}
.paytm {
background: #002e6e;
}
.paytm:hover {
background: #001f4d;
}
.link {
word-break: break-all;
font-size: 14px;
color: #333;
background: #f2f2f2;
padding: 8px;
border-radius: 6px;
margin-bottom: 15px;
text-align: left;
}
pre {
text-align: left;
background: #f7f7f7;
padding: 10px;
border-radius: 8px;
font-size: 13px;
overflow-x: auto;
}
@media(max-width: 600px) {
.container {
padding: 15px;
}
.btn {
font-size: 15px;
padding: 10px;
}
.link {
font-size: 13px;
padding: 6px;
}
}
</style>
</head>
<body>
<div class="container">
<h2>Payment Links</h2>
<button class="btn phonepe" onclick="openUPI('<?php echo $phonepeLink; ?>')">Pay with PhonePe</button>
<button class="btn gpay" onclick="openUPI('<?php echo $gpayLink; ?>')">Pay with Google Pay</button>
<button class="btn paytm" onclick="openUPI('<?php echo $paytmLink; ?>')">Pay with Paytm</button>
<hr>
<h3>API Response</h3>
<pre><?php echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); ?></pre>
</div>
<script>
function openUPI(url) {
// For mobile users: open directly in app
if (/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)) {
window.location.href = url;
setTimeout(() => {
}, 2000);
} else {
}
}
</script>
</body>
</html>
<?php
exit;
?>