| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from typing import Dict, List |
| 4 |
from typing_extensions import Literal, NotRequired, TypedDict |
| 5 |
|
| 6 |
|
| 7 |
class SessionUpdateParams(TypedDict): |
| 8 |
collected_information: NotRequired[ |
| 9 |
"SessionUpdateParamsCollectedInformation" |
| 10 |
] |
| 11 |
""" |
| 12 |
Information about the customer collected within the Checkout Session. Can only be set when updating `embedded` or `custom` sessions. |
| 13 |
""" |
| 14 |
expand: NotRequired[List[str]] |
| 15 |
""" |
| 16 |
Specifies which fields in the response should be expanded. |
| 17 |
""" |
| 18 |
line_items: NotRequired[List["SessionUpdateParamsLineItem"]] |
| 19 |
""" |
| 20 |
A list of items the customer is purchasing. |
| 21 |
|
| 22 |
When updating line items, you must retransmit the entire array of line items. |
| 23 |
|
| 24 |
To retain an existing line item, specify its `id`. |
| 25 |
|
| 26 |
To update an existing line item, specify its `id` along with the new values of the fields to update. |
| 27 |
|
| 28 |
To add a new line item, specify one of `price` or `price_data` and `quantity`. |
| 29 |
|
| 30 |
To remove an existing line item, omit the line item's ID from the retransmitted array. |
| 31 |
|
| 32 |
To reorder a line item, specify it at the desired position in the retransmitted array. |
| 33 |
""" |
| 34 |
metadata: NotRequired["Literal['']|Dict[str, str]"] |
| 35 |
""" |
| 36 |
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. |
| 37 |
""" |
| 38 |
shipping_options: NotRequired[ |
| 39 |
"Literal['']|List[SessionUpdateParamsShippingOption]" |
| 40 |
] |
| 41 |
""" |
| 42 |
The shipping rate options to apply to this Session. Up to a maximum of 5. |
| 43 |
""" |
| 44 |
|
| 45 |
|
| 46 |
class SessionUpdateParamsCollectedInformation(TypedDict): |
| 47 |
shipping_details: NotRequired[ |
| 48 |
"SessionUpdateParamsCollectedInformationShippingDetails" |
| 49 |
] |
| 50 |
""" |
| 51 |
The shipping details to apply to this Session. |
| 52 |
""" |
| 53 |
|
| 54 |
|
| 55 |
class SessionUpdateParamsCollectedInformationShippingDetails(TypedDict): |
| 56 |
address: "SessionUpdateParamsCollectedInformationShippingDetailsAddress" |
| 57 |
""" |
| 58 |
The address of the customer |
| 59 |
""" |
| 60 |
name: str |
| 61 |
""" |
| 62 |
The name of customer |
| 63 |
""" |
| 64 |
|
| 65 |
|
| 66 |
class SessionUpdateParamsCollectedInformationShippingDetailsAddress(TypedDict): |
| 67 |
city: NotRequired[str] |
| 68 |
""" |
| 69 |
City, district, suburb, town, or village. |
| 70 |
""" |
| 71 |
country: str |
| 72 |
""" |
| 73 |
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). |
| 74 |
""" |
| 75 |
line1: str |
| 76 |
""" |
| 77 |
Address line 1, such as the street, PO Box, or company name. |
| 78 |
""" |
| 79 |
line2: NotRequired[str] |
| 80 |
""" |
| 81 |
Address line 2, such as the apartment, suite, unit, or building. |
| 82 |
""" |
| 83 |
postal_code: NotRequired[str] |
| 84 |
""" |
| 85 |
ZIP or postal code. |
| 86 |
""" |
| 87 |
state: NotRequired[str] |
| 88 |
""" |
| 89 |
State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). |
| 90 |
""" |
| 91 |
|
| 92 |
|
| 93 |
class SessionUpdateParamsLineItem(TypedDict): |
| 94 |
adjustable_quantity: NotRequired[ |
| 95 |
"SessionUpdateParamsLineItemAdjustableQuantity" |
| 96 |
] |
| 97 |
""" |
| 98 |
When set, provides configuration for this item's quantity to be adjusted by the customer during Checkout. |
| 99 |
""" |
| 100 |
id: NotRequired[str] |
| 101 |
""" |
| 102 |
ID of an existing line item. |
| 103 |
""" |
| 104 |
metadata: NotRequired["Literal['']|Dict[str, str]"] |
| 105 |
""" |
| 106 |
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. |
| 107 |
""" |
| 108 |
price: NotRequired[str] |
| 109 |
""" |
| 110 |
The ID of the [Price](https://docs.stripe.com/api/prices). One of `price` or `price_data` is required when creating a new line item. |
| 111 |
""" |
| 112 |
price_data: NotRequired["SessionUpdateParamsLineItemPriceData"] |
| 113 |
""" |
| 114 |
Data used to generate a new [Price](https://docs.stripe.com/api/prices) object inline. One of `price` or `price_data` is required when creating a new line item. |
| 115 |
""" |
| 116 |
quantity: NotRequired[int] |
| 117 |
""" |
| 118 |
The quantity of the line item being purchased. Quantity should not be defined when `recurring.usage_type=metered`. |
| 119 |
""" |
| 120 |
tax_rates: NotRequired["Literal['']|List[str]"] |
| 121 |
""" |
| 122 |
The [tax rates](https://docs.stripe.com/api/tax_rates) which apply to this line item. |
| 123 |
""" |
| 124 |
|
| 125 |
|
| 126 |
class SessionUpdateParamsLineItemAdjustableQuantity(TypedDict): |
| 127 |
enabled: bool |
| 128 |
""" |
| 129 |
Set to true if the quantity can be adjusted to any positive integer. Setting to false will remove any previously specified constraints on quantity. |
| 130 |
""" |
| 131 |
maximum: NotRequired[int] |
| 132 |
""" |
| 133 |
The maximum quantity the customer can purchase for the Checkout Session. By default this value is 99. You can specify a value up to 999999. |
| 134 |
""" |
| 135 |
minimum: NotRequired[int] |
| 136 |
""" |
| 137 |
The minimum quantity the customer must purchase for the Checkout Session. By default this value is 0. |
| 138 |
""" |
| 139 |
|
| 140 |
|
| 141 |
class SessionUpdateParamsLineItemPriceData(TypedDict): |
| 142 |
currency: str |
| 143 |
""" |
| 144 |
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). |
| 145 |
""" |
| 146 |
product: NotRequired[str] |
| 147 |
""" |
| 148 |
The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to. One of `product` or `product_data` is required. |
| 149 |
""" |
| 150 |
product_data: NotRequired[ |
| 151 |
"SessionUpdateParamsLineItemPriceDataProductData" |
| 152 |
] |
| 153 |
""" |
| 154 |
Data used to generate a new [Product](https://docs.stripe.com/api/products) object inline. One of `product` or `product_data` is required. |
| 155 |
""" |
| 156 |
recurring: NotRequired["SessionUpdateParamsLineItemPriceDataRecurring"] |
| 157 |
""" |
| 158 |
The recurring components of a price such as `interval` and `interval_count`. |
| 159 |
""" |
| 160 |
tax_behavior: NotRequired[Literal["exclusive", "inclusive", "unspecified"]] |
| 161 |
""" |
| 162 |
Only required if a [default tax behavior](https://docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. |
| 163 |
""" |
| 164 |
unit_amount: NotRequired[int] |
| 165 |
""" |
| 166 |
A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. |
| 167 |
""" |
| 168 |
unit_amount_decimal: NotRequired[str] |
| 169 |
""" |
| 170 |
Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. |
| 171 |
""" |
| 172 |
|
| 173 |
|
| 174 |
class SessionUpdateParamsLineItemPriceDataProductData(TypedDict): |
| 175 |
description: NotRequired[str] |
| 176 |
""" |
| 177 |
The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. |
| 178 |
""" |
| 179 |
images: NotRequired[List[str]] |
| 180 |
""" |
| 181 |
A list of up to 8 URLs of images for this product, meant to be displayable to the customer. |
| 182 |
""" |
| 183 |
metadata: NotRequired[Dict[str, str]] |
| 184 |
""" |
| 185 |
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. |
| 186 |
""" |
| 187 |
name: str |
| 188 |
""" |
| 189 |
The product's name, meant to be displayable to the customer. |
| 190 |
""" |
| 191 |
tax_code: NotRequired[str] |
| 192 |
""" |
| 193 |
A [tax code](https://docs.stripe.com/tax/tax-categories) ID. |
| 194 |
""" |
| 195 |
unit_label: NotRequired[str] |
| 196 |
""" |
| 197 |
A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. |
| 198 |
""" |
| 199 |
|
| 200 |
|
| 201 |
class SessionUpdateParamsLineItemPriceDataRecurring(TypedDict): |
| 202 |
interval: Literal["day", "month", "week", "year"] |
| 203 |
""" |
| 204 |
Specifies billing frequency. Either `day`, `week`, `month` or `year`. |
| 205 |
""" |
| 206 |
interval_count: NotRequired[int] |
| 207 |
""" |
| 208 |
The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). |
| 209 |
""" |
| 210 |
|
| 211 |
|
| 212 |
class SessionUpdateParamsShippingOption(TypedDict): |
| 213 |
shipping_rate: NotRequired[str] |
| 214 |
""" |
| 215 |
The ID of the Shipping Rate to use for this shipping option. |
| 216 |
""" |
| 217 |
shipping_rate_data: NotRequired[ |
| 218 |
"SessionUpdateParamsShippingOptionShippingRateData" |
| 219 |
] |
| 220 |
""" |
| 221 |
Parameters to be passed to Shipping Rate creation for this shipping option. |
| 222 |
""" |
| 223 |
|
| 224 |
|
| 225 |
class SessionUpdateParamsShippingOptionShippingRateData(TypedDict): |
| 226 |
delivery_estimate: NotRequired[ |
| 227 |
"SessionUpdateParamsShippingOptionShippingRateDataDeliveryEstimate" |
| 228 |
] |
| 229 |
""" |
| 230 |
The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions. |
| 231 |
""" |
| 232 |
display_name: str |
| 233 |
""" |
| 234 |
The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. |
| 235 |
""" |
| 236 |
fixed_amount: NotRequired[ |
| 237 |
"SessionUpdateParamsShippingOptionShippingRateDataFixedAmount" |
| 238 |
] |
| 239 |
""" |
| 240 |
Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. |
| 241 |
""" |
| 242 |
metadata: NotRequired[Dict[str, str]] |
| 243 |
""" |
| 244 |
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. |
| 245 |
""" |
| 246 |
tax_behavior: NotRequired[Literal["exclusive", "inclusive", "unspecified"]] |
| 247 |
""" |
| 248 |
Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. |
| 249 |
""" |
| 250 |
tax_code: NotRequired[str] |
| 251 |
""" |
| 252 |
A [tax code](https://docs.stripe.com/tax/tax-categories) ID. The Shipping tax code is `txcd_92010001`. |
| 253 |
""" |
| 254 |
type: NotRequired[Literal["fixed_amount"]] |
| 255 |
""" |
| 256 |
The type of calculation to use on the shipping rate. |
| 257 |
""" |
| 258 |
|
| 259 |
|
| 260 |
class SessionUpdateParamsShippingOptionShippingRateDataDeliveryEstimate( |
| 261 |
TypedDict, |
| 262 |
): |
| 263 |
maximum: NotRequired[ |
| 264 |
"SessionUpdateParamsShippingOptionShippingRateDataDeliveryEstimateMaximum" |
| 265 |
] |
| 266 |
""" |
| 267 |
The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. |
| 268 |
""" |
| 269 |
minimum: NotRequired[ |
| 270 |
"SessionUpdateParamsShippingOptionShippingRateDataDeliveryEstimateMinimum" |
| 271 |
] |
| 272 |
""" |
| 273 |
The lower bound of the estimated range. If empty, represents no lower bound. |
| 274 |
""" |
| 275 |
|
| 276 |
|
| 277 |
class SessionUpdateParamsShippingOptionShippingRateDataDeliveryEstimateMaximum( |
| 278 |
TypedDict, |
| 279 |
): |
| 280 |
unit: Literal["business_day", "day", "hour", "month", "week"] |
| 281 |
""" |
| 282 |
A unit of time. |
| 283 |
""" |
| 284 |
value: int |
| 285 |
""" |
| 286 |
Must be greater than 0. |
| 287 |
""" |
| 288 |
|
| 289 |
|
| 290 |
class SessionUpdateParamsShippingOptionShippingRateDataDeliveryEstimateMinimum( |
| 291 |
TypedDict, |
| 292 |
): |
| 293 |
unit: Literal["business_day", "day", "hour", "month", "week"] |
| 294 |
""" |
| 295 |
A unit of time. |
| 296 |
""" |
| 297 |
value: int |
| 298 |
""" |
| 299 |
Must be greater than 0. |
| 300 |
""" |
| 301 |
|
| 302 |
|
| 303 |
class SessionUpdateParamsShippingOptionShippingRateDataFixedAmount(TypedDict): |
| 304 |
amount: int |
| 305 |
""" |
| 306 |
A non-negative integer in cents representing how much to charge. |
| 307 |
""" |
| 308 |
currency: str |
| 309 |
""" |
| 310 |
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). |
| 311 |
""" |
| 312 |
currency_options: NotRequired[ |
| 313 |
Dict[ |
| 314 |
str, |
| 315 |
"SessionUpdateParamsShippingOptionShippingRateDataFixedAmountCurrencyOptions", |
| 316 |
] |
| 317 |
] |
| 318 |
""" |
| 319 |
Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). |
| 320 |
""" |
| 321 |
|
| 322 |
|
| 323 |
class SessionUpdateParamsShippingOptionShippingRateDataFixedAmountCurrencyOptions( |
| 324 |
TypedDict, |
| 325 |
): |
| 326 |
amount: int |
| 327 |
""" |
| 328 |
A non-negative integer in cents representing how much to charge. |
| 329 |
""" |
| 330 |
tax_behavior: NotRequired[Literal["exclusive", "inclusive", "unspecified"]] |
| 331 |
""" |
| 332 |
Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. |
| 333 |
""" |