#basieboots_webhooks
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1231855218686164992
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Your webhook endpoint returned 404 , and the response body says Cannot POST /api/v1/stripe/webhook
Can you check you webhook endpoint and make sure it accepts POST requests to /api/v1/stripe/webhook ?
it can accept post requests to that route. If I switch to the unverified (for instance using just the req.body.type example instead of using the stripe signatures) I get a 200 response. That's why I'm pretty sure the issue is with the event = stripe.webhooks.constructEvent function especially since when I try to console log the event.type it doesn't happen
That's different from what I saw in event log. Or is there a different event ID that I should take a look at ?
here's the start of the webhook function:
exports.webhook = asyncHandler(async (req, res, next)=> {
console.log('Webhook started');
const sig = req.headers['stripe-signature'];
console.log(stripe signature: ${sig});
// console.log(req.body.type);
let event;
try {
console.log('constructing stripe webhook event');
console.log(req.body);
//Verify the stripe secret key and stripe webhook secret key as well as jwt
event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);
console.log(event type ${event.type});
} catch (err) {
res.status(400).send(Webhook Error: ${err.message});
return;
}
// // const event = req.body.type;
// const event = req.body;
// Handle the event
switch (event.type) {
the console.log up to the one before event = stripe.webhooks.constructEvent work, so my server is getting the post request
it's just not constructing your event
OK, did you sepcify the correct webhook secret? i.e., the one from your Dashboard, not the one from Stripe CLI.
so I just watched your youtube node starter and I'm pretty sure he used the cli one... but switching to the one from my dashboard didn't change anything at least from what I can see
I believe the video is about setting up a local webhook listener and that's why the local webhook secret is used.
Can you share with me the latest webhook event ID after the change?
I'm working on my local host right now
evt_3P8GsGKyc5KZ78km1uOyiHTK
I'm using flutter_stripe so it might be that one of the url's throughout might be pointing to my end client instead of my local host...
but is there any way to check if you received that event = stripe.webhooks.constructEvent request that I sent out?
Signature verification is impossible without access to the original signed material.
Learn more about webhook signing and explore webhook integration examples for various frameworks at https://github.com/stripe/stripe-node#webhook-signing
I have to go and I'll be back in 30 minutes
This is the response from your local webhook endpoint.
ok I can throw in the body parser thing and try that
is there somewhere I can see that response?
https://dashboard.stripe.com/test/events/evt_3P8GsGKyc5KZ78km1uOyiHTK you can see from Dashboard
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I don't see that error message anywhere.... I'm new to using the dashboard so
You need to expand it
oh I found it
I expanded everything else but that ๐
thanks the biggest thing is to find where I can find the error messages ๐
have a great day! I should be able to work this out from here I think
thanks!