$amount, 'cus_name' => 'Customer', 'cus_email' => 'customer@gmail.com', 'success_url' => $successUrl, 'cancel_url' => $cancelUrl, 'return_type' => 'GET' ]; $ch = curl_init('https://pay.nexusbd.top/api/payment/create'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => [ 'API-KEY: ' . $apiKey, 'Accept: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => false, CURLOPT_TIMEOUT => 30, ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); curl_close($ch); if ($error) { http_response_code(500); exit('Payment connection error: ' . htmlspecialchars($error)); } $result = json_decode($response, true); if (!empty($result['payment_url'])) { header('Location: ' . $result['payment_url']); exit; } http_response_code($httpCode ?: 500); echo '
'; echo htmlspecialchars($response); echo '';