u/Interesting-One4331

▲ 9 r/nextjs

After integrating Stripe into multiple projects, here are the

errors I see (and make) every time:

**1. Parsing the body before Stripe reads it**

If you use `await req.json()` in your webhook route instead of

`await req.text()`, signature verification always fails.

Took me an embarrassing amount of time to figure this out.

**2. Missing userId in metadata**

When creating a Checkout Session, if you don't pass

`metadata: { userId: user.id }`, your webhook handler

has no way to know which user just paid.

**3. Not handling idempotency**

Stripe retries webhooks on non-200 responses. If your handler

crashes halfway, it fires again — and you update the DB twice.

Always check if the event was already processed.

**4. cancel_immediately instead of cancel_at_period_end**

Users hate losing access they already paid for.

Always default to cancel_at_period_end.

I wrote a full guide on this if anyone wants the complete setup.

DM me and I'll send it.

Happy to answer questions in the comments.

reddit.com
u/Interesting-One4331 — 19 days ago