-
Notifications
You must be signed in to change notification settings - Fork 460
Description
Describe the bug
In my code, when creating new checkout session (stripe.checkout.Session.create(...)), I have typed the line_items like this:
line_items: list[stripe.checkout.Session.CreateParamsLineItem] = []
...
stripe.checkout.Session.create(
line_items=line_items,
...
)I build the content of line_items using some helper functions and those functions have been typed to return stripe.checkout.Session.CreateParamsLineItem as well.
Now in v13.0.0 this type does not exist anymore. The replacement for it is located in stripe.params.checkout._session_create_params.SessionCreateParamsLineItem but seems like that cannot be imported.
Same issue for
discounts: list[stripe.checkout.Session.CreateParamsDiscount] = []This has been replaced by stripe.params.checkout._session_create_params.SessionCreateParamsDiscount, also not importable.
What to do?
To Reproduce
- When creating checkout session with
stripe.checkout.Session.create(...), pass itline_itemsas a variable that has been declared asline_items: list[stripe.checkout.Session.CreateParamsLineItem] = [] - Code does not work in v13.0.0, stating
AttributeError: type object 'Session' has no attribute 'CreateParamsLineItem' - Same issue for
discountsparam if you pass it as a variable that has been declared asdiscounts: list[stripe.checkout.Session.CreateParamsDiscount] = []
Expected behavior
There should be a way to type both discounts and line_items params in the new major version.
Code snippets
OS
macOs
Language version
Python 3.13.1
Library version
stripe-python v13.0.0
API version
2025-09-30.clover
Additional context
No response