Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of Order in version 5.0.0 of stripe Python package #1842

Closed
jacklinke opened this issue Nov 16, 2022 · 10 comments
Closed

Removal of Order in version 5.0.0 of stripe Python package #1842

jacklinke opened this issue Nov 16, 2022 · 10 comments
Labels
api change This issue concerns a Stripe API change that dj-stripe needs to be aware of
Milestone

Comments

@jacklinke
Copy link

stripe.Order no longer exists in stripe 5.0.0

Today's release of stripe Python package version 5.0.0 introduces a breaking change, removing Order.

Unfortunately, Stripe did not deprecate this in the code or add exceptions - it is simply removed as of 5.0.0.

orders.py in dj-stripe utilizes stripe.Order. It is also referenced in tests/test_event_handlers.py and tests/test_order.py.

I am not sure of dj-stripe's existing policy for dealing with such changes, but pyproject.toml currently specifies stripe = ">=2.48.0". This may become a problem for anyone using dj-stripe who updates stripe to the latest version, and I expect the tests here will fail on next commit of dj-stripe.

@jacklinke jacklinke added the api change This issue concerns a Stripe API change that dj-stripe needs to be aware of label Nov 16, 2022
@kavdev
Copy link
Member

kavdev commented Nov 17, 2022

Oh goodie.

@jacklinke
Copy link
Author

@kavdev I wish it better news 😆 😭

@anthonyto
Copy link

Anyone encountering this problem can pin stripe-python at 4.2.0 until dj-stripe is updated to support stripe-python 5.0.0.

Also hey @kavdev lol fancy seeing you here

@digitalWestie
Copy link

Thanks for raising this. I just ran into this error integrating dj-stripe into my django app for the first time.

  File "/usr/local/lib/python3.8/site-packages/djstripe/models/__init__.py", line 45, in <module>
    from .orders import Order
  File "/usr/local/lib/python3.8/site-packages/djstripe/models/orders.py", line 15, in <module>
    class Order(StripeModel):
  File "/usr/local/lib/python3.8/site-packages/djstripe/models/orders.py", line 24, in Order
    stripe_class = stripe.Order
AttributeError: module 'stripe' has no attribute 'Order'

For now I'm correcting by restricting stripe package vers in requirements.txt:

...
stripe>=4.0.0,!= 5.0.0 # fixes issue https://github.com/dj-stripe/dj-stripe/issues/1842
dj-stripe==2.7.2

@jacklinke
Copy link
Author

@digitalWestie would recommend modifying to the following so you don't get failure if stripe updates to 5.0.1 etc

stripe>=4.0.0,<5.0.0

@digitalWestie
Copy link

@jacklinke yeah good idea

@kavdev
Copy link
Member

kavdev commented Nov 18, 2022

Also hey @kavdev lol fancy seeing you here

Small world!

@kavdev
Copy link
Member

kavdev commented Nov 18, 2022

@arnav13081994 @jleclanche I think constraining the python sdk version as a hotfix and then starting a deprecation path for Orders is the move here. Thoughts?

Our contacts at Stripe said it got dropped after beta and didn't make it to a GA release. Seems safe to remove? Idk what the replacement abstraction is in the API

@nathanramoscfa
Copy link

nathanramoscfa commented Nov 25, 2022

First time user of Stripe, spent hours trying figure out why I kept getting AttributeError: module 'stripe' has no attribute 'Order'. Finally found this thread. I did pip uninstall stripe to uninstall stripe version 5.0.0, and then reinstalled previous working version, pip install stripe==4.2.0. py manage.py migrate worked from then on.

@jleclanche
Copy link
Member

Apologies for the delayed reaction folks. I've released dj-stripe 2.7.3 which pins at < 5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change This issue concerns a Stripe API change that dj-stripe needs to be aware of
Projects
None yet
Development

No branches or pull requests

6 participants