#meldin6167

1 messages · Page 1 of 1 (latest)

steep depotBOT
meager skiff
#

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

vocal basin
#

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

meager skiff
#

Have you setup the webhook secret in product? in environment variable?

#

What is your local framework and production framework?

steep depotBOT
vocal basin
#

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

meager skiff
#

Okie, and if you print out, you do see the correct secret value?

vocal basin
#

Localy yes. And the checkout.session.completed works good when I run the app localy

meager skiff
#

No I mean the production mode

#

if you print out the secret value you get from environment variable

vocal basin
#

I didnt try to print it out in production mode

thorn forge
#

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

vocal basin
#

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

thorn forge
#

alright, great that you've managed to figure things out!