Skip to content

Commit ab6b83b

Browse files
committed
chore: acknowledge webhook by responding 200
1 parent fa8cd52 commit ab6b83b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/app/api/stripe/webhook/route.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,20 @@ export async function POST(req: Request) {
8484
}
8585
} catch (error) {
8686
console.log(error);
87+
// We dealing with webhooks return a 200 to acknowledge receipt of the event
8788
return new Response(
8889
"Webhook handler failed. View your Next.js function logs.",
8990
{
90-
status: 400,
91+
status: 200,
9192
},
9293
);
9394
}
9495
} else {
96+
console.log(`❌ Unhandled event type: ${event.type}`);
97+
98+
// We dealing with webhooks return a 200 to acknowledge receipt of the event
9599
return new Response(`Unsupported event type: ${event.type}`, {
96-
status: 400,
100+
status: 200,
97101
});
98102
}
99103
return new Response(JSON.stringify({ received: true }));

0 commit comments

Comments
 (0)