#Yharoo
1 messages · Page 1 of 1 (latest)
Hi there!
Hey!
I'm not sure I follow your question.
case 'payment_intent.created':
const paymentIntentCreated = event.data.object;
console.log(
`PaymentIntent for ${paymentIntentCreated} was successful!`
);
// Then define and call a method to handle the successful payment intent.
// handlePaymentIntentSucceeded(paymentIntent);
break;
case 'charge.succeeded':
const charge = event.data.object;
let { userId, userCart, total, guest } = charge.metadata;
if (!guest) {
if (typeof total !== 'number') {
total = JSON.parse(total);
}
if (typeof userCart === 'string') {
userCart = JSON.parse(userCart);
}
console.log(`Charge for ${charge} was successful!`);
placeOrder(userId, userCart, total);
}
break;
}
res.status(200).end();```
I want to catch the response in the frontend
but i only made a fetch request for the payment intent
That doesn't really make sense. Webhook events are asynchronous, so you can't really send the response of a webhook event to your frontend. What is your end goal exactly?
Ohhhh....
Because I change something in my database using webhook, and I want to do something in the frontend after that happens
Can you give more details on what exactly you want to do? There might be some other options.