Skip to content

Commit 36eb04d

Browse files
committed
fix(stripe): added missing webhook secret for stripe webhook billing endpoint
1 parent 4285b36 commit 36eb04d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

apps/sim/app/api/billing/webhooks/stripe/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function POST(request: NextRequest) {
2424
return NextResponse.json({ error: 'Missing Stripe signature' }, { status: 400 })
2525
}
2626

27-
if (!env.STRIPE_WEBHOOK_SECRET) {
27+
if (!env.STRIPE_BILLING_WEBHOOK_SECRET) {
2828
logger.error('Missing Stripe webhook secret configuration')
2929
return NextResponse.json({ error: 'Webhook secret not configured' }, { status: 500 })
3030
}
@@ -43,7 +43,7 @@ export async function POST(request: NextRequest) {
4343
// Verify webhook signature
4444
let event: Stripe.Event
4545
try {
46-
event = stripe.webhooks.constructEvent(body, signature, env.STRIPE_WEBHOOK_SECRET)
46+
event = stripe.webhooks.constructEvent(body, signature, env.STRIPE_BILLING_WEBHOOK_SECRET)
4747
} catch (signatureError) {
4848
logger.error('Invalid Stripe webhook signature', {
4949
error: signatureError,

apps/sim/lib/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const env = createEnv({
1717

1818
POSTGRES_URL: z.string().url().optional(),
1919
STRIPE_SECRET_KEY: z.string().min(1).optional(),
20+
STRIPE_BILLING_WEBHOOK_SECRET: z.string().min(1).optional(),
2021
STRIPE_WEBHOOK_SECRET: z.string().min(1).optional(),
2122
STRIPE_FREE_PRICE_ID: z.string().min(1).optional(),
2223
FREE_TIER_COST_LIMIT: z.number().optional(),

0 commit comments

Comments
 (0)