Skip to content

Error handling import does not match API documentation #1682

@niffler92

Description

@niffler92

Describe the bug

API documentation suggests using stripe.error.SomeError but current modules are not importable as described.
API Doc

To Reproduce

>>> import stripe.error
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'stripe.error'

>>> from stripe import error
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'error' from 'stripe' 

>>> import stripe.error.CardError
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'stripe.error'

>>> import stripe
>>> stripe.error.CardError
Traceback (most recent call last):
  File "/.../python3.12/site-packages/stripe/__init__.py", line 872, in __getattr__
    target, is_submodule = _import_map[name]
                           ~~~~~~~~~~~^^^^^^
KeyError: 'error'

Expected behavior

>>> import stripe
>>> stripe.error.CardError
<class 'stripe._error.CardError'>

Code snippets

OS

macOS

Language version

Python 3.12

Library version

stripe-python v14.0.0

API version

2025-11-17.clover

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions