diff --git a/src/App.tsx b/src/App.tsx
index ca8c2f4..ba9379f 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -12,6 +12,7 @@ import AccountConfirmation from "./pages/AccountConfirmation";
import Contact from "./pages/Contact";
import Admin from "./pages/Admin";
import FAQ from "./pages/FAQ";
+import OrderConfirmation from "./pages/OrderConfirmation";
import { PaymentTestModeBanner } from "@/components/PaymentTestModeBanner";
const queryClient = new QueryClient();
@@ -29,6 +30,7 @@ function AppContent() {
} />
} />
} />
+ } />
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
} />
diff --git a/src/components/PlansSection.tsx b/src/components/PlansSection.tsx
index 3432392..dd1ad13 100644
--- a/src/components/PlansSection.tsx
+++ b/src/components/PlansSection.tsx
@@ -122,7 +122,7 @@ const PlansSection = () => {
postal_code: result.data.postnummer,
city: "Storstockholm",
comments: result.data.kommentarer ?? "",
- return_url: `${window.location.origin}/?checkout=success&session_id={CHECKOUT_SESSION_ID}`,
+ return_url: `${window.location.origin}/order-confirmation?session_id={CHECKOUT_SESSION_ID}&method=card&kg=${recommendedKg}&email=${encodeURIComponent(result.data.epost)}`,
environment: getStripeEnvironment(),
};
@@ -134,7 +134,8 @@ const PlansSection = () => {
if (!(data as any)?.clientSecret) throw new Error("Kunde inte skapa checkout-session");
setClientSecret((data as any).clientSecret);
} else {
- setSubmitted("invoice");
+ window.location.href = `/order-confirmation?method=invoice&kg=${recommendedKg}&email=${encodeURIComponent(result.data.epost)}`;
+ return;
}
} catch (err: any) {
console.error(err);
diff --git a/src/pages/OrderConfirmation.tsx b/src/pages/OrderConfirmation.tsx
new file mode 100644
index 0000000..44d7bc9
--- /dev/null
+++ b/src/pages/OrderConfirmation.tsx
@@ -0,0 +1,108 @@
+import { useSearchParams, useNavigate } from "react-router-dom";
+import { CheckCircle2, Truck, Mail, Calendar } from "lucide-react";
+import Header from "@/components/Header";
+import { Button } from "@/components/ui/button";
+
+const OrderConfirmation = () => {
+ const [searchParams] = useSearchParams();
+ const navigate = useNavigate();
+
+ const method = searchParams.get("method") ?? "card";
+ const kg = searchParams.get("kg");
+ const email = searchParams.get("email");
+ const sessionId = searchParams.get("session_id");
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ Tack för din beställning!
+
+
+ Goda saker är på väg.
+
+
+
+
+ {kg && (
+
+
+ Ditt abonnemang
+
+
+ {kg} kg kakor / vecka
+
+
+ )}
+
+
+
+
+
Leverans varje tisdag
+
+ Vi levererar färska kakor till er adress inom Storstockholm varje tisdag
+ morgon. Första leveransen kommer inom kort.
+
+
+
+
+
+
+
+
+ {method === "invoice" ? "Faktura varje månad" : "Månatlig kortdragning"}
+
+
+ {method === "invoice"
+ ? "Faktura skickas till er e-post varje månad med 30 dagars betalningsvillkor."
+ : "Beloppet dras automatiskt från ert kort en gång i månaden. Du kan säga upp när som helst."}
+
+
+
+
+
+
+
+
Orderbekräftelse
+
+ En bekräftelse{email ? <> skickas till {email} > : " skickas till din e-post"} inom kort.
+
+
+
+
+ {sessionId && (
+
+
+ Referens: {sessionId}
+
+
+ )}
+
+
+
+ navigate("/")}
+ variant="outline"
+ className="font-display"
+ >
+ Tillbaka till startsidan
+
+
+
+
+ Äkta svenskt konditorhantverk
+
+
+
+
+ );
+};
+
+export default OrderConfirmation;