#jtishler - webhooks
1 messages · Page 1 of 1 (latest)
Hi 👋
Okay so you want to only record the first payment on a subscription in your DB? Do I have that correct?
I want to record a new subscription in my DB when it is successfully paid for and/or successfully set up for a future payment for when the trial is over
The and/or bit is likely where your integration will have to figure out what to do.
The invoice.paid event is a good one to listen to
Since each Invoice will have a billing_reason property: https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
If it's the first paid invoice of a new subscription this will be subscription_create
However, this may show up on the $0 invoice that is created when subscriptions start with a free trial period
So I would like to treat those cases the same. So if it is always subscription_create for a new subscription whether there is a free trial or not that works
Okay. In that case I would test it out first but I'm pretty certain that event and invoice property will work for you
Does that event get sent immediately when payment succeeds? There's some stuff about invoices not getting finalized and not attempting payment for an hour in the documentation. I'm trying to use this webhook event to update a customer's entitlement in real time when they make the purchase
Yes an invoice will remain open so you can make any last minute changes for 1 hour for automatically generated invoices. This is not the case if you are taking the initial payment on-session
Ah gotcha thank you!