#geimsdin
1 messages · Page 1 of 1 (latest)
hello! this may be useful : https://stripe.com/docs/billing/subscriptions/webhooks#events
Hi Alex, I can only rely on the event "customer.subscription.deleted"? My automation is now configured to be triggered on invoice.paid and I would like to not rewrite all the code but just adding maybe an API call to get that info, do you have any suggestion?
relying on the customer.subscription.deleted event is really the easiest way
the only other way i can think of is if you don't receive an invoice.paid subscription at a expected period
if you want to know the specific phase the subscription schedule is at - you can probably rely on subscription_schedule.updated - and look at the current_phase : https://stripe.com/docs/api/subscription_schedules/object#subscription_schedule_object-current_phase
if you're looking to know when the last phase of the subscription schedule is completed, you can listen for subscription_schedule.completed
https://stripe.com/docs/billing/subscriptions/subscription-schedules#completing-schedule
https://stripe.com/docs/api/events/types#event_types-subscription_schedule.completed
I try to give you more details
I noticed that if I manually resend the invoice paid event, my webhook will store a new payment locally on that subscription even if it is the same payment as before.
Then I need to understand if I did already collected (locally) that payment or not
Is the invoice id different for every phase? Can I rely on that?
First idea was to store the phase number and overwrite in case it is the same as one already stored for that subscription
i'm not sure i understand the question here, are you attempting to prevent saving duplicate invoices? If so, you should just refer to the invoice id : https://stripe.com/docs/api/invoices/object#invoice_object-id. If you already have that id in that DB, and the invoice is paid, then you don't need to save it again
ok, just to be sure, every phase has a different invoide_id, the invoice_id is not tied to the subscription itself
correct?
every time payment is collected, the invoice id is different. It's neither tied to the phase, nor is it tied to the subscription.