app.utilities.stripe_event_handler
Stripe webhook event handler for the Mail List Shield application.
This module processes incoming Stripe webhook events for subscription management and credit purchases.
Functions
|
Check if a Stripe event is subscription-related. |
|
Check if a Stripe event is a completed checkout. |
|
Look up a user by their Stripe customer ID. |
|
Look up a subscription tier by its Stripe price ID. |
|
Process a Stripe webhook event. |
Module Contents
- app.utilities.stripe_event_handler.is_subscription_event(event)[source]
Check if a Stripe event is subscription-related.
- Parameters:
event – The Stripe event object.
- Returns:
True if the event type starts with ‘customer.subscription’.
- Return type:
bool
- app.utilities.stripe_event_handler.is_checkout_completed_event(event)[source]
Check if a Stripe event is a completed checkout.
- Parameters:
event – The Stripe event object.
- Returns:
True if the event type is ‘checkout.session.completed’.
- Return type:
bool
- app.utilities.stripe_event_handler.user_from_stripe_customer_id(customer_id)[source]
Look up a user by their Stripe customer ID.
- Parameters:
customer_id – The Stripe customer ID.
- Returns:
The matching user object.
- Return type:
- Raises:
Exception – If no user is found with the given customer ID.