dj-stripe 3.0.0 (unreleased)
Breaking Changes
-
The
SourceandSourceTransactionmodels have been removed. The Stripe Sources API was deprecated in favour of the PaymentMethods API, andSourcewas deprecated in dj-stripe 2.11.0. Use thePaymentMethodmodel instead. This also removes theCustomer.sourcesrelation and theCustomer.customer_payment_methodsproperty; useCustomer.payment_methods(the reverse relation ofPaymentMethod.customer) instead. A database migration drops thedjstripe_sourceanddjstripe_sourcetransactiontables. -
The
DJSTRIPE_WEBHOOK_EVENT_CALLBACKsetting has been removed. It was deprecated in 2.8.0 in favour of the webhook signals. If you used it to take control of webhook processing, connect to the relevant signal instead:djstripe.signals.webhook_pre_validatedjstripe.signals.webhook_post_validatedjstripe.signals.webhook_pre_processdjstripe.signals.webhook_post_processdjstripe.signals.webhook_processing_error
-
Removed subscription helpers that applied conflicting definitions of "active", "current", and "valid":
Customer.subscriptionCustomer.active_subscriptionsCustomer.valid_subscriptionsCustomer.has_any_active_subscription()Customer.is_subscribed_to()Subscription.is_status_current()Subscription.is_status_temporarily_current()Subscription.is_valid()MultipleSubscriptionException
Applications must now define their own access policy by composing explicit filters on
Subscription.objectsorcustomer.subscriptions. The newwith_status(),period_current(),scheduled_for_cancellation(), andfor_product()queryset filters can be combined with the existing status filters. For example:from djstripe.enums import SubscriptionStatus SERVICE_STATUSES = { SubscriptionStatus.trialing, SubscriptionStatus.active, SubscriptionStatus.past_due, } service_subscriptions = ( customer.subscriptions.with_status(*SERVICE_STATUSES).period_current() ) has_access = service_subscriptions.exists()Subscription.is_period_current()remains available for individual subscriptions, andSubscription.is_scheduled_for_cancellation()replaces the ambiguously namedis_status_temporarily_current(). This leaves choices such as whether apast_due,paused, orunpaidsubscription grants service to the application rather than dj-stripe.SubscriptionMixinnow adds asubscriptionsqueryset to the template context instead of the policy-dependent singularsubscription(#490).
Bug Fixes
Price.create()now passesunit_amountto Stripe unchanged, using Stripe's minor currency units instead of incorrectly multiplying the value by 100 (#1941).