dj-stripe 2.0 ~ 2.3 release notes
2.3.0 (2020-04-19)
- The minimum version of Django is now 2.1, and Python 3.6.
- Changed
JSONFielddependency back to jsonfield from jsonfield2 (see Warning about safe uninstall of jsonfield2 on upgrade). - Fixed handling of
TaxRateevents (#1094). - Fixed pagination issue in
Invoice.sync_from_stripe_data(#1052). - Fixed pagination issues in
Subscription&Charge.sync_from_stripe_data(#1054). - Tidyup
_stripe_object_set_total_tax_amountsunique handling (#1139). - Dropped previously-deprecated
Invoicefields (see https://stripe.com/docs/upgrades#2018-11-08):.closed.forgiven.billing(renamed to.collection_method)
- Dropped previously-deprecated
enums.InvoiceStatus(#1020). - Deprecated the following fields - will be removed in 2.4 (#1087):
Subscription.billing(use.collection_methodinstead)Subscription.start(use.start_dateinstead)Subscription.tax_percent(use.default_tax_ratesinstead)
- Added
Invoice.statusandenums.InvoiceStatus(#1020). - Added new
Invoicefields (#1020, #1087):.discount.default_source.status
- Added new
Subscriptionfields (#1087):.default_payment_method.default_source.next_pending_invoice_item_invoice.pending_invoice_item_interval.pending_update.start_date
Warning about safe uninstall of jsonfield2 on upgrade
Both jsonfield and jsonfield2 use the same import path, so if upgrading from dj-stripe~=2.2.0 in an existing virtualenv, be sure to uninstall jsonfield2 first. eg:
# ensure jsonfield is uninstalled before we install jsonfield2
pip uninstall jsonfield2 -y && pip install "dj-stripe>=2.3.0dev"
Otherwise, pip uninstall jsonfield2 will remove jsonfield's
jsonfield module from site-packages, which would cause errors like
ImportError: cannot import name 'JSONField' from 'jsonfield' (unknown location)
If you have hit this ImportError already after upgrading, running this should resolve it:
# remove both jsonfield packages before reinstall to fix ImportError:
pip uninstall jsonfield jsonfield2 -y && pip install "dj-stripe>=2.3.0"
Note that this is only necessary if upgrading from dj-stripe 2.2.x, which temporarily depended on jsonfield2. This process is not necessary if upgrading from an earlier version of dj-stripe.
2.2.2 (2020-01-20)
This is a bugfix-only version:
- Fixed handling of
TaxRateevents (#1094).
2.2.1 (2020-01-14)
This is a bugfix-only version:
- Fixed bad package build.
2.2.0 (2020-01-13)
- Changed
JSONFielddependency package from jsonfield to jsonfield2, for Django 3 compatibility (see Warning about safe uninstall of jsonfield on upgrade). Note that Django 2.1 requires jsonfield<3.1. - Added support for Django 3.0 (requires jsonfield2>=3.0.3).
- Added support for python 3.8.
- Refactored
UpcomingInvoice, so it's no longer a subclass ofInvoice(to allowInvoiceto useManyToManyFields). - Dropped previously-deprecated
Accountfields (see https://stripe.com/docs/upgrades#2019-02-19):.business_name.business_primary_color.business_url(changed to a property).debit_negative_balances.decline_charge_on.display_name.legal_entity.payout_schedule.payout_statement_descriptor.statement_descriptor.support_email.support_phone.support_url.timezone.verification
- Dropped previously-deprecated
Account.business_logoproperty (renamed to.branding_icon) - Dropped previously-deprecated
Customer.account_balanceproperty (renamed to.balance) - Dropped previously-deprecated properties
Invoice.application_fee,Invoice.date - Dropped previously-deprecated enum
PaymentMethodType(useDjstripePaymentMethodTypeinstead) - Renamed
Invoice.billingto.collection_method(added deprecated property for the old name). - Updated
Invoicemodel to add missing fields. - Added
TaxRatemodel, andInvoice.default_tax_rates,InvoiceItem.tax_rates,Invoice.total_tax_amounts,Subscription.default_tax_rates,SubscriptionItem.tax_rates(#1027). - Change urls.py to use the new style urls.
- Update forward relation fields in the admin to be raw id fields.
- Updated
StripeQuantumCurrencyAmountFieldandStripeDecimalCurrencyAmountFieldto support Stripe Large Charges (#1045). - Update event handling so
customer.subscription.deletedupdates subscriptions tostatus="canceled"instead of deleting it from our database, to match Stripe's behaviour (#599). - Added missing
Refund.reasonvalue, increases field width (#1075). - Fixed
Refund.statusdefinition, reduces field width (#1076). - Deprecated non-standard
Invoice.status(renamed toInvoice.legacy_status) to make way for the Stripe field (preparation for #1020).
Warning about safe uninstall of jsonfield on upgrade
Both jsonfield and jsonfield2 use the same import path, so if upgrading to dj-stripe>=2.2 in an existing virtualenv, be sure to uninstall jsonfield first. eg:
# ensure jsonfield is uninstalled before we install jsonfield2
pip uninstall jsonfield -y && pip install "dj-stripe>=2.2.0"
Otherwise, pip uninstall jsonfield will remove jsonfield2's
jsonfield module from site-packages, which would cause errors like
ImportError: cannot import name 'JSONField' from 'jsonfield' (unknown location)
If you have hit this ImportError already after upgrading, running this should resolve it:
# remove both jsonfield packages before reinstall to fix ImportError:
pip uninstall jsonfield jsonfield2 -y && pip install "dj-stripe>=2.2.0"
Note on usage of Stripe Elements JS
See Integrating Stripe Elements for notes about usage of the Stripe Elements frontend JS library.
In summary: If you haven't yet migrated to PaymentIntents, prefer
stripe.createSource() to stripe.createToken().
2.1.1 (2019-10-01)
This is a bugfix-only release:
- Updated webhook signals list (#1000).
- Fixed issue syncing PaymentIntent with destination charge (#960).
- Fixed
Customer.subscriptionand.valid_subscriptions()to ignorestatus=incomplete_expired(#1006). - Fixed error on
paymentmethod.detachedevent withcard_xxxpayment methods (#967). - Added
PaymentMethod.detach()(#943). - Updated
help_texton all currency fields to make it clear if they're holding integer cents (StripeQuantumCurrencyAmountField) or decimal dollar (or euro, pound etc) (StripeDecimalCurrencyAmountField) (#999) - Documented our preferred Django model field types (#986)
Upcoming migration of currency fields (storage as cents instead of dollars)
Please be aware that we're looking at standardising our currency storage fields as integer quanta (cents) instead of Decimal (dollar) values, to match stripe.
This is intended to be part of the 3.0 release, since it will involve some breaking changes. See #955 for details and discussion.
2.1.0 (2019-09-12)
- Dropped Django 2.0 support
- The Python stripe library minimum version is now
2.32.0, also2.36.0is excluded due to a regression (#991). - Dropped previously-deprecated
Charge.fee_detailsproperty. - Dropped previously-deprecated
Transfer.fee_detailsproperty. - Dropped previously-deprecated
field_nameparameter tosync_from_stripe_data - Dropped previously-deprecated alias
StripeObjectofStripeModel - Dropped previously-deprecated alias
PaymentMethodofDjstripePaymentMethod - Dropped previously-deprecated properties
Charge.source_typeandCharge.source_stripe_id enums.PaymentMethodTypehas been deprecated, useenums.DjstripePaymentMethodType- Made
SubscriptionItem.quantitynullable as per Plans withusage_type="metered"(follow-up to #865) - Added manage commands
djstripe_sync_modelsanddjstripe_process_events(#727, #89) - Fixed issue with re-creating a customer after
Customer.purge()(#916) - Fixed sync of Customer Bank Accounts (#829)
- Fixed
Subscription.is_status_temporarily_current()(#852) - New models
- Payment Intent
- Setup Intent
- Payment Method
- Session
- Added fields to
Customermodel:address,invoice_prefix,invoice_settings,phone,preferred_locales,tax_exempt
Changes from API 2018-11-08:
- Added
Invoice.auto_advance, deprecatedInvoice.closedandInvoice.forgiven, see https://stripe.com/docs/billing/migration/invoice-states#upgrade-checklist
Changes from API 2019-02-19:
-
Major changes to Account fields, see https://stripe.com/docs/upgrades#2019-02-19, updated Account fields to match API 2019-02-19:
-
Added
Account.business_profile,.business_type,.company,.individual,.requirements,.settings -
Deprecated the existing fields, to be removed in 2.2
-
Special handling of the icon and logo fields:
- Renamed
Account.business_logotoAccount.branding_icon(note that in Stripe's APIAccount.business_logowas renamed toAccount.settings.branding_icon, andAccount.business_logo_large(which we didn't have a field for) was renamed toAccount.settings.branding_logo) - Added deprecated property for
Account.business_logo - Added
Account.branding_logoas a ForeignKey - Populate
Account.branding_iconand.branding_logofrom the newAccount.settings.branding.iconand.logo
- Renamed
Changes from API 2019-03-14:
- Renamed
Invoice.application_feetoInvoice.application_fee_amount(added deprecated property for the old name) - Removed
Invoice.date, in place ofInvoice.created(added deprecated property for the old name) - Added
Invoice.status_transitions - Renamed
Customer.account_balancetoCustomer.balance(added deprecated property for the old name) - Renamed
Customer.payment_methodstoCustomer.customer_payment_methods - Added new
SubscriptionStatus.incompleteandSubscriptionStatus.incomplete_expiredstatuses (#974) - Added new
BalanceTransactionTypevalues (#983)
Squashed dev migrations
As per our migration policy, unreleased migrations on the master branch have been squashed.
If you have been using the 2.1.0dev branch from master, you'll need to run the squashed migrations migrations before upgrading to >=2.1.0.
The simplest way to do this is to pip install dj-stripe==2.1.0rc0 and
migrate, alternatively check out the 2.1.0rc0 git tag.
2.0.5 (2019-09-12)
This is a bugfix-only version:
- Avoid stripe==2.36.0 due to regression (#991)
2.0.4 (2019-09-09)
This is a bugfix-only version:
- Fixed irreversible migration (#909)
2.0.3 (2019-06-11)
This is a bugfix-only version:
- In
_get_or_create_from_stripe_object, wrap create_create_from_stripe_objectin transaction, fixesTransactionManagementErroron race condition in webhook processing (#877, #903).
2.0.2 (2019-06-09)
This is a bugfix-only version:
- Don't save event objects if the webhook processing fails (#832).
- Fixed IntegrityError when
REMOTE_ADDRis an empty string. - Deprecated
field_nameparameter tosync_from_stripe_data
2.0.1 (2019-04-29)
This is a bugfix-only version:
- Fixed an error on
invoiceitem.updated(#848). - Handle test webhook properly in recent versions of Stripe API
(#779). At some point 2018 Stripe silently changed the ID used for
test events and
evt_00000000000000is not used anymore. - Fixed OperationalError seen in migration 0003 on postgres (#850).
- Fixed issue with migration 0003 not being unapplied correctly (#882).
- Fixed missing
SubscriptionItem.quantityon metered Plans (#865). - Fixed
Plan.create()(#870).
2.0.0 (2019-03-01)
- The Python stripe library minimum version is now
2.3.0. PaymentMethodhas been renamed toDjstripePaymentMethod(#841). An alias remains but will be removed in the next version.- Dropped support for Django<2.0, Python<3.4.
- Dropped previously-deprecated
stripe_objectsmodule. - Dropped previously-deprecated
stripe_timestampfield. - Dropped previously-deprecated
Charge.receipt_numberfield. - Dropped previously-deprecated
StripeSourcealias forCard - Dropped previously-deprecated
SubscriptionView,CancelSubscriptionViewandCancelSubscriptionForm. - Removed the default value from
DJSTRIPE_SUBSCRIPTION_REDIRECT. - All
stripe_idfields have been renamedid. Charge.source_typehas been deprecated. UseCharge.source.type.Charge.source_stripe_idhas been deprecated. UseCharge.source.id.- All deprecated Transfer fields (Stripe API 2017-04-06 and older), have been dropped.
This includes
date,destination_type(type),failure_code,failure_message,statement_descriptorandstatus. - Fixed IntegrityError when
REMOTE_ADDRis missing (#640). - New models:
ApplicationFeeApplicationFeeRefundBalanceTransactionCountrySpecScheduledQuerySubscriptionItemTransferReversalUsageRecord
- The
feeandfee_detailsattributes of both theChargeandTransferobjects are no longer stored in the database. Instead, they access their respective newbalance_transactionforeign key. Note thatfee_detailshas been deprecated on both models. - The
fraudulentattribute onChargeis now a property that checks thefraud_detailsfield. - Object key validity is now always enforced (#503).
Customer.sourcesno longer refers to a Card queryset, but to a Source queryset. In order to correctly transition, you should change all your references tocustomer.sourcestocustomer.legacy_cardsinstead. Thelegacy_cardsattribute already exists in 1.2.0.Customer.sources_v3is now namedCustomer.sources.- A new property
Customer.payment_methodsis now available, which allows you to iterate over all of a customer's payment methods (sources then cards). Card.customeris now nullable and cards are no longer deleted when their corresponding customer is deleted (#654).- Webhook signature verification is now available and is preferred. Set the
DJSTRIPE_WEBHOOK_SECRETsetting to your secret to start using it. StripeObjecthas been renamedStripeModel. An alias remains but will be removed in the next version.- The metadata key used in the
Customerobject can now be configured by changing theDJSTRIPE_SUBSCRIBER_CUSTOMER_KEYsetting. Setting this to None or an empty string now also disables the behaviour altogether. - Text-type fields in dj-stripe will no longer ever be None. Instead, any falsy text field will return an empty string.
- Switched test runner to pytest-django
StripeModel.sync_from_stripe_data()will now automatically retrieve related objects and populate foreign keys (#681)- Added
Coupon.name - Added
Transfer.balance_transaction - Exceptions in webhooks are now re-raised as well as saved in the database (#833)