File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ const checkoutSchema = z.object({
1616
1717export async function POST ( request : NextRequest ) {
1818 try {
19+ if ( ! process . env . STRIPE_SECRET_KEY ) {
20+ return NextResponse . json (
21+ { error : 'Stripe not configured' } ,
22+ { status : 500 }
23+ )
24+ }
25+
1926 const session = await getServerSession ( authOptions )
2027
2128 if ( ! session ?. user ) {
Original file line number Diff line number Diff line change @@ -11,6 +11,13 @@ import prisma from '@/app/lib/db'
1111
1212export async function POST ( request : NextRequest ) {
1313 try {
14+ if ( ! process . env . STRIPE_SECRET_KEY ) {
15+ return NextResponse . json (
16+ { error : 'Stripe not configured' } ,
17+ { status : 500 }
18+ )
19+ }
20+
1421 const session = await getServerSession ( authOptions )
1522
1623 if ( ! session ?. user ) {
Original file line number Diff line number Diff line change 44
55import Stripe from 'stripe'
66
7- if ( ! process . env . STRIPE_SECRET_KEY ) {
8- throw new Error ( 'STRIPE_SECRET_KEY is required' )
9- }
7+ // Allow build to succeed without Stripe key (will be set in production env)
8+ const stripeSecretKey = process . env . STRIPE_SECRET_KEY || 'sk_test_placeholder_for_build'
109
11- export const stripe = new Stripe ( process . env . STRIPE_SECRET_KEY , {
10+ export const stripe = new Stripe ( stripeSecretKey , {
1211 apiVersion : '2025-12-15.clover' ,
1312 typescript : true ,
1413} )
You can’t perform that action at this time.
0 commit comments