
    function redirectToPayment() {
        const payButton = document.getElementById("payButton");
        const payText = document.getElementById("payText");
        const paySpinner = document.getElementById("paySpinner");

        // Show loading spinner
        payText.style.display = "none";
        paySpinner.style.display = "block";

        // Redirect to Flutterwave payment link
        window.location.href = "https://sandbox.flutterwave.com/pay/imoierg6fuvz";
    }

    // Check if payment was successful
    function checkPaymentSuccess() {
        const urlParams = new URLSearchParams(window.location.search);
        if (urlParams.has("status") && urlParams.get("status") === "successful") {
            // Redirect user to view the PDF
            window.location.href = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"; // Test PDF link
        }
    }

    // Run this function on page load to check if payment was successful
    window.onload = checkPaymentSuccess;