#dantheman
1 messages ยท Page 1 of 1 (latest)
that event only fires for the first payment on a subscription. For each subsequent payment you should listen for the invoice.paid event
Yes. Each Subscription will have an Invoice which must be paid for the subscription to remain active
whats the difference between invoice.paid and invoice.payment_succeeded?
invoice.payment_succeeded could fire for partial payments and also wouldn't capture any out-of-band payments. invoice.paid will fire if the invoice is paid in full
ok and how would i link the invoice to the subscription?
oh is there a subscription in the object?
Yup! Invoices have a subscription attribute: https://stripe.com/docs/api/invoices/object#invoice_object-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and if im using checkouts how would i get some kind of id from the invoice to the session
You would have to get the Invoice ID from the Checkout Session by listening to checkout.session.completed : https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
perfect, thanks you so much!
Of course!
wait would the
checkout.session.completed be triggered before the invoice.paid?
cause i saw somewhere that its never guarenteed
The ordering is never guaranteed, that's correct
thats gunna be difficult
You could always build in a sleep statement to the checkout.session.completed webhook handler in order to guarantee that your system actions invoice.paid first. That's one idea for simplifying, but obvs it may not work for your use-case
that seems kinda rough i will see what i can do
Yeah, it's not ideal as a the long-term solution. Anyway, best of luck! Let us know if we can help some more
๐ appreciate it