#hard_webhooks
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1270686885177462794
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
What does 'not work' mean exactly? Can you share an example ID (pi_xxx) that 'doesn't work'?
Ya sure
I just want to use stripe as payment gateway for my e-commerce website
I have do config as require by stripe documentation and it working perfect but on my server it give me error
As asked, you're going to need to share an example of this error
The req_xxx ID that errors would be great
Ok let me check and share
StripeSignatureVerificationError: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
If a webhook request is being forwarded by a third-party tool, ensure that the exact request body, including JSON formatting and new line style, is preserved
This is the error I am getting
I don't know where I can find my error req_xxx ID
OK, this is related to webhooks. Sorry that was unclear
Where is STRIPE_ENDPOINT_SECRET from? Is it from your live webhook and not the test one
If you're 100% certain of that, then the issue is likely due to your endpoint/code malforming the req.body. constructEvent expects the raw body, as per the error. The console.log will malform it
Did this code work locally?
Yes it's working perfect locally
I also read this git issue and try with this
https://github.com/stripe/stripe-node/issues/1254
If I had to guess I bet it's becasue of the global app.use(express.json()) middleware
That will parse the request bodys to all endpoints and will break constructEvent
Which is why I asked if this worked locally
Yes it's working perfectly
And I think it may not cause issue because we use stripe API end point or webhook before passing expesss.json globally.
No, that's not how Express middleware works: https://expressjs.com/en/guide/using-middleware.html#middleware.application
Can you try removing those app.use() middlewares?
Or implement them on other routes specifically
can I do like this?
And if that is the issue then maybe should not work locally right?
Yeah maybe, who knows. But this is a common problem in Express setups that implement middleware like this
Otherwise, my guess is that your whsec_xxx is wrong, can you the last 8 characters from it here and I'll check
Can you share your acct_xxx ID? Or the we_xxx endpoint ID?
we_xxx end point is this we_1PaybuAxsxxxxxxxxxxCAHX
Looking
Yeah that is wrong. It should look like whsec_xxxx
You can find it here: https://dashboard.stripe.com/webhooks/we_1PaybuAxs2R36ykuMyXmCAHX
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Ohh let me check
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!