diff --git a/apps/sim/app/api/billing/webhooks/stripe/route.ts b/apps/sim/app/api/billing/webhooks/stripe/route.ts index 8d150286d..d6b03f32d 100644 --- a/apps/sim/app/api/billing/webhooks/stripe/route.ts +++ b/apps/sim/app/api/billing/webhooks/stripe/route.ts @@ -24,7 +24,7 @@ export async function POST(request: NextRequest) { return NextResponse.json({ error: 'Missing Stripe signature' }, { status: 400 }) } - if (!env.STRIPE_WEBHOOK_SECRET) { + if (!env.STRIPE_BILLING_WEBHOOK_SECRET) { logger.error('Missing Stripe webhook secret configuration') return NextResponse.json({ error: 'Webhook secret not configured' }, { status: 500 }) } @@ -43,7 +43,7 @@ export async function POST(request: NextRequest) { // Verify webhook signature let event: Stripe.Event try { - event = stripe.webhooks.constructEvent(body, signature, env.STRIPE_WEBHOOK_SECRET) + event = stripe.webhooks.constructEvent(body, signature, env.STRIPE_BILLING_WEBHOOK_SECRET) } catch (signatureError) { logger.error('Invalid Stripe webhook signature', { error: signatureError, diff --git a/apps/sim/lib/env.ts b/apps/sim/lib/env.ts index 7cf7257e9..07e6b2080 100644 --- a/apps/sim/lib/env.ts +++ b/apps/sim/lib/env.ts @@ -17,6 +17,7 @@ export const env = createEnv({ POSTGRES_URL: z.string().url().optional(), STRIPE_SECRET_KEY: z.string().min(1).optional(), + STRIPE_BILLING_WEBHOOK_SECRET: z.string().min(1).optional(), STRIPE_WEBHOOK_SECRET: z.string().min(1).optional(), STRIPE_FREE_PRICE_ID: z.string().min(1).optional(), FREE_TIER_COST_LIMIT: z.number().optional(),