Stripe webhook error

Next 12: I've followed Next official guide for integrating stripe into my published site on vercel, and was able to make a purchase, but I fail using a webhook after a successful payment. On the Stripe dashboard, I see this error: "Webhook Error: No signatures found matching the expected signature for payload." My code for my api endpoint for that webhook is taken from the guide: https://github.com/vercel/next.js/blob/canary/examples/with-stripe-typescript/pages/api/webhooks/index.ts
GitHub
next.js/index.ts at canary · vercel/next.js
The React Framework. Contribute to vercel/next.js development by creating an account on GitHub.
3 Replies
whatplan
whatplan16mo ago
https://blog.nickramkissoon.com/posts/integrate-stripe-t3 just throwing this here, Im implementing stripe into my site soon and have had this bookmarked might be helpful might not
Developer Blog | Nicholas Ramkissoon
Integrate Stripe Into Your Type-safe T3 Next.js App
Integrate Stripe with a create-t3-app bootstrapped Next.js project to unlock powerful type-safety when handling payments.
JJ Rise
JJ Rise16mo ago
I just got done doing this yesterday and it's working for me. Are you saving the webhook secret in your environmental variables? const webhookSecret: string = process.env.STRIPE_WEBHOOK_SECRET! that error is basically saying you aren't passing the try block for stripe.webhooks.constructEvent https://gist.github.com/jjrise/7d9167c22e3353f76f673d444ad17207
Gist
handling stripe webhook
handling stripe webhook. GitHub Gist: instantly share code, notes, and snippets.
JJ Rise
JJ Rise16mo ago
here is what mine looks like also, I'm not sure how much it matters, but the api version in that gist you sent is a lot older