dj-stripe 2.6.0 (2022-01-15)
NOTE: It is not possible to upgrade to dj-stripe 2.6.0 from versions older than 2.3.0.
To upgrade from an older version, first upgrade to dj-stripe 2.3.0.
Release highlights
- Support for Python 3.10 and Django 4.0.
- New models: Mandate, Payout, UsageRecordSummary, WebhookEndpoint (unused)
- Significant improvements and fixes to Stripe Connect features.
- Storing Stripe API keys by adding them to the Admin is now supported. This allows for use of multiple Stripe API keys (multiple Stripe accounts).
- Support for syncing Connect accounts via
djstripe_sync_models.
Deprecated features
- The use of the old
jsonfield-basedJSONFieldis deprecated and support for it will be dropped in dj-stripe 2.8.0.django.models.JSONFieldis available since Django 3.1.0. To switch to the newer JSONFields, setDJSTRIPE_USE_NATIVE_JSONFIELDtoTrue. Set it toFalseto remain on thejsonfield-powered text-based fields. A manual migration is necessary to convert existing databases from text to json. - The
DJSTRIPE_PRORATION_POLICYsetting is deprecated and will be ignored in 2.8. Specifyproration_policyin theSubscription.update()method explicitly instead. Customer.can_charge()is now deprecated. This was a very misleading method which resulted in incorrect behaviour when Customers had multiple payment methods. It will be removed in dj-stripe 2.8.0. You can useCustomer.payment_methods.all()instead.- For similar reasons,
Customer.has_valid_source()is deprecated and will be removed in dj-stripe 2.8.0. You can useCustomer.sources.all()instead.
Breaking changes
- Python 3.6 is no longer supported. The new minimum version of Python is 3.7.12.
- Django 2.2 and 3.1 are no longer supported.
DJSTRIPE_USE_NATIVE_JSONFIELDnow defaults toTrue. If you previously had it set toFalse, or did not have it set, you may want to explicitly set it toFalsein order to support a pre-existing database. A migration path will later be provided for this use case.- The undocumented
get_stripe_api_version()helper function has been removed. - Settings for dj-stripe are now in
djstripe.settings.djstripe_settings(as opposed to top-level indjstripe.settings) Customer.subscribe()method no longer accepts positional arguments, only keywords.charge_immediatelysupport in Customer.subscribe() has been removed (deprecated in 2.4). Setcollection_methodinstead.- The
at_period_endargument toSubscription.cancel()now defaults toFalse, instead of the value ofDJSTRIPE_PRORATION_POLICY.
Other changes
- The Stripe Account that triggered an Event is now available on the field
WebhookEventTrigger.stripe_trigger_account. - Fixed recursive fetch/update loop errors in
djstripe_sync_models. - Migrations have been optimized and should be faster.
- dj-stripe now checks the apparent validity of API keys used and will raise
InvalidStripeAPIKeyif the API key looks completely incorrect. Customerscan now be subscribed to multiple prices and/or plans by passing theitemsargument toCustomer.subscribe().- Checkout Session metadata can be used to create/link a Stripe
Customerto theCustomerinstance specified by thedjstripe_settings.SUBSCRIBER_CUSTOMER_KEY.