#tounka

1 messages · Page 1 of 1 (latest)

ocean tartanBOT
dusk shadow
#

You can't completely rely on the checkout.session.completed event if you accept payment from payment method types that complete async (so it could be a couple of days until the payment is considered successful)

undone ember
#

i don't plan on accepted deferred payment options like ACH etc

dusk shadow
#

And if you're working with subscriptions (where you n eed to continually provision access) checkout.session.completed won't be helpful because it's only triggered for the first payment

undone ember
#

got you. in the case of a subscription being generated for the first time, since i'm listening to both events i end up provisioning access twice

#

Can i just solely rely on invoice.paid event to provision access?

dusk shadow
#

Yes, the invoice.paid event should be enough 👍

undone ember
#

is there any reason why the docs recommend using checkout.session.completed to initially provision access and then using invoice_paid to continuously provision access? especially since i get both events on the first payment

#

is one event guaranteed to happen before the other?

dusk shadow
#

It really depends on what your integration looks like

#

For some users who are using checkout for more than just Subscriptions, it may make more sense to listen for checkout.session.completed to handle the one-off payments as well

undone ember
#

hmm can you give me some examples?

#

as of now, i only use checkouts to provision subscriptions

dusk shadow
#

If you're just using Checkout with Subscriptions then it doesn't really apply to you - but we also allow you to use Checkout with mode: payment . People who do that would want to listen for the checkout.session.completed event and see if it was for a one-off payment or a subscription

#

But again, if you're just looking for an event to provision subscription access the invoice.paid event is what you want

undone ember
#

what is mode:payment for?

dusk shadow
#

That's for one-off payments (not recurring)

undone ember
#

ahh got you. okay thanks. so sounds like i should just listen for invoice.paid events and that'll allow me to provision access when the checkout session is completed and recurring payments

#

If i were to able offer one-off payments, would i still receive invoice.paid events?

dusk shadow
undone ember
#

thank you