#rhythmbhiwani-subscription-events
1 messages · Page 1 of 1 (latest)
rhythmbhiwani-subscription-events
Hi there 👋 the events you're going to want to listen to are largely going to depend on the logic that you want to build.
Can you give an example of what you're hoping to achieve?
it's a SaaS application, which has 3 plans, with monthly and yearly pricing options. I just want to give the services to user according to plan he selects and is subscribed. Once he stops his subscription, I'll downgrade him to free services only
currently I'm checking these events
customer.subscription.created
customer.subscription.deleted
customer.subscription.updated
customer.subscription.trial_will_end
I want to reset his limits, on each new billing cycle if he continue the subscription
Those are good events to listen to for the subscription lifecycle. What do you mean by "reset their limits"?
limits are according to my application logic, which I can update in my database on each new billing cycle
Are these events enough or I need some more according to production setup
and customer.subscription.updated is a bit confusing as it does not specify if a user has cancelled to continue the subscription, but will cancel at end of billing cycle
how can I check that
Within the data field of update events (such as customer.subscription.updated) there is a hash called previous_attributes that lists which parameters were changed:
https://stripe.com/docs/api/events/object?l#event_object-data-previous_attributes
You can then compare those to the new values in data.object to determine exactly what changed.
this sounds good, let me check it out. Thanks for you help