#gopi_67606

1 messages · Page 1 of 1 (latest)

glass mothBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

orchid fern
#

Hi there!

#

How can I help?

viscid lance
#

evt_1OEomPD6fLV2vwHgrsR2yheO

#

why that event is getting failed

#

And also I am wondering how I need to trigger the web hook from the front end

#

I am unable to trigger that web hook from the front end

orchid fern
#

This means that Stripe sent your server the event, but your server responded with a 405 error.

#

So you need to check your server logs to understand the issue, and then fix it on your end

viscid lance
#

Why ?

#

I am not using any code regarding web hooks in the server

#

app.post('/webhook', (req, res) => {
console.log("In line 13")
const sig = req.headers['stripe-signature'];

let event;
console.log("event",event)
try {
event = stripe.webhooks.constructEvent(req.rawBody, sig, environment.stripeSecretKey);
} catch (err) {
console.error('Webhook Error:', err.message);
return res.status(400).send(Webhook Error: ${err.message});
}
console.log("Event",event)
// Handle the event
switch (event.type) {
case 'payment_intent.succeeded':
const paymentIntent = event.data.object;
// Handle successful payment
break;
// Add more cases for other events as needed

default:
  console.log(`Unhandled event type: ${event.type}`);

}

res.status(200).end();
});

orchid fern
#

There's some issue in your server configuration

viscid lance
#

The above code I have written for the web hooks i am testing in my local but its not triggering

#

3307

#

Server is running on the above port

orchid fern
#

Like I said: you need to check your server logs to understand the issue, and then fix it on your end.