2

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?

Community
  • 1
  • 1
Ben
  • 3,972
  • 8
  • 43
  • 82

1 Answers1

1

The event you want to listen for is (probably) customer.subscription.deleted, but you can read more about it all here.

floatingLomas
  • 8,553
  • 2
  • 21
  • 27
  • But is not this event fired only if the subscription is canceled? What I want is an event when the user doesn't pay the renewal each month. – Ben Nov 22 '16 at 22:05
  • It depends on your configuration. There are more details about it in the document I linked (in 'here'). – floatingLomas Nov 23 '16 at 00:26
  • Same situation here with you Ben. Config is about failed attempts – arjayads Apr 28 '17 at 12:00