From b0eed9403603788e8dc7bbb78ae5690250874ac2 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:05:31 +0000 Subject: [PATCH 1/5] Update generated code for v2171 and --- CODEGEN_VERSION | 2 +- OPENAPI_VERSION | 2 +- stripe/_payment_method.py | 4 ++++ stripe/params/__init__.py | 10 ++++++++++ stripe/params/_payment_method_modify_params.py | 11 +++++++++++ stripe/params/_payment_method_update_params.py | 11 +++++++++++ 6 files changed, 38 insertions(+), 2 deletions(-) diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 49cddf8d8..ecbcbbfdd 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -fce63eb87846dfb612efc9be0e529a67d81b4525 \ No newline at end of file +7ac9165eec7dad4653f37d286efeebf6a240d66b \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index f8ca2f439..3759a3d8a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2169 \ No newline at end of file +v2171 \ No newline at end of file diff --git a/stripe/_payment_method.py b/stripe/_payment_method.py index 08a3aa9a1..96229361e 100644 --- a/stripe/_payment_method.py +++ b/stripe/_payment_method.py @@ -842,6 +842,10 @@ class Logo(StripeObject): """ Contains information about the Dashboard-only CustomPaymentMethodType logo. """ + payment_method_reference: Optional[str] + """ + A reference to an external payment method, such as a PayPal Billing Agreement ID. + """ type: str """ ID of the Dashboard-only CustomPaymentMethodType. Not expandable. diff --git a/stripe/params/__init__.py b/stripe/params/__init__.py index 76ca3dcc8..4866c4f32 100644 --- a/stripe/params/__init__.py +++ b/stripe/params/__init__.py @@ -4037,6 +4037,7 @@ PaymentMethodModifyParamsBillingDetailsAddress as PaymentMethodModifyParamsBillingDetailsAddress, PaymentMethodModifyParamsCard as PaymentMethodModifyParamsCard, PaymentMethodModifyParamsCardNetworks as PaymentMethodModifyParamsCardNetworks, + PaymentMethodModifyParamsCustom as PaymentMethodModifyParamsCustom, PaymentMethodModifyParamsPayto as PaymentMethodModifyParamsPayto, PaymentMethodModifyParamsUsBankAccount as PaymentMethodModifyParamsUsBankAccount, ) @@ -4049,6 +4050,7 @@ PaymentMethodUpdateParamsBillingDetailsAddress as PaymentMethodUpdateParamsBillingDetailsAddress, PaymentMethodUpdateParamsCard as PaymentMethodUpdateParamsCard, PaymentMethodUpdateParamsCardNetworks as PaymentMethodUpdateParamsCardNetworks, + PaymentMethodUpdateParamsCustom as PaymentMethodUpdateParamsCustom, PaymentMethodUpdateParamsPayto as PaymentMethodUpdateParamsPayto, PaymentMethodUpdateParamsUsBankAccount as PaymentMethodUpdateParamsUsBankAccount, ) @@ -19478,6 +19480,10 @@ "stripe.params._payment_method_modify_params", False, ), + "PaymentMethodModifyParamsCustom": ( + "stripe.params._payment_method_modify_params", + False, + ), "PaymentMethodModifyParamsPayto": ( "stripe.params._payment_method_modify_params", False, @@ -19510,6 +19516,10 @@ "stripe.params._payment_method_update_params", False, ), + "PaymentMethodUpdateParamsCustom": ( + "stripe.params._payment_method_update_params", + False, + ), "PaymentMethodUpdateParamsPayto": ( "stripe.params._payment_method_update_params", False, diff --git a/stripe/params/_payment_method_modify_params.py b/stripe/params/_payment_method_modify_params.py index c0424e71f..2434d0e5b 100644 --- a/stripe/params/_payment_method_modify_params.py +++ b/stripe/params/_payment_method_modify_params.py @@ -34,6 +34,10 @@ class PaymentMethodModifyParams(RequestOptions): """ If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. """ + custom: NotRequired["PaymentMethodModifyParamsCustom"] + """ + If this is a `custom` PaymentMethod, this hash contains details about the Custom payment method. + """ class PaymentMethodModifyParamsBillingDetails(TypedDict): @@ -136,3 +140,10 @@ class PaymentMethodModifyParamsUsBankAccount(TypedDict): """ Bank account type. """ + + +class PaymentMethodModifyParamsCustom(TypedDict): + payment_method_reference: NotRequired[str] + """ + A reference to an external payment method, such as a PayPal Billing Agreement ID. + """ diff --git a/stripe/params/_payment_method_update_params.py b/stripe/params/_payment_method_update_params.py index b32ed0f0e..05057a357 100644 --- a/stripe/params/_payment_method_update_params.py +++ b/stripe/params/_payment_method_update_params.py @@ -33,6 +33,10 @@ class PaymentMethodUpdateParams(TypedDict): """ If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. """ + custom: NotRequired["PaymentMethodUpdateParamsCustom"] + """ + If this is a `custom` PaymentMethod, this hash contains details about the Custom payment method. + """ class PaymentMethodUpdateParamsBillingDetails(TypedDict): @@ -135,3 +139,10 @@ class PaymentMethodUpdateParamsUsBankAccount(TypedDict): """ Bank account type. """ + + +class PaymentMethodUpdateParamsCustom(TypedDict): + payment_method_reference: NotRequired[str] + """ + A reference to an external payment method, such as a PayPal Billing Agreement ID. + """ From 6df648b39a876d6e1ad698ceb960d670bbe69ef8 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 19:15:42 +0000 Subject: [PATCH 2/5] Update generated code for v2172 and --- CODEGEN_VERSION | 2 +- OPENAPI_VERSION | 2 +- stripe/params/__init__.py | 10 ++++++++ stripe/params/_subscription_pause_params.py | 26 +++++++++++++++++--- stripe/params/_subscription_resume_params.py | 6 ----- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index ecbcbbfdd..477206eaa 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -7ac9165eec7dad4653f37d286efeebf6a240d66b \ No newline at end of file +9d4f7dc7040d2aee8e0598ba54e93bafcb2103ba \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 3759a3d8a..4d4e27bd3 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2171 \ No newline at end of file +v2172 \ No newline at end of file diff --git a/stripe/params/__init__.py b/stripe/params/__init__.py index 4866c4f32..1dcb5a173 100644 --- a/stripe/params/__init__.py +++ b/stripe/params/__init__.py @@ -5343,6 +5343,8 @@ from stripe.params._subscription_pause_params import ( SubscriptionPauseParams as SubscriptionPauseParams, SubscriptionPauseParamsBillFor as SubscriptionPauseParamsBillFor, + SubscriptionPauseParamsBillForOutstandingUsageThrough as SubscriptionPauseParamsBillForOutstandingUsageThrough, + SubscriptionPauseParamsBillForUnusedTimeFrom as SubscriptionPauseParamsBillForUnusedTimeFrom, ) from stripe.params._subscription_resume_params import ( SubscriptionResumeParams as SubscriptionResumeParams, @@ -23529,6 +23531,14 @@ "stripe.params._subscription_pause_params", False, ), + "SubscriptionPauseParamsBillForOutstandingUsageThrough": ( + "stripe.params._subscription_pause_params", + False, + ), + "SubscriptionPauseParamsBillForUnusedTimeFrom": ( + "stripe.params._subscription_pause_params", + False, + ), "SubscriptionResumeParams": ( "stripe.params._subscription_resume_params", False, diff --git a/stripe/params/_subscription_pause_params.py b/stripe/params/_subscription_pause_params.py index 31d1f07df..5fe4b62e3 100644 --- a/stripe/params/_subscription_pause_params.py +++ b/stripe/params/_subscription_pause_params.py @@ -25,11 +25,29 @@ class SubscriptionPauseParams(RequestOptions): class SubscriptionPauseParamsBillFor(TypedDict): - outstanding_usage: NotRequired[bool] + outstanding_usage_through: NotRequired[ + "SubscriptionPauseParamsBillForOutstandingUsageThrough" + ] """ - Controls whether to debit for accrued metered usage in the current billing period. The default is `true`. + Controls when to bill for metered usage in the current period. Defaults to `{ type: "now" }`. """ - unused_time: NotRequired[bool] + unused_time_from: NotRequired[ + "SubscriptionPauseParamsBillForUnusedTimeFrom" + ] """ - Controls whether to credit for licensed items in the current billing period. The default is `true`. + Controls when to credit for unused time on licensed items. Defaults to `{ type: "now" }`. + """ + + +class SubscriptionPauseParamsBillForOutstandingUsageThrough(TypedDict): + type: Literal["none", "now"] + """ + When to bill metered usage in the current period. + """ + + +class SubscriptionPauseParamsBillForUnusedTimeFrom(TypedDict): + type: Literal["item_current_period_start", "none", "now"] + """ + When to credit for unused time. """ diff --git a/stripe/params/_subscription_resume_params.py b/stripe/params/_subscription_resume_params.py index 18f100847..e1ad4a625 100644 --- a/stripe/params/_subscription_resume_params.py +++ b/stripe/params/_subscription_resume_params.py @@ -24,9 +24,3 @@ class SubscriptionResumeParams(RequestOptions): """ If set, prorations will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint. """ - payment_behavior: NotRequired[ - Literal["allow_incomplete", "pending_if_incomplete"] - ] - """ - Controls when the subscription transitions from `paused` to `active`. Determines how payment on the invoice affects the resumption process.The default is `pending_if_incomplete`. - """ From 737556c4c9f7573d0f92f25dce05392ba40bac5f Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 18:30:54 +0000 Subject: [PATCH 3/5] Update generated code for v2174 and --- CODEGEN_VERSION | 2 +- OPENAPI_VERSION | 2 +- stripe/_payment_method.py | 4 ++++ stripe/params/_payment_method_modify_params.py | 4 ++++ stripe/params/_payment_method_update_params.py | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 477206eaa..602dec9bb 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -9d4f7dc7040d2aee8e0598ba54e93bafcb2103ba \ No newline at end of file +e5a785b8374103d84e609caec05bef6deec02a76 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4d4e27bd3..c6bd1eae1 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2172 \ No newline at end of file +v2174 \ No newline at end of file diff --git a/stripe/_payment_method.py b/stripe/_payment_method.py index 96229361e..1c0415119 100644 --- a/stripe/_payment_method.py +++ b/stripe/_payment_method.py @@ -850,6 +850,10 @@ class Logo(StripeObject): """ ID of the Dashboard-only CustomPaymentMethodType. Not expandable. """ + usage: Optional[Literal["off_session"]] + """ + Indicates whether the payment method supports off-session payments. + """ _inner_class_types = {"logo": Logo} class CustomerBalance(StripeObject): diff --git a/stripe/params/_payment_method_modify_params.py b/stripe/params/_payment_method_modify_params.py index 2434d0e5b..dd1468ce0 100644 --- a/stripe/params/_payment_method_modify_params.py +++ b/stripe/params/_payment_method_modify_params.py @@ -147,3 +147,7 @@ class PaymentMethodModifyParamsCustom(TypedDict): """ A reference to an external payment method, such as a PayPal Billing Agreement ID. """ + usage: NotRequired[Literal["off_session"]] + """ + Indicates whether the payment method supports off-session payments. + """ diff --git a/stripe/params/_payment_method_update_params.py b/stripe/params/_payment_method_update_params.py index 05057a357..1a1bcde41 100644 --- a/stripe/params/_payment_method_update_params.py +++ b/stripe/params/_payment_method_update_params.py @@ -146,3 +146,7 @@ class PaymentMethodUpdateParamsCustom(TypedDict): """ A reference to an external payment method, such as a PayPal Billing Agreement ID. """ + usage: NotRequired[Literal["off_session"]] + """ + Indicates whether the payment method supports off-session payments. + """ From de1f080d3b81a6dc0981faad459beeb886ccfc79 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 20:13:04 +0000 Subject: [PATCH 4/5] Update generated code for v2175 and --- CODEGEN_VERSION | 2 +- OPENAPI_VERSION | 2 +- stripe/_invoice_line_item.py | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 602dec9bb..396188c89 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -e5a785b8374103d84e609caec05bef6deec02a76 \ No newline at end of file +435318579fe1a2270384e53e512d5f85804035af \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index c6bd1eae1..7573f8fbf 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2174 \ No newline at end of file +v2175 \ No newline at end of file diff --git a/stripe/_invoice_line_item.py b/stripe/_invoice_line_item.py index a680758ae..6e6f8282d 100644 --- a/stripe/_invoice_line_item.py +++ b/stripe/_invoice_line_item.py @@ -128,10 +128,44 @@ class RateCardSubscriptionDetails(StripeObject): """ class ScheduleDetails(StripeObject): + class ProrationDetails(StripeObject): + class CreditedItems(StripeObject): + invoice: str + """ + Invoice containing the credited invoice line items + """ + invoice_line_items: List[str] + """ + Credited invoice line items + """ + + credited_items: Optional[CreditedItems] + """ + For a credit proration `line_item`, the original debit line_items to which the credit proration applies. + """ + _inner_class_types = {"credited_items": CreditedItems} + + invoice_item: Optional[str] + """ + The invoice item that generated this line item. + """ + proration: bool + """ + Whether this is a proration. + """ + proration_details: Optional[ProrationDetails] + """ + Additional details for proration line items. + """ schedule: str """ - The subscription schedule that generated this line item + The subscription schedule that generated this line item. """ + subscription: Optional[str] + """ + The subscription that the schedule belongs to. + """ + _inner_class_types = {"proration_details": ProrationDetails} class SubscriptionItemDetails(StripeObject): class ProrationDetails(StripeObject): From a110b03eb77d01dd0c1a3020973b274e47c7c844 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 21:46:13 +0000 Subject: [PATCH 5/5] Update generated code for v2176 and --- CODEGEN_VERSION | 2 +- OPENAPI_VERSION | 2 +- stripe/billing/_alert.py | 117 +++++++++++++++++- stripe/params/billing/__init__.py | 25 ++++ stripe/params/billing/_alert_create_params.py | 85 ++++++++++++- stripe/params/billing/_alert_list_params.py | 4 +- 6 files changed, 230 insertions(+), 5 deletions(-) diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 396188c89..5c168e856 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -435318579fe1a2270384e53e512d5f85804035af \ No newline at end of file +68065dff88008f079e79eb1ef0add5e261b416e1 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 7573f8fbf..70faab1cf 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2175 \ No newline at end of file +v2176 \ No newline at end of file diff --git a/stripe/billing/_alert.py b/stripe/billing/_alert.py index f27f0c031..251d58c81 100644 --- a/stripe/billing/_alert.py +++ b/stripe/billing/_alert.py @@ -119,6 +119,114 @@ class Monetary(StripeObject): lte: Lte _inner_class_types = {"filters": Filter, "lte": Lte} + class SpendThreshold(StripeObject): + class Filters(StripeObject): + billable_items: Optional[List[str]] + """ + Filter by billable item IDs. + """ + billing_cadence: Optional[str] + """ + Filter by billing cadence ID. + """ + pricing_plan: Optional[str] + """ + Filter by pricing plan ID. + """ + pricing_plan_subscription: Optional[str] + """ + Filter by pricing plan subscription ID. + """ + + class Gte(StripeObject): + class Amount(StripeObject): + currency: str + """ + 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). + """ + value: int + """ + A positive integer representing the amount. + """ + + class CustomPricingUnit(StripeObject): + class CustomPricingUnitDetails(StripeObject): + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + display_name: str + """ + The name of the custom pricing unit. + """ + id: str + """ + Unique identifier for the object. + """ + lookup_key: Optional[str] + """ + A lookup key for the custom pricing unit. + """ + metadata: Dict[str, str] + """ + 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. + """ + status: str + """ + The status of the custom pricing unit. + """ + + custom_pricing_unit_details: Optional[CustomPricingUnitDetails] + """ + The custom pricing unit object. + """ + id: str + """ + Unique identifier for the object. + """ + value: str + """ + A positive decimal string representing the amount. + """ + _inner_class_types = { + "custom_pricing_unit_details": CustomPricingUnitDetails, + } + + amount: Optional[Amount] + """ + The monetary amount. Present when type is `amount`. + """ + custom_pricing_unit: Optional[CustomPricingUnit] + """ + The custom pricing unit amount. Present when type is `custom_pricing_unit`. + """ + type: Literal["amount", "custom_pricing_unit"] + """ + The type of the threshold amount. + """ + _inner_class_types = { + "amount": Amount, + "custom_pricing_unit": CustomPricingUnit, + } + + aggregation_period: Literal["billing"] + """ + Defines the period over which spend is aggregated. + """ + filters: Optional[Filters] + """ + Filters to scope the spend calculation. + """ + group_by: Optional[Literal["pricing_plan_subscription"]] + """ + Defines the granularity of spend aggregation. + """ + gte: Gte + """ + The threshold value configuration for a spend threshold alert. + """ + _inner_class_types = {"filters": Filters, "gte": Gte} + class UsageThreshold(StripeObject): class Filter(StripeObject): customer: Optional[ExpandableField["Customer"]] @@ -145,7 +253,9 @@ class Filter(StripeObject): """ _inner_class_types = {"filters": Filter} - alert_type: Literal["credit_balance_threshold", "usage_threshold"] + alert_type: Literal[ + "credit_balance_threshold", "spend_threshold", "usage_threshold" + ] """ Defines the type of the alert. """ @@ -165,6 +275,10 @@ class Filter(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ + spend_threshold: Optional[SpendThreshold] + """ + Encapsulates the alert's configuration to monitor spend on pricing plan subscriptions. + """ status: Optional[Literal["active", "archived", "inactive"]] """ Status of the alert. This can be active, inactive or archived. @@ -582,5 +696,6 @@ async def retrieve_async( _inner_class_types = { "credit_balance_threshold": CreditBalanceThreshold, + "spend_threshold": SpendThreshold, "usage_threshold": UsageThreshold, } diff --git a/stripe/params/billing/__init__.py b/stripe/params/billing/__init__.py index 3127b063b..d4798e4d5 100644 --- a/stripe/params/billing/__init__.py +++ b/stripe/params/billing/__init__.py @@ -23,6 +23,11 @@ AlertCreateParamsCreditBalanceThresholdLte as AlertCreateParamsCreditBalanceThresholdLte, AlertCreateParamsCreditBalanceThresholdLteCustomPricingUnit as AlertCreateParamsCreditBalanceThresholdLteCustomPricingUnit, AlertCreateParamsCreditBalanceThresholdLteMonetary as AlertCreateParamsCreditBalanceThresholdLteMonetary, + AlertCreateParamsSpendThreshold as AlertCreateParamsSpendThreshold, + AlertCreateParamsSpendThresholdFilters as AlertCreateParamsSpendThresholdFilters, + AlertCreateParamsSpendThresholdGte as AlertCreateParamsSpendThresholdGte, + AlertCreateParamsSpendThresholdGteAmount as AlertCreateParamsSpendThresholdGteAmount, + AlertCreateParamsSpendThresholdGteCustomPricingUnit as AlertCreateParamsSpendThresholdGteCustomPricingUnit, AlertCreateParamsUsageThreshold as AlertCreateParamsUsageThreshold, AlertCreateParamsUsageThresholdFilter as AlertCreateParamsUsageThresholdFilter, ) @@ -166,6 +171,26 @@ "stripe.params.billing._alert_create_params", False, ), + "AlertCreateParamsSpendThreshold": ( + "stripe.params.billing._alert_create_params", + False, + ), + "AlertCreateParamsSpendThresholdFilters": ( + "stripe.params.billing._alert_create_params", + False, + ), + "AlertCreateParamsSpendThresholdGte": ( + "stripe.params.billing._alert_create_params", + False, + ), + "AlertCreateParamsSpendThresholdGteAmount": ( + "stripe.params.billing._alert_create_params", + False, + ), + "AlertCreateParamsSpendThresholdGteCustomPricingUnit": ( + "stripe.params.billing._alert_create_params", + False, + ), "AlertCreateParamsUsageThreshold": ( "stripe.params.billing._alert_create_params", False, diff --git a/stripe/params/billing/_alert_create_params.py b/stripe/params/billing/_alert_create_params.py index f962c3eb5..c0848291a 100644 --- a/stripe/params/billing/_alert_create_params.py +++ b/stripe/params/billing/_alert_create_params.py @@ -6,7 +6,9 @@ class AlertCreateParams(RequestOptions): - alert_type: Literal["credit_balance_threshold", "usage_threshold"] + alert_type: Literal[ + "credit_balance_threshold", "spend_threshold", "usage_threshold" + ] """ The type of alert to create. """ @@ -28,6 +30,10 @@ class AlertCreateParams(RequestOptions): """ The configuration of the usage threshold. """ + spend_threshold: NotRequired["AlertCreateParamsSpendThreshold"] + """ + The configuration of the spend threshold. + """ class AlertCreateParamsCreditBalanceThreshold(TypedDict): @@ -184,3 +190,80 @@ class AlertCreateParamsUsageThresholdFilter(TypedDict): """ What type of filter is being applied to this usage alert. """ + + +class AlertCreateParamsSpendThreshold(TypedDict): + aggregation_period: Literal["billing"] + """ + Defines the period over which spend is aggregated. + """ + filters: NotRequired["AlertCreateParamsSpendThresholdFilters"] + """ + Filters to scope the spend calculation. + """ + group_by: NotRequired[Literal["pricing_plan_subscription"]] + """ + Defines the granularity of spend aggregation. Defaults to `pricing_plan_subscription`. + """ + gte: "AlertCreateParamsSpendThresholdGte" + """ + Defines at which value the alert will fire. + """ + + +class AlertCreateParamsSpendThresholdFilters(TypedDict): + billable_items: NotRequired[List[str]] + """ + Filter by billable item IDs. Maximum of 20 billable items. + """ + billing_cadence: NotRequired[str] + """ + Filter by billing cadence ID. + """ + pricing_plan: NotRequired[str] + """ + Filter by pricing plan ID. + """ + pricing_plan_subscription: NotRequired[str] + """ + Filter by pricing plan subscription ID. + """ + + +class AlertCreateParamsSpendThresholdGte(TypedDict): + amount: NotRequired["AlertCreateParamsSpendThresholdGteAmount"] + """ + The monetary amount. Required when type is `amount`. + """ + custom_pricing_unit: NotRequired[ + "AlertCreateParamsSpendThresholdGteCustomPricingUnit" + ] + """ + The custom pricing unit amount. Required when type is `custom_pricing_unit`. + """ + type: Literal["amount", "custom_pricing_unit"] + """ + The type of the threshold amount. + """ + + +class AlertCreateParamsSpendThresholdGteAmount(TypedDict): + currency: str + """ + Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `value` parameter. + """ + value: int + """ + An integer representing the amount of the threshold. + """ + + +class AlertCreateParamsSpendThresholdGteCustomPricingUnit(TypedDict): + id: str + """ + The ID of the custom pricing unit. + """ + value: str + """ + A positive decimal string representing the amount of the custom pricing unit threshold. + """ diff --git a/stripe/params/billing/_alert_list_params.py b/stripe/params/billing/_alert_list_params.py index fbf5360f9..58eb60a71 100644 --- a/stripe/params/billing/_alert_list_params.py +++ b/stripe/params/billing/_alert_list_params.py @@ -7,7 +7,9 @@ class AlertListParams(RequestOptions): alert_type: NotRequired[ - Literal["credit_balance_threshold", "usage_threshold"] + Literal[ + "credit_balance_threshold", "spend_threshold", "usage_threshold" + ] ] """ Filter results to only include this type of alert.