Next.js Discord

Discord Forum

NextJS 14. Route handlers POST not working

Answered
Red-throated Loon posted this in #help-forum
Open in Discord
Red-throated LoonOP
Hi! Maybe somone can help me? Thank you!! 🙂
I am really confused here, Ive tried this before but maybe I am doing it wrong? I have two files.

1) BuyButton.jsx client component.
2) POST Route Handler that asks Stripe to create a checkout session to pay for an item.

Inside this POST handler I have 2 parameters, the request and the response. Line 45 is failing and it says response.status is not a function. I also printed response right at the start but I get { params: undefined }

The handlePayment function is the one that executes when the buy button is pressed.
Answered by Ray
https://nextjs.org/docs/app/building-your-application/routing/route-handlers
check the doc here, the second parameter is not response
View full answer

2 Replies