#sb
1 messages · Page 1 of 1 (latest)
Yep, a great use case for webhooks
For synchronous payment methods you can check the payment_status when the session is completed:
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-payment_status
but note that you also need webhook to handle async payment methods that might fail later:
https://stripe.com/docs/payments/checkout/fulfill-orders#delayed-notification
okay, interesting it says unpaid for all in the above code
which is strange because it's an await request
also the response doesn't include the customers email
i.e. so the idea would be
const session = await stripe.checkout.sessions.create({
line_items,
mode: 'payment',
success_url: `${YOUR_DOMAIN}`,
cancel_url: `${YOUR_DOMAIN}/register`,
}).then((s) => {
console.log(s);
res.status(200).send(s.url);
HERE
sendinvoiceemail(data, s.customer_email);
})
Can you share specific events you are looking at so we can discuss concrete examples?
I think I understand the webhook part, the documentation is good.
checkout.session.async_payment_succeeded
``` would be the webhook event I use when I want to use for emailing a customer their invoice right?
For async payment methods that's the signal for payment success