import { NextResponse } from "next/server"; import Stripe from "stripe"; const stripe = new Stripe(process.env.STRIPE_SECRET_KEY); export async function POST(request) { try { const { email } = await request.json(); if (!email) { return NextResponse.json({ error: "Email is required" }, { status: 400 }); } // Create Stripe customer const customer = await stripe.customers.create({ email }); return NextResponse.json({ stripe_customer_id: customer.id }); } catch (error) { console.error("Error creating Stripe customer:", error); return NextResponse.json({ error: "Failed to create Stripe customer" }, { status: 500 }); } }