import Stripe from 'stripe'; let _stripe: Stripe | null = null; export function getStripe(): Stripe { if (!_stripe) { const key = process.env.STRIPE_SECRET_KEY; if (!key) { throw new Error('STRIPE_SECRET_KEY is required. Set it in .env or environment.'); } _stripe = new Stripe(key, { apiVersion: '2026-04-22.dahlia', typescript: true, }); } return _stripe; } export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? 'sk_test_placeholder', { apiVersion: '2026-04-22.dahlia', typescript: true, });