fix(checkout): skip loadStripe when no publishable key is set #3

Merged
mohammad merged 1 commits from seo-round-2 into main 2026-10-19 13:11:41 +00:00
Showing only changes of commit 81358b0815 - Show all commits
+4 -1
View File
@@ -9,7 +9,10 @@ import { PaymentStep } from './checkout/PaymentStep';
import { ReviewStep } from './checkout/ReviewStep'; import { ReviewStep } from './checkout/ReviewStep';
import { ConfirmationStep } from './checkout/ConfirmationStep'; import { ConfirmationStep } from './checkout/ConfirmationStep';
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!); // Without a publishable key (local builds), loadStripe throws on every page that
// imports this module. Elements accepts null and the payment step stays empty.
const publishableKey = process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY;
const stripePromise = publishableKey ? loadStripe(publishableKey) : null;
const STEPS: { id: CheckoutStep; label: string }[] = [ const STEPS: { id: CheckoutStep; label: string }[] = [
{ id: 'shipping', label: 'Shipping' }, { id: 'shipping', label: 'Shipping' },