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
JSONField
dependency back to jsonfield from jsonfield2 (see Warning about safe uninstall of jsonfield2 on upgrade). - Fixed handling of
TaxRate
events (#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_amounts
unique handling (#1139). - Dropped previously-deprecated
Invoice
fields (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_method
instead)Subscription.start
(use.start_date
instead)Subscription.tax_percent
(use.default_tax_rates
instead)
- Added
Invoice.status
andenums.InvoiceStatus
(#1020). - Added new
Invoice
fields (#1020, #1087):.discount
.default_source
.status
- Added new
Subscription
fields (#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
TaxRate
events (#1094).
2.2.1 (2020-01-14)
This is a bugfix-only version:
- Fixed bad package build.
2.2.0 (2020-01-13)
- Changed
JSONField
dependency 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 allowInvoice
to useManyToManyFields
). - Dropped previously-deprecated
Account
fields (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_logo
property (renamed to.branding_icon
) - Dropped previously-deprecated
Customer.account_balance
property (renamed to.balance
) - Dropped previously-deprecated properties
Invoice.application_fee
,Invoice.date
- Dropped previously-deprecated enum
PaymentMethodType
(useDjstripePaymentMethodType
instead) - Renamed
Invoice.billing
to.collection_method
(added deprecated property for the old name). - Updated
Invoice
model to add missing fields. - Added
TaxRate
model, 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
StripeQuantumCurrencyAmountField
andStripeDecimalCurrencyAmountField
to support Stripe Large Charges (#1045). - Update event handling so
customer.subscription.deleted
updates subscriptions tostatus="canceled"
instead of deleting it from our database, to match Stripe's behaviour (#599). - Added missing
Refund.reason
value, increases field width (#1075). - Fixed
Refund.status
definition, 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.subscription
and.valid_subscriptions()
to ignorestatus=incomplete_expired
(#1006). - Fixed error on
paymentmethod.detached
event withcard_xxx
payment methods (#967). - Added
PaymentMethod.detach()
(#943). - Updated
help_text
on 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.0
is excluded due to a regression (#991). - Dropped previously-deprecated
Charge.fee_details
property. - Dropped previously-deprecated
Transfer.fee_details
property. - Dropped previously-deprecated
field_name
parameter tosync_from_stripe_data
- Dropped previously-deprecated alias
StripeObject
ofStripeModel
- Dropped previously-deprecated alias
PaymentMethod
ofDjstripePaymentMethod
- Dropped previously-deprecated properties
Charge.source_type
andCharge.source_stripe_id
enums.PaymentMethodType
has been deprecated, useenums.DjstripePaymentMethodType
- Made
SubscriptionItem.quantity
nullable as per Plans withusage_type="metered"
(follow-up to #865) - Added manage commands
djstripe_sync_models
anddjstripe_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
Customer
model:address
,invoice_prefix
,invoice_settings
,phone
,preferred_locales
,tax_exempt
Changes from API 2018-11-08:
- Added
Invoice.auto_advance
, deprecatedInvoice.closed
andInvoice.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_logo
toAccount.branding_icon
> (note that in Stripe's APIAccount.business_logo
was renamed > toAccount.settings.branding_icon
, and >Account.business_logo_large
(which we didn't have a field > for) was renamed toAccount.settings.branding_logo
) > - Added deprecated property forAccount.business_logo
> - AddedAccount.branding_logo
as a ForeignKey > - PopulateAccount.branding_icon
and.branding_logo
from the > newAccount.settings.branding.icon
and.logo
Changes from API 2019-03-14:
- Renamed
Invoice.application_fee
toInvoice.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_balance
toCustomer.balance
(added deprecated property for the old name) - Renamed
Customer.payment_methods
toCustomer.customer_payment_methods
- Added new
SubscriptionStatus.incomplete
andSubscriptionStatus.incomplete_expired
statuses (#974) - Added new
BalanceTransactionType
values (#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_object
in transaction, fixesTransactionManagementError
on 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_ADDR
is an empty string. - Deprecated
field_name
parameter 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_00000000000000
is 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.quantity
on metered Plans (#865). - Fixed
Plan.create()
(#870).
2.0.0 (2019-03-01)
- The Python stripe library minimum version is now
2.3.0
. PaymentMethod
has 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_objects
module. - Dropped previously-deprecated
stripe_timestamp
field. - Dropped previously-deprecated
Charge.receipt_number
field. - Dropped previously-deprecated
StripeSource
alias forCard
- Dropped previously-deprecated
SubscriptionView
,CancelSubscriptionView
andCancelSubscriptionForm
. - Removed the default value from
DJSTRIPE_SUBSCRIPTION_REDIRECT
. - All
stripe_id
fields have been renamedid
. Charge.source_type
has been deprecated. UseCharge.source.type
.Charge.source_stripe_id
has 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_descriptor
andstatus
. - Fixed IntegrityError when
REMOTE_ADDR
is missing (#640). - New models:
ApplicationFee
ApplicationFeeRefund
BalanceTransaction
CountrySpec
ScheduledQuery
SubscriptionItem
TransferReversal
UsageRecord
- The
fee
andfee_details
attributes of both theCharge
andTransfer
objects are no longer stored in the database. Instead, they access their respective newbalance_transaction
foreign key. Note thatfee_details
has been deprecated on both models. - The
fraudulent
attribute onCharge
is now a property that checks thefraud_details
field. - Object key validity is now always enforced (#503).
Customer.sources
no longer refers to a Card queryset, but to a Source queryset. In order to correctly transition, you should change all your references tocustomer.sources
tocustomer.legacy_cards
instead. Thelegacy_cards
attribute already exists in 1.2.0.Customer.sources_v3
is now namedCustomer.sources
.- A new property
Customer.payment_methods
is now available, which allows you to iterate over all of a customer's payment methods (sources then cards). Card.customer
is 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_SECRET
setting to your secret to start using it. StripeObject
has been renamedStripeModel
. An alias remains but will be removed in the next version.- The metadata key used in the
Customer
object can now be configured by changing theDJSTRIPE_SUBSCRIBER_CUSTOMER_KEY
setting. 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)