#aldale
1 messages ยท Page 1 of 1 (latest)
Hey there, first thing to do is verify your constructEvent args all have values as expected: req.body, sig, webhookSecret
everything i try i get no intent payment sucessful log or i get the error mentioned in the first post
Let's focus on one error at a time
But if you get past the verification step, it sounds like something else is failing
i added loggins, i get in te console Raw Body: undefined Webhook signature verification failed. No webhook payload was provided.
Where did you add that?
But it seem like the req.body is empty for some reason? Can you share the logging you added?
console.log('Raw Body:', req.rawBody);
console.log('Received Signature:', sig);
console.log('Webhook Secret:', webhookSecret);
console.log('Raw Body:', req.rawBody);
Are you populatedrawBodysomewhere first? What made you use that?
I don't see this being set in your code anywhere
no, only in stripewebhook.js
Raw Body: undefined
Received Signature: t=1697055297,v1=d59389a86cf62103c5e3976fc10e0b717edbb915d3fdae334a2c538195e65b3b,v0=530ea2f3a845f6a0b04f194757856c3f43c275e3d5b0c487107dceda82f6cff1
Webhook Secret: whsec_EDITED_NOT_REAL_sECRET_X5LOpUna0NUcIV6W55oMAoG8
Webhook signature verification failed. No webhook payload was provided.
That seems expected if req.rawBody is undefined
If you use req.body what happens?
If that has a value but cannot be verified, then it suggest this might be getting mutated higher up in your stack
Is there a higher level express app initialization?
rawBody isn't available unless you set it somewhere. We show doing this in an example here to preserve the original body before json data gets parsed:
https://github.com/stripe-samples/checkout-one-time-payments/blob/main/server/node/server.js#L22-L32
i made the change to reflect the last snippet you showed me, but i still get raw body: undefined
starting at line 22
Looks like the line above is already parsing the json
app.use(express.json());
You can probably comment that out with the new addition
Or you might need to move it before that
You should add logging to verify that function is running to set rawBody
i commented out the line you told me earlier and it work now, you can close the chat, thanks synthrider