dj-stripe: Adding a card fails in 2.4.1

After upgrading to 2.4.1, I’m seeing an AttributeError when attempting to add a new card to the customer object:

django_1        |   File "/app/project/stripe/views.py", line 64, in post
django_1        |     customer.add_card(source)
django_1        |   File "/usr/local/lib/python3.6/site-packages/djstripe/models/core.py", line 963, in add_card
django_1        |     new_stripe_payment_method = stripe_customer.sources.create(source=source)
django_1        |   File "/usr/local/lib/python3.6/site-packages/stripe/stripe_object.py", line 92, in __getattr__
django_1        |     raise AttributeError(*err.args)
django_1        | AttributeError: sources

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (19 by maintainers)

Commits related to this issue

Most upvoted comments

STRIPE_API_VERSION = '2020-03-02' in settings fixes it (note - not DEFAULT_STRIPE_API_VERSION)

from https://stripe.com/docs/upgrades#2020-08-27

“The sources property on Customers is no longer included by default. You can expand the list but for performance reasons we recommended against doing so unless needed.”

Sounds like the fix for now is to expand this, and in 2.5 we will get rid of its usage.