#sb

1 messages · Page 1 of 1 (latest)

sudden spindleBOT
candid delta
#

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

Learn how to fulfill orders after a customer pays with Stripe Checkout or Stripe Payment Links.

solid void
#

okay, interesting it says unpaid for all in the above code

#

which is strange because it's an await request

sudden spindleBOT
solid void
#

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);
    }) 
candid delta
#

Can you share specific events you are looking at so we can discuss concrete examples?

solid void
#

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?
candid delta
#

For async payment methods that's the signal for payment success

solid void
#

although I note

checkout.session.completed
Occurs when a Checkout Session has been successfully completed.

"completed" refers to successful payment or?

#

the session has returned I guess is probably it