#meldin6167
1 messages · Page 1 of 1 (latest)
It's a common issue, but basically that's the Signature error when you don't pass in the exact request body
Try downloading our example code and run directly
This is the error from stripe logs: Webhook Error No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
In local host its fine
but in production doesn't work
Have you setup the webhook secret in product? in environment variable?
What is your local framework and production framework?
I am using Nextjs
in dev mode I have stripe webhook secret which I got from running stripe listen --forward-to localhost:3000/api/webhook
But in production mode I setup webhook on stripe dashboard where I took the webhook key and paste it to the vercel as an env var
Okie, and if you print out, you do see the correct secret value?
Localy yes. And the checkout.session.completed works good when I run the app localy
No I mean the production mode
if you print out the secret value you get from environment variable
I didnt try to print it out in production mode
please log it and check. The other bit you'd want to check is to try printing the request header, to check what is the exact name for the Stripe Signature header in the request
we've seen some differences with the Stripe Signature header name for Next.js with other users
Finalyyyy 🙂 I got it
I had to add trim() for signature and for stripe webhook secret to make sure to get rid of white spaces
alright, great that you've managed to figure things out!