import type { Stripe as StripeProps } from "@stripe/stripe-js"; import { loadStripe } from "@stripe/stripe-js"; let stripePromise: Promise; export const getStripe = () => { if (!process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY) { throw new Error("NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY is not set"); } if (!stripePromise) { stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY); } return stripePromise; };