Reputation: 4110
I'm setting up Stripe on my django rest application to manage monthly subscriptions.
In Stripe doc, we can read:
https://stripe.com/docs/subscriptions/tutorial#sync-with-your-site
If a customer was subscribed to a monthly plan, you would initially set this timestamp value (i.e., active_until) to one month from now. When the customer logs in, you’d verify the login credentials and check the active_until timestamp to confirm that it’s still in the future, and therefore an active account.
According to that, to know if a user account is valid (if the subscription is active), we have to check if this date is future. My problem is that in my application, if the user subscribe to the Stripe plan, it will add a specific group (django group model) to the list of the user's groups. The groups are used to manage the permissions. What I want is to remove the group from the user when the subscription ends (i.e the user has not paid the renewal).
I can't find such a event in the Stripe doc. There are only events when the subscription is updated (i.e the user has paid the renewal).
Is there a way to catch an event from Stripe which can help me to manage this workflow?
Upvotes: 2
Views: 571
Reputation: 8727
The event you want to listen for is (probably) customer.subscription.deleted
, but you can read more about it all here.
Upvotes: 1