Decorators

Event Handling Decorators

More documentation coming on these soon. For now, see our implementations in djstripe.event_handlers

Specific Event(s) Handler

djstripe.webhooks.handler(*event_types)

Decorator that registers a function as a webhook handler.

Functions can be registered for event types (e.g. 'customer') or fully qualified event sub-types (e.g. 'customer.subscription.deleted').

If an event type is specified, the handler will receive callbacks for ALL webhook events of that type. For example, if 'customer' is specified, the handler will receive events for 'customer.subscription.created', 'customer.subscription.updated', etc.

:param event_types: The event type(s) that should be handled. :type event_types: str.

All Events Handler

djstripe.webhooks.handler_all(func=None)

Decorator that registers a function as a webhook handler for ALL webhook events.

Handles all webhooks regardless of event type or sub-type.