/
/
home
/
u523034047
/
domains
/
psassociate.org
/
public_html
/
phonepe
Server: in-mum-web1112.main-hosting.eu (62.72.28.111)
You: 216.73.216.60
PHP 8.3.16
Dir:
/home/u523034047/domains/psassociate.org/public_html/phonepe
Edit:
/home/u523034047/domains/psassociate.org/public_html/phonepe/pay.php
<?php session_start(); require_once __DIR__ . '/phonepe_config.php'; if (!isset($_SESSION['career']) || empty($_SESSION['career']['name'])) { showError('Session Expired', 'Your session has expired.', '../post-resume.php', 'Fill Form Again'); } if (empty($_SESSION['career']['plan_amount'])) { showError('No Plan Selected', 'Please select a plan first.', 'select-plan.php', 'Select Plan'); } $career = $_SESSION['career']; $planAmount = (int) $career['plan_amount']; $planType = $career['plan_type']; if (!in_array($planAmount, [600, 1000], true)) { showError('Invalid Plan', 'Invalid plan selected.', 'select-plan.php', 'Select Plan'); } $amountPaisa = $planAmount * 100; $orderId = generateOrderId(); $_SESSION['career']['order_id'] = $orderId; logPayment('INIT', ['order_id' => $orderId, 'amount' => $planAmount, 'plan' => $planType, 'user' => $career['name']]); $token = getPhonePeToken(); if (!$token) { showError('Authentication Failed', 'Could not connect to payment gateway.', 'select-plan.php', 'Try Again'); } $payload = [ 'merchantOrderId' => $orderId, 'amount' => $amountPaisa, 'expireAfter' => 1200, 'metaInfo' => [ 'udf1' => $career['name'] ?? '', 'udf2' => $career['email'] ?? '', 'udf3' => $career['mobile'] ?? '', 'udf4' => $career['gender'] ?? '', 'udf5' => $career['state'] ?? '', 'udf6' => $career['city'] ?? '', 'udf7' => $career['studying'] ?? '', 'udf8' => $career['resume'] ?? '', 'udf9' => $planType, 'udf10' => (string) $planAmount ], 'paymentFlow' => ['type' => 'PG_CHECKOUT'], 'redirectUrl' => PHONEPE_REDIRECT_URL, 'callbackUrl' => PHONEPE_CALLBACK_URL, ]; $ch = curl_init(PHONEPE_PAY_URL); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Authorization: O-Bearer ' . $token], CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_TIMEOUT => 30, ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $curlErr = curl_error($ch); curl_close($ch); if ($curlErr) { logPayment('PAY_CURL_ERROR', ['order_id' => $orderId, 'error' => $curlErr]); showError('Connection Failed', 'Could not connect to payment gateway.', 'select-plan.php', 'Try Again'); } $result = json_decode($response, true); logPayment('PAY_RESPONSE', ['order_id' => $orderId, 'http_code' => $httpCode]); if ($httpCode !== 200 || empty($result['redirectUrl'])) { showError('Payment Failed', $result['message'] ?? 'Unexpected response.', 'select-plan.php', 'Try Again'); } $phonepeUrl = $result['redirectUrl']; $_SESSION['career']['phonepe_order_id'] = $result['orderId'] ?? $orderId; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Pay with PS Associate - Secure Checkout</title> <link rel="shortcut icon" href="../ico-images/u.ico" type="image/x-icon" /> <style> :root { --primary: #5f259f; --primary-light: #8a4ed3; --accent: #ff4757; --success: #22c55e; --bg: #0f172a; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: radial-gradient(circle at top right, #1e1b4b, #0f172a); color: #fff; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; } .glass-card { background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 24px; width: 100%; max-width: 420px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); animation: fadeIn 0.6s ease-out; } @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .header { padding: 40px 30px; text-align: center; background: linear-gradient(to bottom, rgba(95, 37, 159, 0.2), transparent); } .logo-ring { width: 80px; height: 80px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; position: relative; box-shadow: 0 0 30px rgba(95, 37, 159, 0.4); } .logo-ring::after { content: ''; position: absolute; top: -5px; left: -5px; right: -5px; bottom: -5px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.1); animation: pulse 2s infinite; } @keyframes pulse { 0% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.1); opacity: 0; } 100% { transform: scale(1); opacity: 0.5; } } .header h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; } .header p { font-size: 14px; opacity: 0.6; margin-top: 4px; } .body { padding: 0 30px 40px; } .amount-display { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 24px; text-align: center; margin-bottom: 24px; } .amount-display label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; opacity: 0.4; } .amount-display .val { font-size: 42px; font-weight: 900; color: #fff; margin: 4px 0; } .amount-display .plan { font-size: 13px; color: var(--primary-light); font-weight: 600; } .btn-pay { background: var(--primary); color: #fff; width: 100%; padding: 18px; border-radius: 16px; border: none; font-size: 16px; font-weight: 700; cursor: pointer; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 10px 20px -10px var(--primary); } .btn-pay:hover { transform: translateY(-3px); background: var(--primary-light); box-shadow: 0 15px 25px -10px var(--primary); } .btn-pay:active { transform: translateY(0); } .wait-screen { display: none; text-align: center; } .spinner-box { position: relative; width: 60px; height: 60px; margin: 0 auto 24px; } .spinner { width: 100%; height: 100%; border: 4px solid rgba(255, 255, 255, 0.05); border-top: 4px solid var(--primary-light); border-radius: 50%; animation: spin 0.8s linear infinite; } @keyframes spin { 100% { transform: rotate(360deg); } } .wait-screen h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; } .wait-screen p { font-size: 14px; opacity: 0.5; margin-bottom: 24px; line-height: 1.5; } .progress-container { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.05); border-radius: 10px; overflow: hidden; margin-bottom: 24px; } .progress-bar { height: 100%; background: linear-gradient(to right, var(--primary), var(--primary-light)); width: 0%; transition: width 0.4s ease-in-out; box-shadow: 0 0 10px var(--primary); } .manual-check { background: rgba(255, 255, 255, 0.05); color: #fff; border: 1px solid rgba(255, 255, 255, 0.1); padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: none; width: 100%; } .manual-check:hover { background: rgba(255, 255, 255, 0.1); } .secure-footer { margin-top: 32px; text-align: center; font-size: 11px; opacity: 0.3; display: flex; align-items: center; justify-content: center; gap: 6px; } </style> </head> <body> <div class="glass-card"> <div class="header"> <h2>Pay with PS Associate</h2> <p><?php echo htmlspecialchars($career['name']); ?></p> </div> <div class="body"> <div id="initScreen"> <div class="amount-display"> <label>Total</label> <div class="val">₹<?php echo number_format($planAmount); ?></div> <div class="plan"><?php echo htmlspecialchars($planType); ?> Access</div> </div> <button class="btn-pay" id="payBtn" onclick="openPayment()"> Review & Pay <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"> <path d="M5 12h14M12 5l7 7-7 7" /> </svg> </button> </div> <div class="wait-screen" id="waitScreen"> <div class="spinner-box"> <div class="spinner"></div> </div> <h3 id="waitTitle">Payment in Progress</h3> <p id="waitMsg">Please complete the transaction in the PhonePe window that opened.</p> <div class="progress-container"> <div class="progress-bar" id="progressBar"></div> </div> <button class="manual-check" id="manualBtn" onclick="forceCheck()">Verify Transaction Now</button> </div> <div class="secure-footer"> <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" /> </svg> End-to-End Secure Transaction </div> </div> </div> <script> var phonepeUrl = <?php echo json_encode($phonepeUrl); ?>; var orderId = <?php echo json_encode($orderId); ?>; var pollTimer = null; var checkCount = 0; var maxChecks = 60; function openPayment() { var payWin = window.open(phonepeUrl, '_blank'); if (payWin) { document.getElementById('initScreen').style.display = 'none'; document.getElementById('waitScreen').style.display = 'block'; startPolling(); } else { sessionStorage.setItem('pay_redirected_' + orderId, '1'); window.location.href = phonepeUrl; } } function startPolling() { document.getElementById('manualBtn').style.display = 'none'; pollTimer = setInterval(function () { checkCount++; var pct = Math.min((checkCount / maxChecks) * 100, 100); document.getElementById('progressBar').style.width = pct + '%'; if (checkCount > 4) document.getElementById('manualBtn').style.display = 'block'; if (checkCount >= maxChecks) { clearInterval(pollTimer); document.getElementById('waitTitle').innerText = 'Check Pending'; document.getElementById('waitMsg').innerText = 'Please click verify to confirm your payment status.'; return; } checkStatus(); }, 3000); } function checkStatus() { fetch('check_status.php?order=' + encodeURIComponent(orderId)) .then(function (r) { return r.json(); }) .then(function (data) { if (data.state === 'COMPLETED') { if (pollTimer) clearInterval(pollTimer); document.getElementById('waitTitle').innerText = 'Successful'; document.getElementById('waitMsg').innerText = 'Account activated. Redirecting...'; document.getElementById('progressBar').style.width = '100%'; document.getElementById('progressBar').style.background = '#22c55e'; setTimeout(function () { window.location.href = 'success.php'; }, 800); } else if (data.state === 'FAILED') { if (pollTimer) clearInterval(pollTimer); window.location.href = 'failed.php?reason=FAILED'; } }) .catch(function () { }); } function forceCheck() { var mBtn = document.getElementById('manualBtn'); mBtn.disabled = true; mBtn.innerText = 'Verifying...'; checkStatus(); setTimeout(function () { mBtn.disabled = false; mBtn.innerText = 'Verify Transaction Now'; }, 3000); } window.addEventListener('pageshow', function () { if (sessionStorage.getItem('pay_redirected_' + orderId) === '1') { document.getElementById('initScreen').style.display = 'none'; document.getElementById('waitScreen').style.display = 'block'; document.getElementById('waitTitle').innerText = 'Awaiting Confirmation'; document.getElementById('manualBtn').style.display = 'block'; startPolling(); } }); document.addEventListener('visibilitychange', function () { if (document.visibilityState === 'visible' && checkCount > 0) checkStatus(); }); </script> </body> </html>
Ukuran: 15.1 KB