Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fce63eb87846dfb612efc9be0e529a67d81b4525
68065dff88008f079e79eb1ef0add5e261b416e1
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2169
v2176
36 changes: 35 additions & 1 deletion stripe/_invoice_line_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 8 additions & 0 deletions stripe/_payment_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,18 @@ 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.
"""
usage: Optional[Literal["off_session"]]
"""
Indicates whether the payment method supports off-session payments.
"""
_inner_class_types = {"logo": Logo}

class CustomerBalance(StripeObject):
Expand Down
117 changes: 116 additions & 1 deletion stripe/billing/_alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]
Expand All @@ -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.
"""
Expand All @@ -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.
Expand Down Expand Up @@ -582,5 +696,6 @@ async def retrieve_async(

_inner_class_types = {
"credit_balance_threshold": CreditBalanceThreshold,
"spend_threshold": SpendThreshold,
"usage_threshold": UsageThreshold,
}
20 changes: 20 additions & 0 deletions stripe/params/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4037,6 +4037,7 @@
PaymentMethodModifyParamsBillingDetailsAddress as PaymentMethodModifyParamsBillingDetailsAddress,
PaymentMethodModifyParamsCard as PaymentMethodModifyParamsCard,
PaymentMethodModifyParamsCardNetworks as PaymentMethodModifyParamsCardNetworks,
PaymentMethodModifyParamsCustom as PaymentMethodModifyParamsCustom,
PaymentMethodModifyParamsPayto as PaymentMethodModifyParamsPayto,
PaymentMethodModifyParamsUsBankAccount as PaymentMethodModifyParamsUsBankAccount,
)
Expand All @@ -4049,6 +4050,7 @@
PaymentMethodUpdateParamsBillingDetailsAddress as PaymentMethodUpdateParamsBillingDetailsAddress,
PaymentMethodUpdateParamsCard as PaymentMethodUpdateParamsCard,
PaymentMethodUpdateParamsCardNetworks as PaymentMethodUpdateParamsCardNetworks,
PaymentMethodUpdateParamsCustom as PaymentMethodUpdateParamsCustom,
PaymentMethodUpdateParamsPayto as PaymentMethodUpdateParamsPayto,
PaymentMethodUpdateParamsUsBankAccount as PaymentMethodUpdateParamsUsBankAccount,
)
Expand Down Expand Up @@ -5341,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,
Expand Down Expand Up @@ -19478,6 +19482,10 @@
"stripe.params._payment_method_modify_params",
False,
),
"PaymentMethodModifyParamsCustom": (
"stripe.params._payment_method_modify_params",
False,
),
"PaymentMethodModifyParamsPayto": (
"stripe.params._payment_method_modify_params",
False,
Expand Down Expand Up @@ -19510,6 +19518,10 @@
"stripe.params._payment_method_update_params",
False,
),
"PaymentMethodUpdateParamsCustom": (
"stripe.params._payment_method_update_params",
False,
),
"PaymentMethodUpdateParamsPayto": (
"stripe.params._payment_method_update_params",
False,
Expand Down Expand Up @@ -23519,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,
Expand Down
15 changes: 15 additions & 0 deletions stripe/params/_payment_method_modify_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -136,3 +140,14 @@ 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.
"""
usage: NotRequired[Literal["off_session"]]
"""
Indicates whether the payment method supports off-session payments.
"""
15 changes: 15 additions & 0 deletions stripe/params/_payment_method_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -135,3 +139,14 @@ 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.
"""
usage: NotRequired[Literal["off_session"]]
"""
Indicates whether the payment method supports off-session payments.
"""
26 changes: 22 additions & 4 deletions stripe/params/_subscription_pause_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
6 changes: 0 additions & 6 deletions stripe/params/_subscription_resume_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
"""
Loading