/
/
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/check_status.php
<?php session_start(); header('Content-Type: application/json'); require_once __DIR__ . '/phonepe_config.php'; $orderId = $_GET['order'] ?? $_SESSION['career']['order_id'] ?? ''; if (empty($orderId)) { echo json_encode(['state' => 'UNKNOWN']); exit; } if (!empty($_SESSION['career']['payment_status']) && $_SESSION['career']['payment_status'] === 'SUCCESS') { echo json_encode(['state' => 'COMPLETED']); exit; } $token = getPhonePeToken(); if (!$token) { echo json_encode(['state' => 'UNKNOWN']); exit; } $statusUrl = PHONEPE_STATUS_URL . '/' . urlencode($orderId) . '/status'; $ch = curl_init($statusUrl); curl_setopt_array($ch, [ CURLOPT_HTTPGET => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Authorization: O-Bearer ' . $token], CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_TIMEOUT => 10, ]); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); $state = $result['state'] ?? 'PENDING'; if ($state === 'COMPLETED') { // Recover session from metadata if lost $metaData = parseUdfData($result['metaInfo'] ?? []); if (!empty($metaData)) { $_SESSION['career'] = $metaData; $_SESSION['career']['order_id'] = $orderId; $_SESSION['career']['transaction_id'] = $result['orderId'] ?? $orderId; $_SESSION['career']['payment_status'] = 'SUCCESS'; $_SESSION['career']['emails_sent'] = false; // success.php will handle final email check } } echo json_encode(['state' => $state]); exit; ?>
Ukuran: 1.5 KB