| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._request_options import RequestOptions |
| 4 |
from typing import Dict, List, Union |
| 5 |
from typing_extensions import Literal, NotRequired, TypedDict |
| 6 |
|
| 7 |
|
| 8 |
class PriceCreateParams(RequestOptions): |
| 9 |
active: NotRequired[bool] |
| 10 |
""" |
| 11 |
Whether the price can be used for new purchases. Defaults to `true`. |
| 12 |
""" |
| 13 |
billing_scheme: NotRequired[Literal["per_unit", "tiered"]] |
| 14 |
""" |
| 15 |
Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. |
| 16 |
""" |
| 17 |
currency: str |
| 18 |
""" |
| 19 |
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). |
| 20 |
""" |
| 21 |
currency_options: NotRequired[ |
| 22 |
Dict[str, "PriceCreateParamsCurrencyOptions"] |
| 23 |
] |
| 24 |
""" |
| 25 |
Prices 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). |
| 26 |
""" |
| 27 |
custom_unit_amount: NotRequired["PriceCreateParamsCustomUnitAmount"] |
| 28 |
""" |
| 29 |
When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. |
| 30 |
""" |
| 31 |
expand: NotRequired[List[str]] |
| 32 |
""" |
| 33 |
Specifies which fields in the response should be expanded. |
| 34 |
""" |
| 35 |
lookup_key: NotRequired[str] |
| 36 |
""" |
| 37 |
A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. |
| 38 |
""" |
| 39 |
metadata: NotRequired[Dict[str, str]] |
| 40 |
""" |
| 41 |
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`. |
| 42 |
""" |
| 43 |
nickname: NotRequired[str] |
| 44 |
""" |
| 45 |
A brief description of the price, hidden from customers. |
| 46 |
""" |
| 47 |
product: NotRequired[str] |
| 48 |
""" |
| 49 |
The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to. |
| 50 |
""" |
| 51 |
product_data: NotRequired["PriceCreateParamsProductData"] |
| 52 |
""" |
| 53 |
These fields can be used to create a new product that this price will belong to. |
| 54 |
""" |
| 55 |
recurring: NotRequired["PriceCreateParamsRecurring"] |
| 56 |
""" |
| 57 |
The recurring components of a price such as `interval` and `usage_type`. |
| 58 |
""" |
| 59 |
tax_behavior: NotRequired[Literal["exclusive", "inclusive", "unspecified"]] |
| 60 |
""" |
| 61 |
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. |
| 62 |
""" |
| 63 |
tiers: NotRequired[List["PriceCreateParamsTier"]] |
| 64 |
""" |
| 65 |
Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. |
| 66 |
""" |
| 67 |
tiers_mode: NotRequired[Literal["graduated", "volume"]] |
| 68 |
""" |
| 69 |
Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. |
| 70 |
""" |
| 71 |
transfer_lookup_key: NotRequired[bool] |
| 72 |
""" |
| 73 |
If set to true, will atomically remove the lookup key from the existing price, and assign it to this price. |
| 74 |
""" |
| 75 |
transform_quantity: NotRequired["PriceCreateParamsTransformQuantity"] |
| 76 |
""" |
| 77 |
Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`. |
| 78 |
""" |
| 79 |
unit_amount: NotRequired[int] |
| 80 |
""" |
| 81 |
A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount`, `unit_amount_decimal`, or `custom_unit_amount` is required, unless `billing_scheme=tiered`. |
| 82 |
""" |
| 83 |
unit_amount_decimal: NotRequired[str] |
| 84 |
""" |
| 85 |
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. |
| 86 |
""" |
| 87 |
|
| 88 |
|
| 89 |
class PriceCreateParamsCurrencyOptions(TypedDict): |
| 90 |
custom_unit_amount: NotRequired[ |
| 91 |
"PriceCreateParamsCurrencyOptionsCustomUnitAmount" |
| 92 |
] |
| 93 |
""" |
| 94 |
When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. |
| 95 |
""" |
| 96 |
tax_behavior: NotRequired[Literal["exclusive", "inclusive", "unspecified"]] |
| 97 |
""" |
| 98 |
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. |
| 99 |
""" |
| 100 |
tiers: NotRequired[List["PriceCreateParamsCurrencyOptionsTier"]] |
| 101 |
""" |
| 102 |
Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. |
| 103 |
""" |
| 104 |
unit_amount: NotRequired[int] |
| 105 |
""" |
| 106 |
A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. |
| 107 |
""" |
| 108 |
unit_amount_decimal: NotRequired[str] |
| 109 |
""" |
| 110 |
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. |
| 111 |
""" |
| 112 |
|
| 113 |
|
| 114 |
class PriceCreateParamsCurrencyOptionsCustomUnitAmount(TypedDict): |
| 115 |
enabled: bool |
| 116 |
""" |
| 117 |
Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. |
| 118 |
""" |
| 119 |
maximum: NotRequired[int] |
| 120 |
""" |
| 121 |
The maximum unit amount the customer can specify for this item. |
| 122 |
""" |
| 123 |
minimum: NotRequired[int] |
| 124 |
""" |
| 125 |
The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. |
| 126 |
""" |
| 127 |
preset: NotRequired[int] |
| 128 |
""" |
| 129 |
The starting unit amount which can be updated by the customer. |
| 130 |
""" |
| 131 |
|
| 132 |
|
| 133 |
class PriceCreateParamsCurrencyOptionsTier(TypedDict): |
| 134 |
flat_amount: NotRequired[int] |
| 135 |
""" |
| 136 |
The flat billing amount for an entire tier, regardless of the number of units in the tier. |
| 137 |
""" |
| 138 |
flat_amount_decimal: NotRequired[str] |
| 139 |
""" |
| 140 |
Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. |
| 141 |
""" |
| 142 |
unit_amount: NotRequired[int] |
| 143 |
""" |
| 144 |
The per unit billing amount for each individual unit for which this tier applies. |
| 145 |
""" |
| 146 |
unit_amount_decimal: NotRequired[str] |
| 147 |
""" |
| 148 |
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. |
| 149 |
""" |
| 150 |
up_to: Union[Literal["inf"], int] |
| 151 |
""" |
| 152 |
Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use `inf` to define a fallback tier. |
| 153 |
""" |
| 154 |
|
| 155 |
|
| 156 |
class PriceCreateParamsCustomUnitAmount(TypedDict): |
| 157 |
enabled: bool |
| 158 |
""" |
| 159 |
Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. |
| 160 |
""" |
| 161 |
maximum: NotRequired[int] |
| 162 |
""" |
| 163 |
The maximum unit amount the customer can specify for this item. |
| 164 |
""" |
| 165 |
minimum: NotRequired[int] |
| 166 |
""" |
| 167 |
The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. |
| 168 |
""" |
| 169 |
preset: NotRequired[int] |
| 170 |
""" |
| 171 |
The starting unit amount which can be updated by the customer. |
| 172 |
""" |
| 173 |
|
| 174 |
|
| 175 |
class PriceCreateParamsProductData(TypedDict): |
| 176 |
active: NotRequired[bool] |
| 177 |
""" |
| 178 |
Whether the product is currently available for purchase. Defaults to `true`. |
| 179 |
""" |
| 180 |
id: NotRequired[str] |
| 181 |
""" |
| 182 |
The identifier for the product. Must be unique. If not provided, an identifier will be randomly generated. |
| 183 |
""" |
| 184 |
metadata: NotRequired[Dict[str, str]] |
| 185 |
""" |
| 186 |
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`. |
| 187 |
""" |
| 188 |
name: str |
| 189 |
""" |
| 190 |
The product's name, meant to be displayable to the customer. |
| 191 |
""" |
| 192 |
statement_descriptor: NotRequired[str] |
| 193 |
""" |
| 194 |
An arbitrary string to be displayed on your customer's credit card or bank statement. While most banks display this information consistently, some may display it incorrectly or not at all. |
| 195 |
|
| 196 |
This may be up to 22 characters. The statement description may not include `<`, `>`, `\\`, `"`, `'` characters, and will appear on your customer's statement in capital letters. Non-ASCII characters are automatically stripped. |
| 197 |
""" |
| 198 |
tax_code: NotRequired[str] |
| 199 |
""" |
| 200 |
A [tax code](https://docs.stripe.com/tax/tax-categories) ID. |
| 201 |
""" |
| 202 |
unit_label: NotRequired[str] |
| 203 |
""" |
| 204 |
A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. |
| 205 |
""" |
| 206 |
|
| 207 |
|
| 208 |
class PriceCreateParamsRecurring(TypedDict): |
| 209 |
interval: Literal["day", "month", "week", "year"] |
| 210 |
""" |
| 211 |
Specifies billing frequency. Either `day`, `week`, `month` or `year`. |
| 212 |
""" |
| 213 |
interval_count: NotRequired[int] |
| 214 |
""" |
| 215 |
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). |
| 216 |
""" |
| 217 |
meter: NotRequired[str] |
| 218 |
""" |
| 219 |
The meter tracking the usage of a metered price |
| 220 |
""" |
| 221 |
trial_period_days: NotRequired[int] |
| 222 |
""" |
| 223 |
Default number of trial days when subscribing a customer to this price using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan). |
| 224 |
""" |
| 225 |
usage_type: NotRequired[Literal["licensed", "metered"]] |
| 226 |
""" |
| 227 |
Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`. |
| 228 |
""" |
| 229 |
|
| 230 |
|
| 231 |
class PriceCreateParamsTier(TypedDict): |
| 232 |
flat_amount: NotRequired[int] |
| 233 |
""" |
| 234 |
The flat billing amount for an entire tier, regardless of the number of units in the tier. |
| 235 |
""" |
| 236 |
flat_amount_decimal: NotRequired[str] |
| 237 |
""" |
| 238 |
Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. |
| 239 |
""" |
| 240 |
unit_amount: NotRequired[int] |
| 241 |
""" |
| 242 |
The per unit billing amount for each individual unit for which this tier applies. |
| 243 |
""" |
| 244 |
unit_amount_decimal: NotRequired[str] |
| 245 |
""" |
| 246 |
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. |
| 247 |
""" |
| 248 |
up_to: Union[Literal["inf"], int] |
| 249 |
""" |
| 250 |
Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use `inf` to define a fallback tier. |
| 251 |
""" |
| 252 |
|
| 253 |
|
| 254 |
class PriceCreateParamsTransformQuantity(TypedDict): |
| 255 |
divide_by: int |
| 256 |
""" |
| 257 |
Divide usage by this number. |
| 258 |
""" |
| 259 |
round: Literal["down", "up"] |
| 260 |
""" |
| 261 |
After division, either round the result `up` or `down`. |
| 262 |
""" |