fix(stripe): added missing webhook secret for stripe webhook billing endpoint

This commit is contained in:
Waleed Latif
2025-07-12 20:20:00 -07:00
parent 4285b36a42
commit 36eb04dab5
2 changed files with 3 additions and 2 deletions

View File

@@ -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,

View File

@@ -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(),