dj-stripe 3.0.0 (unreleased)

Breaking Changes

  • The Source and SourceTransaction models have been removed. The Stripe Sources API was deprecated in favour of the PaymentMethods API, and Source was deprecated in dj-stripe 2.11.0. Use the PaymentMethod model instead. This also removes the Customer.sources relation and the Customer.customer_payment_methods property; use Customer.payment_methods (the reverse relation of PaymentMethod.customer) instead. A database migration drops the djstripe_source and djstripe_sourcetransaction tables.

  • The DJSTRIPE_WEBHOOK_EVENT_CALLBACK setting 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_validate
    • djstripe.signals.webhook_post_validate
    • djstripe.signals.webhook_pre_process
    • djstripe.signals.webhook_post_process
    • djstripe.signals.webhook_processing_error
  • Removed subscription helpers that applied conflicting definitions of "active", "current", and "valid":

    • Customer.subscription
    • Customer.active_subscriptions
    • Customer.valid_subscriptions
    • Customer.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.objects or customer.subscriptions. The new with_status(), period_current(), scheduled_for_cancellation(), and for_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, and Subscription.is_scheduled_for_cancellation() replaces the ambiguously named is_status_temporarily_current(). This leaves choices such as whether a past_due, paused, or unpaid subscription grants service to the application rather than dj-stripe. SubscriptionMixin now adds a subscriptions queryset to the template context instead of the policy-dependent singular subscription (#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_version use the SDK's pinned API version. Upgrading to stripe-python 16 moves those requests to the endive API release, which contains breaking API changes. Pass stripe_version=djstripe_settings.STRIPE_API_VERSION, or set stripe.api_version, if your code expects the same API version as dj-stripe. Review the Stripe API changelog before moving your own requests to endive.
  • stripe-python 16 takes path parameters (the ids in the URL) positionally only: stripe.Transfer.create_reversal("tr_123", amount=100), not create_reversal(id="tr_123", ...). It also renames stripe.Reversal to stripe.TransferReversal and removes StripeObject.request() (use StripeClient.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 as customer=) are converted to their Stripe ids (#939).
  • Add djstripe.utils.owner_account_cache(), a context manager that memoises the API key to owner Account lookup that every synced object performs. Use it around your own bulk syncs; dj-stripe applies it internally around djstripe_sync_models runs and webhook processing.
  • Syncing is substantially cheaper. Resolving the owner Account for an API key is now memoised for the duration of a djstripe_sync_models run and of each webhook, cutting roughly 40% of the queries issued per synced object. djstripe_sync_models also 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_models handlers 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's valid field with the coupon's redeem_by date, because Stripe sends no webhook when that date passes and the stored valid field goes stale (#717).

Bug Fixes

  • Price.create() now passes unit_amount to 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 (was 2026-05-27.dahlia), matching the version pinned by stripe-python 15.5.1.
  • dj-stripe now falls back to its own DEFAULT_STRIPE_API_VERSION when the STRIPE_API_VERSION setting is not configured. It previously fell back to stripe.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 raises KeyError for 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__ on Charge, Dispute, TaxId, Card, BankAccount and BalanceTransaction, so an unrecognised value made those objects unprintable and broke the admin changelist. The enums have also been refreshed against the Stripe API: TaxIdType gains 87 types (and corrects the br_cnp and id_npw typos to br_cnpj and id_npwp), PaymentMethodType gains 24, DisputeStatus gains prevented, RefundStatus gains requires_action, AccountType gains none, and InvoiceBillingReason gains quote_accept.
  • djstripe_sync_models now 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 resulting None, 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 WebhookEndpoint rows are now tagged database, so they run during migrate and manage.py check --database rather 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 raise ValueError; pass no amount for a full refund (#2260).
  • Subscriptions synced with Stripe API 2025-03-31.basil or later have a current period again. Stripe moved current_period_start and current_period_end to the subscription items, so Subscription.current_period_end was None and period_current() and is_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 through parent.subscription_details, and Invoice.paid falls back to the invoice status (#2196, #2252). Subscriptions and invoices already stored without these fields pick them up the next time they are synced; run djstripe_sync_models Subscription Invoice to update them all at once.
  • dj-stripe's admin classes now accept the action_location argument that Django 6.1 added to ModelAdmin.get_actions(). On Django 6.1 the admins that override get_actions() (StripeModelAdmin, its subclasses and WebhookEndpointAdmin) raised a RemovedInDjango2028Warning and were given no change form actions, and the old signature would raise TypeError once the deprecation ends. The subscription admin now declares its cancel action in actions instead of adding it in get_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_VERSION and used whichever API version the installed stripe-python pinned instead: attaching a PaymentMethod, syncing product features, syncing invoice line items, deleting a Connect external account, creating card tokens, and djstripe.utils.get_supported_currency_choices(). With stripe-python 16 or later, that pin is the endive API release. They now all use STRIPE_API_VERSION.
  • TransferReversal creation and listing passed the transfer id to stripe-python by keyword, which stripe-python 16 rejects.
  • ApplicationFeeRefund can be synced, retrieved and created again. Stripe nests fee refunds under their application fee, and stripe.ApplicationFeeRefund has no list or create method (its retrieve raises NotImplementedError), so djstripe_sync_models ApplicationFeeRefund, the admin resync action and _api_create() all failed. They now go through stripe.ApplicationFee.
  • djstripe_sync_models TaxId syncs customer tax ids again. TaxId.api_list(id=<customer id>) called stripe.TaxId.list(), which rejects an id parameter and, without an owner, lists the account's own tax ids rather than a customer's. It now lists through stripe.Customer.list_tax_ids().