#ELIZZER

1 messages · Page 1 of 1 (latest)

lofty kernelBOT
hollow berry
#

👋 Hi there, Happy to help!
Could you please provide more details about this ?

hazy nebula
#

i was trying to implement webhook signature check and this happend

hollow berry
#

Could you please share the part of the code that is throwing this ? this looks like nodejs ?

hazy nebula
#

sry, that was a dumb mistake

#
 const sig = req.headers['stripe-signature']
    const endpointsecret='whsec_63d6696d8e652a61500a19d9a576f847cf02655d2d242f5eb6ca9c2596914844'
    let type;
    try{
        type=stripe.webhooks.constructEvent(req.body,sig,endpointsecret)
    }catch(e){
        console.log('[+]Error in received webhook ',e)
        res.status(500)
        res.send("not a valid request")
    }
#

now i am getting this error

hollow berry
#

Are. you parsing the body of the request, it looks like you have a middelware that is parsing/changing the raw body request

#

Try first running the sample project I shared with you in order to understand the webhook signature first

hazy nebula
#

could this be the problem?

hollow berry
#

yes

hazy nebula
#

yeah no its fine, thankyou

#

and do you recommend any best practices to handle stripe errors across my application

hollow berry