#All3nn1ck
1 messages ยท Page 1 of 1 (latest)
Hello ๐
You may see this error for variety of reasons
1/ If your webhook endpoint secret is incorrect
2/ As the error suggests, you may not be passing in raw data to the constructEvent function
Where do I see the correct endpoint secret?
Is it in my dashboard under the voice "sign secret"?
Or is it the "API keys" section?
You'd find it on the page of your webhook endpoint details
https://dashboard.stripe.com/test/webhooks
Gotcha. Next step is to verify if your server parses the event body before it reaches the webhook code
This is the endpoint ```
app.post('/stripe/checkout/webhook',
express.raw({ type: 'application/json' }),
handleStripeEvents
)
handleStripeEvents is a function created by me
ah, can you change
express.raw({ type: 'application/json' })
to express.raw({ type: '*/*' }) ?
Sure
Give me five minutes. Everytime I change something to this endpoint I need to deploy it because I can't test it locally
Sure, np!
I had a question while I wait
I know that when a user creates a checkout a checkout events gets fired, what happens when a user closes the checkout page without finish the payment?
Is there any event that is immediatly fired?
Or I have to wait for the checkout.expire even?
event?*
We don't fire an event when the customer closes the checkout page as such so yeah you'd want to wait/listen for expiration event
NP! ๐ Take your time
can you print out the parameter your handleStripeEvents function receives?
It should be a buffer. If you see JSON that means something prior to this route is parsing the data already
yup that's the issue.
Seems like your server parses the raw data already
Yup I'd recommend giving it a try
I'd also recommend specifying something like
app.use('/stripe-events', express.raw({type: "*/*"})) to make sure no payload is parsed for that route
Awesome! Glad I could help