text: import Stripe from 'stripe';
  
  export default async function handler(req, res) {
    if (req.method === 'POST') {
      const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
      try {
        const paymentIntent = await stripe.paymentIntents.create({
          amount: 2000,
          currency: 'usd',
          automatic_payment_methods: {
            enabled: true,
          }
        });
  
        res.send({
          clientSecret: paymentIntent.client_secret,
        });
      } catch (err) {
        res.status(err.statusCode || 500).json(err.message);
      }
    } else {
      res.status(405).end('Method not allowed');
    }
  }
  