hooks.py 508 B

12345678910
  1. from djstripe.event_handlers import djstripe_receiver
  2. djstripe_receiver(["customer.subscription.updated", "customer.subscription.created"])
  3. def update_subscription(event, **kwargs):
  4. """When the subscription is updated, immediately check for throttle adjustments"""
  5. # Avoid importing models during django app startup
  6. from apps.organizations_ext.tasks import check_organization_throttle
  7. if event.customer.subscriber_id:
  8. check_organization_throttle.delay(event.customer.subscriber_id)