hooks.py 483 B

1234567891011
  1. from djstripe import webhooks
  2. @webhooks.handler("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)