prepare("SELECT status FROM apk_payment WHERE order_id = :order_id"); $stmt->bindParam(':order_id', $order_id, PDO::PARAM_STR); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); if ($result === false) { http_response_code(404); // Not Found echo "Order not found."; exit; } if ($result['status'] == 'BELUM DIBAYAR') { include "pay.php"; } elseif ($result['status'] == 'PENDING' || $result['status'] == 'LUNAS' || $result['status'] == 'CANCELED') { include "proses.php"; } else { http_response_code(400); // Bad Request echo "Unknown status."; exit; } } catch (PDOException $e) { // Tangani kesalahan database http_response_code(500); // Internal Server Error echo "Database error: " . htmlspecialchars($e->getMessage()); exit; } ?>