I allow free 30-day trials for my subscriptions which is managed by cancel_at_period_end
flag set to true
. I also have a webhook listening for customer.subscription.deleted
event. In this hook I need the way to know that subscription was deleted by stripe after 30-days trial? How can I do that without storing extra information in my DB. I assume when it gets deleted the next is correct eventObject.ended_at === eventObject.trial_end
? Is it really safe to use?
Yes, you can use eventObject.ended_at === eventObject.trial_end
to check whether a subscription ended/was cancelled at the end of the subscriptions trial.