dj-stripe 2.6.0 (2022-01-15)

Attention

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-based JSONField is deprecated and support for it will be dropped in dj-stripe 2.8.0. django.models.JSONField is available since Django 3.1.0. To switch to the newer JSONFields, set DJSTRIPE_USE_NATIVE_JSONFIELD to True. Set it to False to remain on the jsonfield-powered text-based fields. A manual migration is necessary to convert existing databases from text to json.
  • The DJSTRIPE_PRORATION_POLICY setting is deprecated and will be ignored in 2.8. Specify proration_policy in the Subscription.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 use Customer.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 use Customer.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_JSONFIELD now defaults to True. If you previously had it set to False, or did not have it set, you may want to explicitly set it to False in 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 in djstripe.settings)
  • Customer.subscribe() method no longer accepts positional arguments, only keywords.
  • charge_immediately support in Customer.subscribe() has been removed (deprecated in 2.4). Set collection_method instead.
  • The at_period_end argument to Subscription.cancel() now defaults to False, instead of the value of DJSTRIPE_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 InvalidStripeAPIKey if the API key looks completely incorrect.
  • Customers can now be subscribed to multiple prices and/or plans by passing the items argument to Customer.subscribe().
  • Checkout Session metadata can be used to create/link a Stripe Customer to the Customer instance specified by the djstripe_settings.SUBSCRIBER_CUSTOMER_KEY.