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).
stripe-python 16 and 17
dj-stripe now supports stripe-python 15.0.1 up to (but not including) 18, so you can upgrade to the latest SDK (17.1 at the time of writing). The test suite passes against every major release in that range.
dj-stripe always sends its own STRIPE_API_VERSION (by default
DEFAULT_STRIPE_API_VERSION, currently 2026-07-29.dahlia) with its requests.
The API version stripe-python pins (2026-09-30.endive in 16.0,
2026-11-18.endive in 17.1) does not change what dj-stripe syncs, and you do
not need to change STRIPE_API_VERSION to upgrade the SDK.
Your own code is a different matter. If it calls stripe-python directly:
- Requests you make without
stripe_versionuse the SDK's pinned API version. Upgrading to stripe-python 16 moves those requests to theendiveAPI release, which contains breaking API changes. Passstripe_version=djstripe_settings.STRIPE_API_VERSION, or setstripe.api_version, if your code expects the same API version as dj-stripe. Review the Stripe API changelog before moving your own requests toendive. - stripe-python 16 takes path parameters (the ids in the URL) positionally
only:
stripe.Transfer.create_reversal("tr_123", amount=100), notcreate_reversal(id="tr_123", ...). It also renamesstripe.Reversaltostripe.TransferReversaland removesStripeObject.request()(useStripeClient.raw_request()). - stripe-python 17 no longer keeps API keys on pickled Stripe objects. If you
cache Stripe objects and make requests through them after unpickling, call
reattach_api_key(api_key)on them first.
See the stripe-python migration guides for v16 and v17.
New Features
- Added
PaymentIntent.create(), which creates a PaymentIntent in Stripe and syncs it. dj-stripe model instances passed as arguments (such ascustomer=) are converted to their Stripe ids (#939). - Add
djstripe.utils.owner_account_cache(), a context manager that memoises the API key to ownerAccountlookup that every synced object performs. Use it around your own bulk syncs; dj-stripe applies it internally arounddjstripe_sync_modelsruns and webhook processing. - Syncing is substantially cheaper. Resolving the owner
Accountfor an API key is now memoised for the duration of adjstripe_sync_modelsrun and of each webhook, cutting roughly 40% of the queries issued per synced object.djstripe_sync_modelsalso enumerates a key's connected accounts once per run instead of once per model, which removes ~50 redundant account retrieve/list round trips per key. - The
djstripe_sync_modelshandlers that have to enumerate a parent resource first (line items per invoice, payment methods per customer, and so on) now yield lazily instead of building the full list up front, so syncing starts on the first page and the ids no longer all sit in memory at once. - Added
Coupon.is_valid(at=None), which reports whether a coupon can still be redeemed. It combines Stripe'svalidfield with the coupon'sredeem_bydate, because Stripe sends no webhook when that date passes and the storedvalidfield goes stale (#717).
Bug Fixes
Price.create()now passesunit_amountto Stripe unchanged, using Stripe's minor currency units instead of incorrectly multiplying the value by 100 (#1941).- The default Stripe API version is now
2026-07-29.dahlia(was2026-05-27.dahlia), matching the version pinned by stripe-python 15.5.1. - dj-stripe now falls back to its own
DEFAULT_STRIPE_API_VERSIONwhen theSTRIPE_API_VERSIONsetting is not configured. It previously fell back tostripe.api_version, which modern versions of stripe-python always set, so the default was dead code and dj-stripe synced against whatever API version the installed SDK happened to pin rather than the one its models are written against. Enum.humanize()no longer raisesKeyErrorfor a value Stripe has added that dj-stripe's hand-maintained enums do not list yet; the raw value is returned instead. It is called from__str__onCharge,Dispute,TaxId,Card,BankAccountandBalanceTransaction, so an unrecognised value made those objects unprintable and broke the admin changelist. The enums have also been refreshed against the Stripe API:TaxIdTypegains 87 types (and corrects thebr_cnpandid_npwtypos tobr_cnpjandid_npwp),PaymentMethodTypegains 24,DisputeStatusgainsprevented,RefundStatusgainsrequires_action,AccountTypegainsnone, andInvoiceBillingReasongainsquote_accept.djstripe_sync_modelsnow works with restricted (rk_) API keys.Account.get_default_account()checked the key configured in settings rather than the key it was passed, and the sync command dereferenced the resultingNone, raising'NoneType' object has no attribute 'id'. The platform account is no longer retrieved for restricted keys, and a key that cannot list connected accounts no longer aborts the rest of the sync (#1908).- dj-stripe's system checks no longer open a database connection on every
management command. The checks that inspect
WebhookEndpointrows are now taggeddatabase, so they run duringmigrateandmanage.py check --databaserather than on every command. This unblocks tooling that requires no open connections, such as django-extensions'reset_db(#2005). Charge.refund(amount=0)no longer issues a full refund. A zero amount was treated the same as no amount, so the whole remaining balance was refunded. Zero and negative amounts now raiseValueError; pass no amount for a full refund (#2260).- Subscriptions synced with Stripe API
2025-03-31.basilor later have a current period again. Stripe movedcurrent_period_startandcurrent_period_endto the subscription items, soSubscription.current_period_endwasNoneandperiod_current()andis_period_current()treated paid subscriptions as expired. The period is now taken from the item that renews first when the subscription has none. Invoices are linked to their subscription throughparent.subscription_details, andInvoice.paidfalls back to the invoice status (#2196, #2252). Subscriptions and invoices already stored without these fields pick them up the next time they are synced; rundjstripe_sync_models Subscription Invoiceto update them all at once. - dj-stripe's admin classes now accept the
action_locationargument that Django 6.1 added toModelAdmin.get_actions(). On Django 6.1 the admins that overrideget_actions()(StripeModelAdmin, its subclasses andWebhookEndpointAdmin) raised aRemovedInDjango2028Warningand were given no change form actions, and the old signature would raiseTypeErroronce the deprecation ends. The subscription admin now declares its cancel action inactionsinstead of adding it inget_actions(), so it is also no longer offered in popups (#2258). - Whether a key can read the platform account is now decided by Stripe's
response rather than by the
rk_prefix, so a restricted key granted that permission is no longer refused. - Some requests did not pass
STRIPE_API_VERSIONand used whichever API version the installed stripe-python pinned instead: attaching aPaymentMethod, syncing product features, syncing invoice line items, deleting a Connect external account, creating card tokens, anddjstripe.utils.get_supported_currency_choices(). With stripe-python 16 or later, that pin is theendiveAPI release. They now all useSTRIPE_API_VERSION. TransferReversalcreation and listing passed the transfer id to stripe-python by keyword, which stripe-python 16 rejects.ApplicationFeeRefundcan be synced, retrieved and created again. Stripe nests fee refunds under their application fee, andstripe.ApplicationFeeRefundhas nolistorcreatemethod (itsretrieveraisesNotImplementedError), sodjstripe_sync_models ApplicationFeeRefund, the admin resync action and_api_create()all failed. They now go throughstripe.ApplicationFee.djstripe_sync_models TaxIdsyncs customer tax ids again.TaxId.api_list(id=<customer id>)calledstripe.TaxId.list(), which rejects anidparameter and, without anowner, lists the account's own tax ids rather than a customer's. It now lists throughstripe.Customer.list_tax_ids().