The Scenario
The store is now selling a digital e-book. When a user pays via Stripe, you cannot just fulfill the order on the "Success" page, because users can bookmark that page and visit it without paying. You must listen for Stripe to securely ping your server (a webhook) to confirm the payment before emailing the e-book.
The Brief
Write a Node.js/Next.js backend webhook handler. It must receive the POST request from Stripe, verify the cryptographic signature to ensure the request is actually from Stripe, parse the `checkout.session.completed` event, and run the mock fulfillment logic.
Deliverables
- The webhook route code, including the raw body parsing and `stripe.webhooks.constructEvent` verification logic
- The switch statement handling the specific event type
- A short explanation of why webhooks require raw bodies instead of JSON parsed bodies
Submission Guidance
Webhook signature verification is notoriously tricky because it requires the raw, unparsed HTTP request body. Show that you know how to configure your server to extract this.
Submit Your Work
Your submission is graded against the rubric on the right. If you pass, you get a public Badge URL you can share on LinkedIn. There is no draft save, so work offline first and paste your finished response here.