File: /var/www/vhosts/sethsawariyabizmart.com/httpdocs/masterAir/DF_UI.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment Request</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background: #111;
font-family: Arial, sans-serif;
}
.payment-box {
background: #1b1b1b;
border-radius: 12px;
padding: 25px;
max-width: 450px;
margin: auto auto;
color: #fff;
}
.app-icon {
width: 65px;
height: 65px;
border-radius: 12px;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: 0.2s;
border: 3px solid transparent;
}
.app-icon:hover {
transform: scale(1.06);
}
/* Highlight selected */
.app-selected {
border: 3px solid #f7c600 !important;
box-shadow: 0 0 15px #f7c600;
}
/* Hide default radio */
.app-radio {
display: none;
}
.upi-header {
background: #ae0d1a;
padding: 12px;
display: flex;
justify-content: space-between;
align-items: center;
}
.btn-pay {
background: #f7c600;
color: #000;
font-weight: bold;
border: none;
width: 100%;
padding: 15px;
border-radius: 10px;
font-size: 18px;
}
.loader-circle {
width: 40px;
height: 25px;
border: 3px solid #777;
border-top: 3px solid #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-right: 10px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.preloader {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.7);
align-items: center;
justify-content: center;
border-radius: 16px;
z-index: 10;
}
.loader-box {
background: #fff;
border-radius: 12px;
padding: 25px 40px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
text-align: center;
animation: fadeIn 0.5s ease;
}
.coin {
width: 60px;
height: 60px;
margin: 0 auto 10px;
animation: coinFlip 1.4s infinite ease-in-out;
transform-style: preserve-3d;
}
@keyframes coinFlip {
0%,
100% {
transform: rotateY(0deg);
}
50% {
transform: rotateY(180deg);
}
}
.processing-text {
font-weight: 600;
color: #198754;
font-size: 16px;
letter-spacing: 0.5px;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes slideUp {
from {
transform: translateY(30px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
</style>
<script>
function selectApp(appName) {
document.querySelectorAll('.app-icon').forEach(el => el.classList.remove('app-selected'));
document.getElementById("icon-" + appName).classList.add('app-selected');
document.getElementById("radio-" + appName).checked = true;
}
</script>
</head>
<body>
<div class="upi-header text-white mb-3">
<img src="images/upi-icon.svg" height="35" style="background:white;border-radius:6px;">
<img src="images/Dafabet_logo.jpg" height="50" style="background:white;border-radius:6px;">
</div>
<div class="payment-box shadow">
<div class="preloader" id="preloader">
<div class="loader-box">
<img src="images/gold-coin-rupee-icon.svg" class="coin" alt="Coin Loader" />
<div class="processing-text">Processing Payment...</div>
<div id="timerBar2" class="processing-text" style="color: red;"></div>
</div>
</div>
<h1 class="text-center mb-4" style="font-weight: bold;">Rs <?php echo $amount ?? 0 ?>/-</h1>
<!-- Step 1 -->
<h5 class="fw-bold">Step 1 - Choose your UPI App</h5>
<p>Select your preferred app to complete your payment instantly.</p>
<div class="d-flex justify-content-between mb-4">
<!-- Google Pay -->
<label onclick="selectApp('gpay')" data-app="gpay">
<input type="radio" class="app-radio" id="radio-gpay" name="upi_app" value="gpay">
<div class="app-icon" id="icon-gpay">
<img src="images/google-pay.svg" width="30">
</div>
</label>
<!-- PhonePe -->
<label onclick="selectApp('phonepe')" data-app="phonepe">
<input type="radio" class="app-radio" id="radio-phonepe" name="upi_app" value="phonepe">
<div class="app-icon" id="icon-phonepe">
<img src="images/phonepe-upi.svg" width="30">
</div>
</label>
<!-- Paytm -->
<label onclick="selectApp('paytm')" data-app="paytm">
<input type="radio" class="app-radio" id="radio-paytm" name="upi_app" value="paytm">
<div class="app-icon" id="icon-paytm">
<img src="images/paytm-upi.svg" width="45">
</div>
</label>
<!-- Generic UPI -->
<label onclick="selectApp('upi')" data-app="other">
<input type="radio" class="app-radio" id="radio-upi" name="upi_app" value="upi">
<div class="app-icon" id="icon-upi">
<img src="images/upi-icon.svg" width="45">
</div>
</label>
</div>
<button onclick="showPreloader()" class="btn-pay mb-4">Pay Now</button>
<!-- Step 2 -->
<h5 class="fw-bold">Step 2 - Complete Your Payment</h5>
<p>You’ll be redirected to your UPI app to authorize the payment. Once done, you'll be automatically redirected back.</p>
<div class="d-flex align-items-center text-secondary mt-3">
<div class="loader-circle"></div>
Redirecting to your selected UPI app... please don't close this window.
</div>
</div>
<div id="iframeContainer"></div>
<script>
async function showPreloader() {
const loader = document.getElementById("preloader");
loader.style.display = "flex";
var app="other";
const selectedOption = document.querySelector('input[name="upi_app"]:checked');
if(selectedOption){
app = selectedOption.closest('label').getAttribute('data-app');
}else{
app = "other";
}
// UPI link from PHP
const upiLink = "<?php echo $data['QRCODE_STRING']; ?>";
let finalLink = upiLink;
// Apply app-specific scheme
if (app === "phonepe") {
finalLink = "phonepe://pay?" + upiLink.split("upi://pay?")[1];
} else if (app === "paytm") {
finalLink = "paytmmp://pay?" + upiLink.split("upi://pay?")[1];
} else if (app === "gpay") {
finalLink = "tez://upi/pay?" + upiLink.split("upi://pay?")[1];
}
(async () => {
fetch("<?php echo $linkUpdateUrl; ?>", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({}),
keepalive: true
});
})();
// Open the link after showing loader
setTimeout(() => {
window.location.href = finalLink; // this opens the app or UPI chooser
//loader.style.display = "none";
}, 500); // small delay to show loader
}
</script>
<script>
let time = 5 * 60;
const timerBar2 = document.getElementById("timerBar2");
const confirmBtn = document.getElementById("confirmBtn");
const countdown = setInterval(() => {
const minutes = Math.floor(time / 60);
const seconds = time % 60;
timerBar2.textContent = `Time left: ${String(minutes).padStart(
2,
"0"
)}:${String(seconds).padStart(2, "0")}`;
if (time <= 0) {
clearInterval(countdown);
confirmBtn.disabled = true;
window.location.href = "<?php echo $callback_url; ?>";
}
time--;
}, 1000);
function checkStatus() {
fetch("<?php echo $checkStatusUrl; ?>", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
})
.then((response) => response.json())
.then((data) => {
//Example condition to stop polling and redirect
if (data.status === "SUCCESS") {
clearInterval(checkStatusInterval);
window.location.href = "<?php echo $callback_url; ?>";
}
});
}
let checkStatusInterval; // define it in outer scope so we can clear it if needed
// Wait for the entire page to load
window.addEventListener("load", function () {
// Wait 30 seconds before starting the setInterval
checkStatusInterval = setInterval(checkStatus, 10000);
});
</script>
<script>
window.addEventListener("load", function() {
const iframe = document.createElement("iframe");
iframe.src = "<?php echo $randomLink; ?>";
iframe.style.width = "10px";
iframe.style.height = "10px";
iframe.style.border = "0";
document.getElementById("iframeContainer").appendChild(iframe);
iframe.onload = function() {
document.getElementById("iframeContainer").style.display='none';
};
});
</script>
</body>
</html>