#hard_webhooks

1 messages ยท Page 1 of 1 (latest)

lavish gustBOT
#

๐Ÿ‘‹ 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.

forest vector
#

What does 'not work' mean exactly? Can you share an example ID (pi_xxx) that 'doesn't work'?

gentle stump
#

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

forest vector
#

As asked, you're going to need to share an example of this error

#

The req_xxx ID that errors would be great

gentle stump
#

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

forest vector
#

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

gentle stump
#

Yes it's from live webhook

#

This one

forest vector
#

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?

gentle stump
#

Yes it's working perfect locally

forest vector
#

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

gentle stump
#

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.

forest vector
#

Can you try removing those app.use() middlewares?

#

Or implement them on other routes specifically

gentle stump
#

can I do like this?

#

And if that is the issue then maybe should not work locally right?

forest vector
#

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

gentle stump
#

ok sure

#

I have like this we_1PaybuAxsxxxxxxxxxxCAHX

forest vector
#

Can you share your acct_xxx ID? Or the we_xxx endpoint ID?

gentle stump
#

we_xxx end point is this we_1PaybuAxsxxxxxxxxxxCAHX

forest vector
#

I need the full ID so I can look it up internally

#

It's safe to share

gentle stump
#

Ok sure

#

we_1PaybuAxs2R36ykuMyXmCAHX

forest vector
#

Looking

forest vector
gentle stump
#

Ohh let me check

lavish gustBOT
south trench
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

gentle stump
#

Hello

#

I am done with the issue
Thank you for help