import Stripe from 'stripe';

// Temporary fallback for development
const stripeSecretKey = process.env.STRIPE_SECRET_KEY || 'sk_test_51M40olAkPY8EOZMWPGYqs4SQKD5Fcp3jCBxE7ZfStXeTHa68DqZ0hheJ5q2J6MHPL69P55WYdAxzDZpcbZ6dwRy900q5B8PJyI';

export const stripe = new Stripe(stripeSecretKey, {
    // @ts-expect-error Stripe API version mismatch – safe to ignore
  apiVersion: '2025-09-30.clover',
});

export const getStripeJs = () => {
  const stripePublishableKey = process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || 'pk_test_51M40olAkPY8EOZMWHWRuLczSwzhHEy8rCoPu0J1JMDDVYVzSa7i4UEE5mjoHyhWF4PFLmZEbWnGqvdhtXA1es19J005pYXbYGB';
  
  return import('@stripe/stripe-js').then((mod) => 
    mod.loadStripe(stripePublishableKey)
  );
};