#Elian Braja
1 messages · Page 1 of 1 (latest)
Stripe will always send the full subscription object, but if you check the previous_attributes hash, it will contain the previous versions of all items that were changed. So you can use that to see which ones you need to check in the current version of the object https://stripe.com/docs/api/events/object?lang=python#event_object-data-previous_attributes
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but to be sure that the payment was done should I trust to invoice.paid always?
Yes, invoice.paid is the event we recommend listening to for subscription payments.
invoice.paid, payment_intent.succeeded, invoice.payment_succeeded
but what is the difference between them?
Taking a step back: when you create a subscription for a customer, that subscription creates invoices which in turn create payment intents. The payment intent is the object that directly charges the customer and the invoice/subscription objects manage those payment intents
Here you will likely want to listen to the invoice.paid event
payment_intent.succeeded will trigger when the actual payment is made on the payment intent. It can be triggered for non-subscription payments and will have less subscription info on it, so it is typically best to listen for invoice.* events.
invoice.paid and invoice.payment_succeeded are very similar. They trigger for all the same things, the one exception is that invoice.paid will also trigger if you manually mark a payment as being paid "out of band" (outside of Stripe), so invoice.paid is typically the best event to listen to for invoice payments
I understand, so you your advise is to use invoice.paid even in the case the user subscribes for the first time and also when he updates the subscription?
to be sure that the payment was made
I am also trying to pay an invoice with an invalid card. I make the payment, it is declined but I receive an event "source.chargeable "
why not "payment_intent.payment_failed" or "invoice.payment_failed"
?
Yes, invoice.paid will trigger for all payments on a subscription. If you want to differentiate between the first payment and all subsequent ones, you can check the billing_reason on the invoice when you get the event https://stripe.com/docs/api/invoices/object?lang=python#invoice_object-billing_reason
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I am not immediately sure why you are getting that event here. Can you send me the id (evt_123 ) for the source.chargeable event you got when you tried this?