Utilities¶
Last Updated 2018-05-24
Subscriber Has Active Subscription Check¶
-
utils.
subscriber_has_active_subscription
(plan=None)¶ Helper function to check if a subscriber has an active subscription.
Throws improperlyConfigured if the subscriber is an instance of AUTH_USER_MODEL and get_user_model().is_anonymous == True.
- Activate subscription rules (or):
- customer has active subscription
- If the subscriber is an instance of AUTH_USER_MODEL, active subscription rules (or):
- customer has active subscription
- user.is_superuser
- user.is_staff
Parameters: - subscriber (dj-stripe subscriber) – The subscriber for which to check for an active subscription.
- plan (Plan or string (plan ID)) – The plan for which to check for an active subscription. If plan is None and there exists only one subscription, this method will check if that subscription is active. Calling this method with no plan and multiple subscriptions will throw an exception.
Supported Currency Choice Generator¶
-
utils.
get_supported_currency_choices
()¶ Pull a stripe account’s supported currencies and returns a choices tuple of those supported currencies.
Parameters: api_key (str) – The api key associated with the account from which to pull data.