#itaied
1 messages · Page 1 of 1 (latest)
Do you have an example subscription ID that you are looking at here? (sub_123)
The one field I can think of is the cancel_at timestamp on the subscription itself. That will tell you when the subscription is set to be cancelled
evt_1MK1NRBFEp1HvtXURJQWoiWO
Ah, when you say "expiration" do you mean the next time the subscription will try to renew?
yes
"period": {
"end": 1674919026,
"start": 1672240626
},
easier way to access this data
So those are different because the period on the invoice is for when the invoice was billed for. The line item's period is for the billing cycle on the subscription (not quite sure why we show the next subscription period there but that looks like it is what we are doing).
current_period_end on the subscription itself would also be a way to check though that should be the same as object.lines.data[0].period.end on the invoice
So I guess the best way is to listen to invoice.paid then query the subscription and read the current_period_end.
What do you think?
Yeah checking that will be the most straightforward way to get the next renewal date
great thanks
one more thing though
following this docs
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=checkout#provision-and-monitor
it says The minimum event types to monitor:
why should i listen to checkout.session.completed if I'm listening to invoice.paid?
You don't necessarily need to. If you are listening to invoice.paid that should be completely sufficient to react to subscription payments. You can even tell if it is the first payment by checking billing_reason.
Some people like to break their logic out in to different events here but you definitely don't need to listen to checkout.session.completed if you are already handling things sufficiently in invoice.paid