#warre002

1 messages · Page 1 of 1 (latest)

limpid lodgeBOT
gentle wolf
#

Hi there! It's pretty uncommon to verify webhook signatures manually.

uncut jungle
#

Yes, it is with the Stripe SDK?

#

This is the error it returned: StripeSignatureVerificationError: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?

#

The route function starts like this: router.post('', express.raw({type: 'application/json'}), (request, response) => {

and in the main file I've this: app.use((req, res, next) => { if (req.originalUrl === '/webhooks') { next(); } else { express.json()(req, res, next); } });

#

So based on forum questions and documentation I've read this should work but it doesn't for some reason

gentle wolf
#

ah, sorry about missing that!

uncut jungle
#

No worries

gentle wolf
#

Looking at this line:
event = stripe.webhooks.constructEvent(request.rawBody, sig, endpointSecret)
Do you still receive an error if you change this to:
event = stripe.webhooks.constructEvent(request.body, sig, endpointSecret) ?

#

Also, I assume the value for endpointSecret matches the signing secret for this endpoint, as it's displayed in the Stripe Dashboard (Developers > Webhooks)?

uncut jungle
#

ugh, thank you. a week of problems fixed in 2 minutes haha

gentle wolf
#

Glad to hear it's fixed!