import Stripe from "stripe"; let stripe: Stripe | null = null; /** * Server-only Stripe client. * Lazy-initialised to avoid build-time crashes. */ export function getStripe(): Stripe { if (!process.env.STRIPE_SECRET_KEY) { throw new Error("STRIPE_SECRET_KEY missing"); } if (!stripe) { stripe = new Stripe(process.env.STRIPE_SECRET_KEY); } return stripe; }