<!doctype html>

<html>

  <head>

    <meta charset="utf-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <meta http-equiv="cache-control" content="no-store" />

    <title>Redirecting...</title>

  </head>

  <body>

    <p>Redirection vers la page de paiement...</p>

    <script>

      const url = new URL(window.location.href);

      const paymentId = url.searchParams.get("payment_id");

      if (!paymentId) {

        document.body.innerText = "Missing payment_id";

      } else {

        // IMPORTANT: on redirige vers ta fonction Supabase qui fait le POST Payzone

        const target =

          "https://lbsjjiaeefzyzksonljj.supabase.co/functions/v1/payzone_redirect?payment_id=" +

          encodeURIComponent(paymentId);

        window.location.replace(target);

      }

    </script>

  </body>

</html>