#satyanshy
1 messages · Page 1 of 1 (latest)
The event Im looking at is the payment success one
I'm trying to parse the payload to get the Event, but my request body isn't giving me a payload
Hi, can you share event id? What is the specific issue?
payment_intent.succeeded
Can you share the request id with me and share each steps for me to better understand what the issue might be?
yes sure. Would it be possible to hop on call?
this is my request id - "id": "evt_3M6sLXL9zQ6YKhaM1ma62ifQ",
So I have a webhook that runs on payment intent success to my backend server. I try to parse the post request and see that I need the body, headers, and a secret key to view the event
What is the payload argument of the constructEvent supposed to be?
On discord, there is not a call functionality. What are you looking to attain fro the event specifically?
the meta data
"message": "No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node#webhook-signing",
"name": "Error",
"type": "StripeSignatureVerificationError",
this is the error im getting
Can you confirm that you're using the correct secret webhook key?
If you've confirmed that you've used the right secret, then the issue might be on the payload's content which likely is the issue here. Sometimes some languages will tamper with the raw payload and if it's not identical to what Stripe sent you, the signature won't be a match.
Can you verify what the arguments should be exactly
should they all be strings?
payload, stripe signature, and the key?
Hi there 👋 taking over for @spice viper
I wouldn't recommend posting payload signatures to this channel
If you want to know what the signature is comprised of, I would read this section of the docs about verifying the signature manuall: https://stripe.com/docs/webhooks/signatures#verify-manually
so what should i do if the language is tampering with the raw payload?
how can i get the event?
and the associated metadata?
Ah, apologies, I sent you the wrong docs. Those are for manual programmatic verification.
Do you know how to get the raw body of the HTTP request Stripe is sending for your webhook?
I do not
It looks like you're at least able to get it as JSON based on the message I'm about to delete (due to having a raw signature in it as plaintext), so that's a step in the right direction
What language are you using in your webhook handler?
javascript
Try something like this in your webhook handler:
app.post('/webhook', express.raw({type: 'application/json'}), (req, res) => { const sig = req.headers['stripe-signature']; console.log(sig);
so im using mongo as my backend server
and i have an endpoint set up there
is the req.headers[stripe-signature] just meant to be the string "t0=...,v0=...,v1=..."
Yep
ok so I know that is right for sure
How about for the req.body ?
is it suppose to be an object?
can i send my output for req.body in chat?
So the signature is the issue here, correct? The error we're troubleshooting is related to the signatures not matching, yes?
yes
So when you add express.raw({type: 'application/json'}) to the webhook handler and initiate a test payment, do you still get the same error?
I dont think i have the option to use express on mongo
Ah, okay. So you'll need to find a way to get the raw request data (unmodified) directly from the HTTP request that Stripe is sending. I'm not sure what you mean by "im using mongo as my backend server", as that could mean a myriad of things, but the main issue is that somewhere your integration is attempting to check the signature that Stripe is sending and they're not matching, which usually means some technology/framework you're using is modifying the raw payload before the check happens
is there a way to know what the format is so that I could reformat the request correctly?
I think the only thing unformatted is the payload argument. What is the payload argument meant to look like?
It should look like this I believe: https://stripe.com/docs/webhooks/signatures#prepare-payload