diff --git a/API_VERSION b/API_VERSION index 506096245..e9da0dac3 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -441c0fcde75bcbf836f1a1810d5b9cfe8e8a7da4 \ No newline at end of file +f7784849b5189b7bdf4d850b41365cec53d174b2 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 81ad24fd4..1ed5292e7 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2116 \ No newline at end of file +v2120 \ No newline at end of file diff --git a/stripe/_discount.py b/stripe/_discount.py index 6a5f2c92a..6d6039065 100644 --- a/stripe/_discount.py +++ b/stripe/_discount.py @@ -71,6 +71,10 @@ class Source(StripeObject): """ The promotion code applied to create this discount. """ + schedule: Optional[str] + """ + The subscription schedule that this coupon is applied to, if it is applied to a particular subscription schedule. + """ source: Source start: int """ diff --git a/stripe/_invoice.py b/stripe/_invoice.py index b1d6a62f1..79d5a840c 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -740,6 +740,12 @@ class QuoteDetails(StripeObject): The quote that generated this invoice """ + class ScheduleDetails(StripeObject): + schedule: str + """ + The schedule that generated this invoice + """ + class SubscriptionDetails(StripeObject): class PauseCollection(StripeObject): behavior: Optional[ @@ -780,12 +786,19 @@ class PauseCollection(StripeObject): """ Details about the quote that generated this invoice """ + schedule_details: Optional[ScheduleDetails] + """ + Details about the schedule that generated this invoice + """ subscription_details: Optional[SubscriptionDetails] """ Details about the subscription that generated this invoice """ type: Literal[ - "billing_cadence_details", "quote_details", "subscription_details" + "billing_cadence_details", + "quote_details", + "schedule_details", + "subscription_details", ] """ The type of parent that generated this invoice @@ -793,6 +806,7 @@ class PauseCollection(StripeObject): _inner_class_types = { "billing_cadence_details": BillingCadenceDetails, "quote_details": QuoteDetails, + "schedule_details": ScheduleDetails, "subscription_details": SubscriptionDetails, } diff --git a/stripe/_invoice_item.py b/stripe/_invoice_item.py index d36ea5cac..86ac0b134 100644 --- a/stripe/_invoice_item.py +++ b/stripe/_invoice_item.py @@ -89,6 +89,12 @@ class RateCardSubscriptionDetails(StripeObject): The rate card version that generated this invoice item """ + class ScheduleDetails(StripeObject): + schedule: str + """ + The subscription schedule that generated this invoice item + """ + class SubscriptionDetails(StripeObject): subscription: str """ @@ -109,6 +115,10 @@ class SubscriptionDetails(StripeObject): """ Details about the rate card subscription that generated this invoice item """ + schedule_details: Optional[ScheduleDetails] + """ + Details about the subscription schedule that generated this invoice item + """ subscription_details: Optional[SubscriptionDetails] """ Details about the subscription that generated this invoice item @@ -116,6 +126,7 @@ class SubscriptionDetails(StripeObject): type: Literal[ "license_fee_subscription_details", "rate_card_subscription_details", + "schedule_details", "subscription_details", ] """ @@ -124,6 +135,7 @@ class SubscriptionDetails(StripeObject): _inner_class_types = { "license_fee_subscription_details": LicenseFeeSubscriptionDetails, "rate_card_subscription_details": RateCardSubscriptionDetails, + "schedule_details": ScheduleDetails, "subscription_details": SubscriptionDetails, } diff --git a/stripe/_invoice_line_item.py b/stripe/_invoice_line_item.py index acf5463f2..8d6eaa493 100644 --- a/stripe/_invoice_line_item.py +++ b/stripe/_invoice_line_item.py @@ -126,6 +126,12 @@ class RateCardSubscriptionDetails(StripeObject): The rate card version at the time this line item was generated """ + class ScheduleDetails(StripeObject): + schedule: str + """ + The subscription schedule that generated this line item + """ + class SubscriptionItemDetails(StripeObject): class ProrationDetails(StripeObject): class CreditedItems(StripeObject): @@ -180,6 +186,10 @@ class CreditedItems(StripeObject): """ Details about the rate card subscription that generated this line item """ + schedule_details: Optional[ScheduleDetails] + """ + Details about the subscription schedule that generated this line item + """ subscription_item_details: Optional[SubscriptionItemDetails] """ Details about the subscription item that generated this line item @@ -188,6 +198,7 @@ class CreditedItems(StripeObject): "invoice_item_details", "license_fee_subscription_details", "rate_card_subscription_details", + "schedule_details", "subscription_item_details", ] """ @@ -197,6 +208,7 @@ class CreditedItems(StripeObject): "invoice_item_details": InvoiceItemDetails, "license_fee_subscription_details": LicenseFeeSubscriptionDetails, "rate_card_subscription_details": RateCardSubscriptionDetails, + "schedule_details": ScheduleDetails, "subscription_item_details": SubscriptionItemDetails, } diff --git a/stripe/_issuing_service.py b/stripe/_issuing_service.py index eedcc8b11..8fb241672 100644 --- a/stripe/_issuing_service.py +++ b/stripe/_issuing_service.py @@ -22,6 +22,7 @@ PersonalizationDesignService, ) from stripe.issuing._physical_bundle_service import PhysicalBundleService + from stripe.issuing._program_service import ProgramService from stripe.issuing._token_service import TokenService from stripe.issuing._transaction_service import TransactionService @@ -53,6 +54,7 @@ "stripe.issuing._physical_bundle_service", "PhysicalBundleService", ], + "programs": ["stripe.issuing._program_service", "ProgramService"], "tokens": ["stripe.issuing._token_service", "TokenService"], "transactions": [ "stripe.issuing._transaction_service", @@ -71,6 +73,7 @@ class IssuingService(StripeService): fraud_liability_debits: "FraudLiabilityDebitService" personalization_designs: "PersonalizationDesignService" physical_bundles: "PhysicalBundleService" + programs: "ProgramService" tokens: "TokenService" transactions: "TransactionService" diff --git a/stripe/_object_classes.py b/stripe/_object_classes.py index 45917a17a..1a3c24992 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -212,6 +212,7 @@ "stripe.issuing._physical_bundle", "PhysicalBundle", ), + "issuing.program": ("stripe.issuing._program", "Program"), "issuing.settlement": ("stripe.issuing._settlement", "Settlement"), "issuing.token": ("stripe.issuing._token", "Token"), "issuing.transaction": ("stripe.issuing._transaction", "Transaction"), diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 18b51a7d3..3b6c0f4ad 100644 --- a/stripe/_quote_preview_invoice.py +++ b/stripe/_quote_preview_invoice.py @@ -698,6 +698,12 @@ class QuoteDetails(StripeObject): The quote that generated this invoice """ + class ScheduleDetails(StripeObject): + schedule: str + """ + The schedule that generated this invoice + """ + class SubscriptionDetails(StripeObject): class PauseCollection(StripeObject): behavior: Optional[ @@ -738,12 +744,19 @@ class PauseCollection(StripeObject): """ Details about the quote that generated this invoice """ + schedule_details: Optional[ScheduleDetails] + """ + Details about the schedule that generated this invoice + """ subscription_details: Optional[SubscriptionDetails] """ Details about the subscription that generated this invoice """ type: Literal[ - "billing_cadence_details", "quote_details", "subscription_details" + "billing_cadence_details", + "quote_details", + "schedule_details", + "subscription_details", ] """ The type of parent that generated this invoice @@ -751,6 +764,7 @@ class PauseCollection(StripeObject): _inner_class_types = { "billing_cadence_details": BillingCadenceDetails, "quote_details": QuoteDetails, + "schedule_details": ScheduleDetails, "subscription_details": SubscriptionDetails, } diff --git a/stripe/_quote_preview_subscription_schedule.py b/stripe/_quote_preview_subscription_schedule.py index e215bc847..4b6eaa94c 100644 --- a/stripe/_quote_preview_subscription_schedule.py +++ b/stripe/_quote_preview_subscription_schedule.py @@ -62,6 +62,160 @@ class Flexible(StripeObject): """ _inner_class_types = {"flexible": Flexible} + class BillingSchedule(StripeObject): + class AppliesTo(StripeObject): + price: Optional[ExpandableField["Price"]] + """ + The billing schedule will apply to the subscription item with the given price ID. + """ + type: Literal["price"] + """ + Controls which subscription items the billing schedule applies to. + """ + + class BillFrom(StripeObject): + class AmendmentStart(StripeObject): + index: int + """ + Use an index to specify the position of an amendment to start prebilling with. + """ + + class LineStartsAt(StripeObject): + id: str + """ + Unique identifier for the object. + """ + + class Relative(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing duration. Possible values are `day`, `week`, `month`, or `year`. + """ + interval_count: Optional[int] + """ + The multiplier applied to the interval. + """ + + amendment_start: Optional[AmendmentStart] + """ + Use an index to specify the position of an amendment to start prebilling with. + """ + computed_timestamp: Optional[int] + """ + The time the billing schedule applies from. + """ + line_starts_at: Optional[LineStartsAt] + """ + Lets you bill the period starting from a particular Quote line. + """ + relative: Optional[Relative] + """ + Timestamp is calculated from the request time. + """ + timestamp: Optional[int] + """ + Use a precise Unix timestamp for prebilling to start. Must be earlier than `bill_until`. + """ + type: Literal[ + "amendment_start", + "line_starts_at", + "now", + "pause_collection_start", + "quote_acceptance_date", + "relative", + "timestamp", + ] + """ + Describes how the billing schedule determines the start date. Possible values are `timestamp`, `relative`, `amendment_start`, `now`, `quote_acceptance_date`, `line_starts_at`, or `pause_collection_start`. + """ + _inner_class_types = { + "amendment_start": AmendmentStart, + "line_starts_at": LineStartsAt, + "relative": Relative, + } + + class BillUntil(StripeObject): + class AmendmentEnd(StripeObject): + index: int + """ + Use an index to specify the position of an amendment to end prebilling with. + """ + + class Duration(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: Optional[int] + """ + The multiplier applied to the interval. + """ + + class LineEndsAt(StripeObject): + id: str + """ + Unique identifier for the object. + """ + + amendment_end: Optional[AmendmentEnd] + """ + Use an index to specify the position of an amendment to end prebilling with. + """ + computed_timestamp: int + """ + The timestamp the billing schedule will apply until. + """ + duration: Optional[Duration] + """ + Specifies the billing period. + """ + line_ends_at: Optional[LineEndsAt] + """ + Lets you bill the period ending at a particular Quote line. + """ + timestamp: Optional[int] + """ + If specified, the billing schedule will apply until the specified timestamp. + """ + type: Literal[ + "amendment_end", + "duration", + "line_ends_at", + "schedule_end", + "timestamp", + "upcoming_invoice", + ] + """ + Describes how the billing schedule will determine the end date. Either `duration` or `timestamp`. + """ + _inner_class_types = { + "amendment_end": AmendmentEnd, + "duration": Duration, + "line_ends_at": LineEndsAt, + } + + applies_to: Optional[List[AppliesTo]] + """ + Specifies which subscription items the billing schedule applies to. + """ + bill_from: Optional[BillFrom] + """ + Specifies the start of the billing period. + """ + bill_until: BillUntil + """ + Specifies the billing period. + """ + key: str + """ + Unique identifier for the billing schedule. + """ + _inner_class_types = { + "applies_to": AppliesTo, + "bill_from": BillFrom, + "bill_until": BillUntil, + } + class CurrentPhase(StripeObject): end_date: int """ @@ -172,6 +326,12 @@ class TransferData(StripeObject): """ The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription. See the Connect documentation for details. """ + phase_effective_at: Optional[ + Literal["billing_period_start", "phase_start"] + ] + """ + Configures how the subscription schedule handles billing for phase transitions. Possible values are `phase_start` (default) or `billing_period_start`. `phase_start` bills based on the current state of the subscription, ignoring changes scheduled in future phases. `billing_period_start` bills predictively for upcoming phase transitions within the current billing cycle, including pricing changes and service period adjustments that will occur before the next invoice. + """ transfer_data: Optional[TransferData] """ The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. @@ -631,6 +791,10 @@ class Prebilling(StripeObject): """ The billing mode of the subscription. """ + billing_schedules: Optional[List[BillingSchedule]] + """ + Billing schedules for this subscription schedule. + """ canceled_at: Optional[int] """ Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. @@ -668,6 +832,10 @@ class Prebilling(StripeObject): """ Details of the most recent price migration that failed for the subscription schedule. """ + latest_invoice: Optional[ExpandableField["Invoice"]] + """ + The most recent invoice this subscription schedule has generated. + """ livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -713,6 +881,7 @@ class Prebilling(StripeObject): _inner_class_types = { "applies_to": AppliesTo, "billing_mode": BillingMode, + "billing_schedules": BillingSchedule, "current_phase": CurrentPhase, "default_settings": DefaultSettings, "last_price_migration_error": LastPriceMigrationError, diff --git a/stripe/_subscription_schedule.py b/stripe/_subscription_schedule.py index f01f99ed9..538fd28f6 100644 --- a/stripe/_subscription_schedule.py +++ b/stripe/_subscription_schedule.py @@ -84,6 +84,160 @@ class Flexible(StripeObject): """ _inner_class_types = {"flexible": Flexible} + class BillingSchedule(StripeObject): + class AppliesTo(StripeObject): + price: Optional[ExpandableField["Price"]] + """ + The billing schedule will apply to the subscription item with the given price ID. + """ + type: Literal["price"] + """ + Controls which subscription items the billing schedule applies to. + """ + + class BillFrom(StripeObject): + class AmendmentStart(StripeObject): + index: int + """ + Use an index to specify the position of an amendment to start prebilling with. + """ + + class LineStartsAt(StripeObject): + id: str + """ + Unique identifier for the object. + """ + + class Relative(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing duration. Possible values are `day`, `week`, `month`, or `year`. + """ + interval_count: Optional[int] + """ + The multiplier applied to the interval. + """ + + amendment_start: Optional[AmendmentStart] + """ + Use an index to specify the position of an amendment to start prebilling with. + """ + computed_timestamp: Optional[int] + """ + The time the billing schedule applies from. + """ + line_starts_at: Optional[LineStartsAt] + """ + Lets you bill the period starting from a particular Quote line. + """ + relative: Optional[Relative] + """ + Timestamp is calculated from the request time. + """ + timestamp: Optional[int] + """ + Use a precise Unix timestamp for prebilling to start. Must be earlier than `bill_until`. + """ + type: Literal[ + "amendment_start", + "line_starts_at", + "now", + "pause_collection_start", + "quote_acceptance_date", + "relative", + "timestamp", + ] + """ + Describes how the billing schedule determines the start date. Possible values are `timestamp`, `relative`, `amendment_start`, `now`, `quote_acceptance_date`, `line_starts_at`, or `pause_collection_start`. + """ + _inner_class_types = { + "amendment_start": AmendmentStart, + "line_starts_at": LineStartsAt, + "relative": Relative, + } + + class BillUntil(StripeObject): + class AmendmentEnd(StripeObject): + index: int + """ + Use an index to specify the position of an amendment to end prebilling with. + """ + + class Duration(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: Optional[int] + """ + The multiplier applied to the interval. + """ + + class LineEndsAt(StripeObject): + id: str + """ + Unique identifier for the object. + """ + + amendment_end: Optional[AmendmentEnd] + """ + Use an index to specify the position of an amendment to end prebilling with. + """ + computed_timestamp: int + """ + The timestamp the billing schedule will apply until. + """ + duration: Optional[Duration] + """ + Specifies the billing period. + """ + line_ends_at: Optional[LineEndsAt] + """ + Lets you bill the period ending at a particular Quote line. + """ + timestamp: Optional[int] + """ + If specified, the billing schedule will apply until the specified timestamp. + """ + type: Literal[ + "amendment_end", + "duration", + "line_ends_at", + "schedule_end", + "timestamp", + "upcoming_invoice", + ] + """ + Describes how the billing schedule will determine the end date. Either `duration` or `timestamp`. + """ + _inner_class_types = { + "amendment_end": AmendmentEnd, + "duration": Duration, + "line_ends_at": LineEndsAt, + } + + applies_to: Optional[List[AppliesTo]] + """ + Specifies which subscription items the billing schedule applies to. + """ + bill_from: Optional[BillFrom] + """ + Specifies the start of the billing period. + """ + bill_until: BillUntil + """ + Specifies the billing period. + """ + key: str + """ + Unique identifier for the billing schedule. + """ + _inner_class_types = { + "applies_to": AppliesTo, + "bill_from": BillFrom, + "bill_until": BillUntil, + } + class CurrentPhase(StripeObject): end_date: int """ @@ -194,6 +348,12 @@ class TransferData(StripeObject): """ The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription. See the Connect documentation for details. """ + phase_effective_at: Optional[ + Literal["billing_period_start", "phase_start"] + ] + """ + Configures how the subscription schedule handles billing for phase transitions. Possible values are `phase_start` (default) or `billing_period_start`. `phase_start` bills based on the current state of the subscription, ignoring changes scheduled in future phases. `billing_period_start` bills predictively for upcoming phase transitions within the current billing cycle, including pricing changes and service period adjustments that will occur before the next invoice. + """ transfer_data: Optional[TransferData] """ The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. @@ -652,6 +812,10 @@ class Prebilling(StripeObject): """ The billing mode of the subscription. """ + billing_schedules: Optional[List[BillingSchedule]] + """ + Billing schedules for this subscription schedule. + """ canceled_at: Optional[int] """ Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. @@ -689,6 +853,10 @@ class Prebilling(StripeObject): """ Details of the most recent price migration that failed for the subscription schedule. """ + latest_invoice: Optional[ExpandableField["Invoice"]] + """ + The most recent invoice this subscription schedule has generated. + """ livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -1200,6 +1368,7 @@ async def retrieve_async( _inner_class_types = { "billing_mode": BillingMode, + "billing_schedules": BillingSchedule, "current_phase": CurrentPhase, "default_settings": DefaultSettings, "last_price_migration_error": LastPriceMigrationError, diff --git a/stripe/delegated_checkout/_requested_session.py b/stripe/delegated_checkout/_requested_session.py index a0c75c77b..5f4bb4af7 100644 --- a/stripe/delegated_checkout/_requested_session.py +++ b/stripe/delegated_checkout/_requested_session.py @@ -273,6 +273,20 @@ class SellerDetails(StripeObject): pass class TotalDetails(StripeObject): + class ApplicableFee(StripeObject): + amount: int + """ + The amount of the applicable fee. + """ + description: Optional[str] + """ + The description of the applicable fee. + """ + display_name: str + """ + The display name of the applicable fee. + """ + amount_discount: Optional[int] """ The amount discount of the total details. @@ -285,6 +299,11 @@ class TotalDetails(StripeObject): """ The amount tax of the total details. """ + applicable_fees: Optional[List[ApplicableFee]] + """ + The applicable fees of the total details. + """ + _inner_class_types = {"applicable_fees": ApplicableFee} amount_subtotal: int """ diff --git a/stripe/issuing/__init__.py b/stripe/issuing/__init__.py index d26fff122..912c592ba 100644 --- a/stripe/issuing/__init__.py +++ b/stripe/issuing/__init__.py @@ -48,6 +48,10 @@ from stripe.issuing._physical_bundle_service import ( PhysicalBundleService as PhysicalBundleService, ) + from stripe.issuing._program import Program as Program + from stripe.issuing._program_service import ( + ProgramService as ProgramService, + ) from stripe.issuing._settlement import Settlement as Settlement from stripe.issuing._token import Token as Token from stripe.issuing._token_service import TokenService as TokenService @@ -97,6 +101,8 @@ "stripe.issuing._physical_bundle_service", False, ), + "Program": ("stripe.issuing._program", False), + "ProgramService": ("stripe.issuing._program_service", False), "Settlement": ("stripe.issuing._settlement", False), "Token": ("stripe.issuing._token", False), "TokenService": ("stripe.issuing._token_service", False), diff --git a/stripe/issuing/_program.py b/stripe/issuing/_program.py new file mode 100644 index 000000000..2579c70d1 --- /dev/null +++ b/stripe/issuing/_program.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._createable_api_resource import CreateableAPIResource +from stripe._list_object import ListObject +from stripe._listable_api_resource import ListableAPIResource +from stripe._updateable_api_resource import UpdateableAPIResource +from stripe._util import sanitize_id +from typing import ClassVar, Dict, Optional, cast +from typing_extensions import Literal, Unpack, TYPE_CHECKING + +if TYPE_CHECKING: + from stripe.params.issuing._program_create_params import ( + ProgramCreateParams, + ) + from stripe.params.issuing._program_list_params import ProgramListParams + from stripe.params.issuing._program_modify_params import ( + ProgramModifyParams, + ) + from stripe.params.issuing._program_retrieve_params import ( + ProgramRetrieveParams, + ) + + +class Program( + CreateableAPIResource["Program"], + ListableAPIResource["Program"], + UpdateableAPIResource["Program"], +): + """ + An Issuing `Program` represents a card program that the user has access to. + """ + + OBJECT_NAME: ClassVar[Literal["issuing.program"]] = "issuing.program" + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + id: str + """ + Unique identifier for the object. + """ + is_default: bool + """ + Whether or not this is the "default" issuing program new cards are created on. Only one active `is_default` program at the same time. + """ + metadata: Dict[str, str] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + """ + object: Literal["issuing.program"] + """ + String representing the object's type. Objects of the same type share the same value. + """ + platform_program: Optional[str] + """ + The platform's Issuing Program for which this program is associated. + """ + + @classmethod + def create(cls, **params: Unpack["ProgramCreateParams"]) -> "Program": + """ + Create a Program object. + """ + return cast( + "Program", + cls._static_request( + "post", + cls.class_url(), + params=params, + ), + ) + + @classmethod + async def create_async( + cls, **params: Unpack["ProgramCreateParams"] + ) -> "Program": + """ + Create a Program object. + """ + return cast( + "Program", + await cls._static_request_async( + "post", + cls.class_url(), + params=params, + ), + ) + + @classmethod + def list( + cls, **params: Unpack["ProgramListParams"] + ) -> ListObject["Program"]: + """ + List all of the programs the given Issuing user has access to. + """ + result = cls._static_request( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + async def list_async( + cls, **params: Unpack["ProgramListParams"] + ) -> ListObject["Program"]: + """ + List all of the programs the given Issuing user has access to. + """ + result = await cls._static_request_async( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + def modify( + cls, id: str, **params: Unpack["ProgramModifyParams"] + ) -> "Program": + """ + Updates a Program object. + """ + url = "%s/%s" % (cls.class_url(), sanitize_id(id)) + return cast( + "Program", + cls._static_request( + "post", + url, + params=params, + ), + ) + + @classmethod + async def modify_async( + cls, id: str, **params: Unpack["ProgramModifyParams"] + ) -> "Program": + """ + Updates a Program object. + """ + url = "%s/%s" % (cls.class_url(), sanitize_id(id)) + return cast( + "Program", + await cls._static_request_async( + "post", + url, + params=params, + ), + ) + + @classmethod + def retrieve( + cls, id: str, **params: Unpack["ProgramRetrieveParams"] + ) -> "Program": + """ + Retrieves the program specified by the given id. + """ + instance = cls(id, **params) + instance.refresh() + return instance + + @classmethod + async def retrieve_async( + cls, id: str, **params: Unpack["ProgramRetrieveParams"] + ) -> "Program": + """ + Retrieves the program specified by the given id. + """ + instance = cls(id, **params) + await instance.refresh_async() + return instance diff --git a/stripe/issuing/_program_service.py b/stripe/issuing/_program_service.py new file mode 100644 index 000000000..5915afb65 --- /dev/null +++ b/stripe/issuing/_program_service.py @@ -0,0 +1,187 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_service import StripeService +from stripe._util import sanitize_id +from typing import Optional, cast +from typing_extensions import TYPE_CHECKING + +if TYPE_CHECKING: + from stripe._list_object import ListObject + from stripe._request_options import RequestOptions + from stripe.issuing._program import Program + from stripe.params.issuing._program_create_params import ( + ProgramCreateParams, + ) + from stripe.params.issuing._program_list_params import ProgramListParams + from stripe.params.issuing._program_retrieve_params import ( + ProgramRetrieveParams, + ) + from stripe.params.issuing._program_update_params import ( + ProgramUpdateParams, + ) + + +class ProgramService(StripeService): + def list( + self, + params: Optional["ProgramListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[Program]": + """ + List all of the programs the given Issuing user has access to. + """ + return cast( + "ListObject[Program]", + self._request( + "get", + "/v1/issuing/programs", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + params: Optional["ProgramListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[Program]": + """ + List all of the programs the given Issuing user has access to. + """ + return cast( + "ListObject[Program]", + await self._request_async( + "get", + "/v1/issuing/programs", + base_address="api", + params=params, + options=options, + ), + ) + + def create( + self, + params: "ProgramCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "Program": + """ + Create a Program object. + """ + return cast( + "Program", + self._request( + "post", + "/v1/issuing/programs", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "ProgramCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "Program": + """ + Create a Program object. + """ + return cast( + "Program", + await self._request_async( + "post", + "/v1/issuing/programs", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + program: str, + params: Optional["ProgramRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "Program": + """ + Retrieves the program specified by the given id. + """ + return cast( + "Program", + self._request( + "get", + "/v1/issuing/programs/{program}".format( + program=sanitize_id(program), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + program: str, + params: Optional["ProgramRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "Program": + """ + Retrieves the program specified by the given id. + """ + return cast( + "Program", + await self._request_async( + "get", + "/v1/issuing/programs/{program}".format( + program=sanitize_id(program), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def update( + self, + program: str, + params: Optional["ProgramUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "Program": + """ + Updates a Program object. + """ + return cast( + "Program", + self._request( + "post", + "/v1/issuing/programs/{program}".format( + program=sanitize_id(program), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def update_async( + self, + program: str, + params: Optional["ProgramUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "Program": + """ + Updates a Program object. + """ + return cast( + "Program", + await self._request_async( + "post", + "/v1/issuing/programs/{program}".format( + program=sanitize_id(program), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/params/__init__.py b/stripe/params/__init__.py index 3b3a6089b..23d0bd0c0 100644 --- a/stripe/params/__init__.py +++ b/stripe/params/__init__.py @@ -1379,6 +1379,10 @@ InvoiceCreatePreviewParamsScheduleDetailsAmendmentTrialSettingsEndBehavior as InvoiceCreatePreviewParamsScheduleDetailsAmendmentTrialSettingsEndBehavior, InvoiceCreatePreviewParamsScheduleDetailsBillingMode as InvoiceCreatePreviewParamsScheduleDetailsBillingMode, InvoiceCreatePreviewParamsScheduleDetailsBillingModeFlexible as InvoiceCreatePreviewParamsScheduleDetailsBillingModeFlexible, + InvoiceCreatePreviewParamsScheduleDetailsBillingSchedule as InvoiceCreatePreviewParamsScheduleDetailsBillingSchedule, + InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleAppliesTo as InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleAppliesTo, + InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntil as InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntil, + InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntilDuration as InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntilDuration, InvoiceCreatePreviewParamsScheduleDetailsPhase as InvoiceCreatePreviewParamsScheduleDetailsPhase, InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItem as InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItem, InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemDiscount as InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemDiscount, @@ -4662,6 +4666,10 @@ SubscriptionScheduleCreateParams as SubscriptionScheduleCreateParams, SubscriptionScheduleCreateParamsBillingMode as SubscriptionScheduleCreateParamsBillingMode, SubscriptionScheduleCreateParamsBillingModeFlexible as SubscriptionScheduleCreateParamsBillingModeFlexible, + SubscriptionScheduleCreateParamsBillingSchedule as SubscriptionScheduleCreateParamsBillingSchedule, + SubscriptionScheduleCreateParamsBillingScheduleAppliesTo as SubscriptionScheduleCreateParamsBillingScheduleAppliesTo, + SubscriptionScheduleCreateParamsBillingScheduleBillUntil as SubscriptionScheduleCreateParamsBillingScheduleBillUntil, + SubscriptionScheduleCreateParamsBillingScheduleBillUntilDuration as SubscriptionScheduleCreateParamsBillingScheduleBillUntilDuration, SubscriptionScheduleCreateParamsDefaultSettings as SubscriptionScheduleCreateParamsDefaultSettings, SubscriptionScheduleCreateParamsDefaultSettingsAutomaticTax as SubscriptionScheduleCreateParamsDefaultSettingsAutomaticTax, SubscriptionScheduleCreateParamsDefaultSettingsAutomaticTaxLiability as SubscriptionScheduleCreateParamsDefaultSettingsAutomaticTaxLiability, @@ -4710,6 +4718,10 @@ ) from stripe.params._subscription_schedule_modify_params import ( SubscriptionScheduleModifyParams as SubscriptionScheduleModifyParams, + SubscriptionScheduleModifyParamsBillingSchedule as SubscriptionScheduleModifyParamsBillingSchedule, + SubscriptionScheduleModifyParamsBillingScheduleAppliesTo as SubscriptionScheduleModifyParamsBillingScheduleAppliesTo, + SubscriptionScheduleModifyParamsBillingScheduleBillUntil as SubscriptionScheduleModifyParamsBillingScheduleBillUntil, + SubscriptionScheduleModifyParamsBillingScheduleBillUntilDuration as SubscriptionScheduleModifyParamsBillingScheduleBillUntilDuration, SubscriptionScheduleModifyParamsDefaultSettings as SubscriptionScheduleModifyParamsDefaultSettings, SubscriptionScheduleModifyParamsDefaultSettingsAutomaticTax as SubscriptionScheduleModifyParamsDefaultSettingsAutomaticTax, SubscriptionScheduleModifyParamsDefaultSettingsAutomaticTaxLiability as SubscriptionScheduleModifyParamsDefaultSettingsAutomaticTaxLiability, @@ -4757,6 +4769,10 @@ ) from stripe.params._subscription_schedule_update_params import ( SubscriptionScheduleUpdateParams as SubscriptionScheduleUpdateParams, + SubscriptionScheduleUpdateParamsBillingSchedule as SubscriptionScheduleUpdateParamsBillingSchedule, + SubscriptionScheduleUpdateParamsBillingScheduleAppliesTo as SubscriptionScheduleUpdateParamsBillingScheduleAppliesTo, + SubscriptionScheduleUpdateParamsBillingScheduleBillUntil as SubscriptionScheduleUpdateParamsBillingScheduleBillUntil, + SubscriptionScheduleUpdateParamsBillingScheduleBillUntilDuration as SubscriptionScheduleUpdateParamsBillingScheduleBillUntilDuration, SubscriptionScheduleUpdateParamsDefaultSettings as SubscriptionScheduleUpdateParamsDefaultSettings, SubscriptionScheduleUpdateParamsDefaultSettingsAutomaticTax as SubscriptionScheduleUpdateParamsDefaultSettingsAutomaticTax, SubscriptionScheduleUpdateParamsDefaultSettingsAutomaticTaxLiability as SubscriptionScheduleUpdateParamsDefaultSettingsAutomaticTaxLiability, @@ -8883,6 +8899,22 @@ "stripe.params._invoice_create_preview_params", False, ), + "InvoiceCreatePreviewParamsScheduleDetailsBillingSchedule": ( + "stripe.params._invoice_create_preview_params", + False, + ), + "InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleAppliesTo": ( + "stripe.params._invoice_create_preview_params", + False, + ), + "InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntil": ( + "stripe.params._invoice_create_preview_params", + False, + ), + "InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntilDuration": ( + "stripe.params._invoice_create_preview_params", + False, + ), "InvoiceCreatePreviewParamsScheduleDetailsPhase": ( "stripe.params._invoice_create_preview_params", False, @@ -20013,6 +20045,22 @@ "stripe.params._subscription_schedule_create_params", False, ), + "SubscriptionScheduleCreateParamsBillingSchedule": ( + "stripe.params._subscription_schedule_create_params", + False, + ), + "SubscriptionScheduleCreateParamsBillingScheduleAppliesTo": ( + "stripe.params._subscription_schedule_create_params", + False, + ), + "SubscriptionScheduleCreateParamsBillingScheduleBillUntil": ( + "stripe.params._subscription_schedule_create_params", + False, + ), + "SubscriptionScheduleCreateParamsBillingScheduleBillUntilDuration": ( + "stripe.params._subscription_schedule_create_params", + False, + ), "SubscriptionScheduleCreateParamsDefaultSettings": ( "stripe.params._subscription_schedule_create_params", False, @@ -20189,6 +20237,22 @@ "stripe.params._subscription_schedule_modify_params", False, ), + "SubscriptionScheduleModifyParamsBillingSchedule": ( + "stripe.params._subscription_schedule_modify_params", + False, + ), + "SubscriptionScheduleModifyParamsBillingScheduleAppliesTo": ( + "stripe.params._subscription_schedule_modify_params", + False, + ), + "SubscriptionScheduleModifyParamsBillingScheduleBillUntil": ( + "stripe.params._subscription_schedule_modify_params", + False, + ), + "SubscriptionScheduleModifyParamsBillingScheduleBillUntilDuration": ( + "stripe.params._subscription_schedule_modify_params", + False, + ), "SubscriptionScheduleModifyParamsDefaultSettings": ( "stripe.params._subscription_schedule_modify_params", False, @@ -20353,6 +20417,22 @@ "stripe.params._subscription_schedule_update_params", False, ), + "SubscriptionScheduleUpdateParamsBillingSchedule": ( + "stripe.params._subscription_schedule_update_params", + False, + ), + "SubscriptionScheduleUpdateParamsBillingScheduleAppliesTo": ( + "stripe.params._subscription_schedule_update_params", + False, + ), + "SubscriptionScheduleUpdateParamsBillingScheduleBillUntil": ( + "stripe.params._subscription_schedule_update_params", + False, + ), + "SubscriptionScheduleUpdateParamsBillingScheduleBillUntilDuration": ( + "stripe.params._subscription_schedule_update_params", + False, + ), "SubscriptionScheduleUpdateParamsDefaultSettings": ( "stripe.params._subscription_schedule_update_params", False, diff --git a/stripe/params/_invoice_create_preview_params.py b/stripe/params/_invoice_create_preview_params.py index e615dae76..70fd956da 100644 --- a/stripe/params/_invoice_create_preview_params.py +++ b/stripe/params/_invoice_create_preview_params.py @@ -576,6 +576,12 @@ class InvoiceCreatePreviewParamsScheduleDetails(TypedDict): """ In cases where the `schedule_details` params update the currently active phase, specifies if and how to prorate at the time of the request. """ + billing_schedules: NotRequired[ + List["InvoiceCreatePreviewParamsScheduleDetailsBillingSchedule"] + ] + """ + Sets the billing schedules for the subscription schedule. + """ class InvoiceCreatePreviewParamsScheduleDetailsAmendment(TypedDict): @@ -1844,6 +1850,79 @@ class InvoiceCreatePreviewParamsScheduleDetailsPrebillingBillUntilDuration( """ +class InvoiceCreatePreviewParamsScheduleDetailsBillingSchedule(TypedDict): + applies_to: NotRequired[ + List[ + "InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleAppliesTo" + ] + ] + """ + Configure billing schedule differently for individual subscription items. + """ + bill_until: NotRequired[ + "InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntil" + ] + """ + The end date for the billing schedule. + """ + key: NotRequired[str] + """ + Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up to 200 characters. If not provided, a unique key will be generated. + """ + + +class InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleAppliesTo( + TypedDict, +): + price: NotRequired[str] + """ + The ID of the price object. + """ + type: Literal["price"] + """ + Controls which subscription items the billing schedule applies to. + """ + + +class InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntil( + TypedDict, +): + duration: NotRequired[ + "InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntilDuration" + ] + """ + Specifies the billing period. + """ + timestamp: NotRequired[int] + """ + The end date of the billing schedule. + """ + type: Literal[ + "amendment_end", + "duration", + "line_ends_at", + "schedule_end", + "timestamp", + "upcoming_invoice", + ] + """ + Describes how the billing schedule will determine the end date. Either `duration` or `timestamp`. + """ + + +class InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntilDuration( + TypedDict, +): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ + + class InvoiceCreatePreviewParamsSubscriptionDetails(TypedDict): billing_cycle_anchor: NotRequired["Literal['now', 'unchanged']|int"] """ diff --git a/stripe/params/_subscription_schedule_create_params.py b/stripe/params/_subscription_schedule_create_params.py index 2a5b422c2..f894d83df 100644 --- a/stripe/params/_subscription_schedule_create_params.py +++ b/stripe/params/_subscription_schedule_create_params.py @@ -58,6 +58,12 @@ class SubscriptionScheduleCreateParams(RequestOptions): """ When the subscription schedule starts. We recommend using `now` so that it starts the subscription immediately. You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on. """ + billing_schedules: NotRequired[ + List["SubscriptionScheduleCreateParamsBillingSchedule"] + ] + """ + Sets the billing schedules for the subscription schedule. + """ class SubscriptionScheduleCreateParamsBillingMode(TypedDict): @@ -131,6 +137,12 @@ class SubscriptionScheduleCreateParamsDefaultSettings(TypedDict): """ The data with which to automatically create a Transfer for each of the associated subscription's invoices. """ + phase_effective_at: NotRequired[ + Literal["billing_period_start", "phase_start"] + ] + """ + Configures how the subscription schedule handles billing for phase transitions. Possible values are `phase_start` (default) or `billing_period_start`. `phase_start` bills based on the current state of the subscription, ignoring changes scheduled in future phases. `billing_period_start` bills predictively for upcoming phase transitions within the current billing cycle, including pricing changes and service period adjustments that will occur before the next invoice. + """ class SubscriptionScheduleCreateParamsDefaultSettingsAutomaticTax(TypedDict): @@ -802,3 +814,68 @@ class SubscriptionScheduleCreateParamsPrebilling(TypedDict): """ Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. The default value is `reset`. """ + + +class SubscriptionScheduleCreateParamsBillingSchedule(TypedDict): + applies_to: NotRequired[ + List["SubscriptionScheduleCreateParamsBillingScheduleAppliesTo"] + ] + """ + Configure billing schedule differently for individual subscription items. + """ + bill_until: "SubscriptionScheduleCreateParamsBillingScheduleBillUntil" + """ + The end date for the billing schedule. + """ + key: NotRequired[str] + """ + Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up to 200 characters. If not provided, a unique key will be generated. + """ + + +class SubscriptionScheduleCreateParamsBillingScheduleAppliesTo(TypedDict): + price: NotRequired[str] + """ + The ID of the price object. + """ + type: Literal["price"] + """ + Controls which subscription items the billing schedule applies to. + """ + + +class SubscriptionScheduleCreateParamsBillingScheduleBillUntil(TypedDict): + duration: NotRequired[ + "SubscriptionScheduleCreateParamsBillingScheduleBillUntilDuration" + ] + """ + Specifies the billing period. + """ + timestamp: NotRequired[int] + """ + The end date of the billing schedule. + """ + type: Literal[ + "amendment_end", + "duration", + "line_ends_at", + "schedule_end", + "timestamp", + "upcoming_invoice", + ] + """ + Describes how the billing schedule will determine the end date. Either `duration` or `timestamp`. + """ + + +class SubscriptionScheduleCreateParamsBillingScheduleBillUntilDuration( + TypedDict, +): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ diff --git a/stripe/params/_subscription_schedule_modify_params.py b/stripe/params/_subscription_schedule_modify_params.py index 5f49a3d02..e712be237 100644 --- a/stripe/params/_subscription_schedule_modify_params.py +++ b/stripe/params/_subscription_schedule_modify_params.py @@ -44,6 +44,12 @@ class SubscriptionScheduleModifyParams(RequestOptions): """ If the update changes the billing configuration (item price, quantity, etc.) of the current phase, indicates how prorations from this change should be handled. The default value is `create_prorations`. """ + billing_schedules: NotRequired[ + List["SubscriptionScheduleModifyParamsBillingSchedule"] + ] + """ + Sets the billing schedules for the subscription schedule. + """ class SubscriptionScheduleModifyParamsDefaultSettings(TypedDict): @@ -97,6 +103,12 @@ class SubscriptionScheduleModifyParamsDefaultSettings(TypedDict): """ The data with which to automatically create a Transfer for each of the associated subscription's invoices. """ + phase_effective_at: NotRequired[ + Literal["billing_period_start", "phase_start"] + ] + """ + Configures how the subscription schedule handles billing for phase transitions. Possible values are `phase_start` (default) or `billing_period_start`. `phase_start` bills based on the current state of the subscription, ignoring changes scheduled in future phases. `billing_period_start` bills predictively for upcoming phase transitions within the current billing cycle, including pricing changes and service period adjustments that will occur before the next invoice. + """ class SubscriptionScheduleModifyParamsDefaultSettingsAutomaticTax(TypedDict): @@ -772,3 +784,70 @@ class SubscriptionScheduleModifyParamsPrebilling(TypedDict): """ Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. The default value is `reset`. """ + + +class SubscriptionScheduleModifyParamsBillingSchedule(TypedDict): + applies_to: NotRequired[ + List["SubscriptionScheduleModifyParamsBillingScheduleAppliesTo"] + ] + """ + Configure billing schedule differently for individual subscription items. + """ + bill_until: NotRequired[ + "SubscriptionScheduleModifyParamsBillingScheduleBillUntil" + ] + """ + The end date for the billing schedule. + """ + key: NotRequired[str] + """ + Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up to 200 characters. If not provided, a unique key will be generated. + """ + + +class SubscriptionScheduleModifyParamsBillingScheduleAppliesTo(TypedDict): + price: NotRequired[str] + """ + The ID of the price object. + """ + type: Literal["price"] + """ + Controls which subscription items the billing schedule applies to. + """ + + +class SubscriptionScheduleModifyParamsBillingScheduleBillUntil(TypedDict): + duration: NotRequired[ + "SubscriptionScheduleModifyParamsBillingScheduleBillUntilDuration" + ] + """ + Specifies the billing period. + """ + timestamp: NotRequired[int] + """ + The end date of the billing schedule. + """ + type: Literal[ + "amendment_end", + "duration", + "line_ends_at", + "schedule_end", + "timestamp", + "upcoming_invoice", + ] + """ + Describes how the billing schedule will determine the end date. Either `duration` or `timestamp`. + """ + + +class SubscriptionScheduleModifyParamsBillingScheduleBillUntilDuration( + TypedDict, +): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ diff --git a/stripe/params/_subscription_schedule_update_params.py b/stripe/params/_subscription_schedule_update_params.py index 2cb948e36..a5f935d56 100644 --- a/stripe/params/_subscription_schedule_update_params.py +++ b/stripe/params/_subscription_schedule_update_params.py @@ -43,6 +43,12 @@ class SubscriptionScheduleUpdateParams(TypedDict): """ If the update changes the billing configuration (item price, quantity, etc.) of the current phase, indicates how prorations from this change should be handled. The default value is `create_prorations`. """ + billing_schedules: NotRequired[ + List["SubscriptionScheduleUpdateParamsBillingSchedule"] + ] + """ + Sets the billing schedules for the subscription schedule. + """ class SubscriptionScheduleUpdateParamsDefaultSettings(TypedDict): @@ -96,6 +102,12 @@ class SubscriptionScheduleUpdateParamsDefaultSettings(TypedDict): """ The data with which to automatically create a Transfer for each of the associated subscription's invoices. """ + phase_effective_at: NotRequired[ + Literal["billing_period_start", "phase_start"] + ] + """ + Configures how the subscription schedule handles billing for phase transitions. Possible values are `phase_start` (default) or `billing_period_start`. `phase_start` bills based on the current state of the subscription, ignoring changes scheduled in future phases. `billing_period_start` bills predictively for upcoming phase transitions within the current billing cycle, including pricing changes and service period adjustments that will occur before the next invoice. + """ class SubscriptionScheduleUpdateParamsDefaultSettingsAutomaticTax(TypedDict): @@ -771,3 +783,70 @@ class SubscriptionScheduleUpdateParamsPrebilling(TypedDict): """ Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. The default value is `reset`. """ + + +class SubscriptionScheduleUpdateParamsBillingSchedule(TypedDict): + applies_to: NotRequired[ + List["SubscriptionScheduleUpdateParamsBillingScheduleAppliesTo"] + ] + """ + Configure billing schedule differently for individual subscription items. + """ + bill_until: NotRequired[ + "SubscriptionScheduleUpdateParamsBillingScheduleBillUntil" + ] + """ + The end date for the billing schedule. + """ + key: NotRequired[str] + """ + Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up to 200 characters. If not provided, a unique key will be generated. + """ + + +class SubscriptionScheduleUpdateParamsBillingScheduleAppliesTo(TypedDict): + price: NotRequired[str] + """ + The ID of the price object. + """ + type: Literal["price"] + """ + Controls which subscription items the billing schedule applies to. + """ + + +class SubscriptionScheduleUpdateParamsBillingScheduleBillUntil(TypedDict): + duration: NotRequired[ + "SubscriptionScheduleUpdateParamsBillingScheduleBillUntilDuration" + ] + """ + Specifies the billing period. + """ + timestamp: NotRequired[int] + """ + The end date of the billing schedule. + """ + type: Literal[ + "amendment_end", + "duration", + "line_ends_at", + "schedule_end", + "timestamp", + "upcoming_invoice", + ] + """ + Describes how the billing schedule will determine the end date. Either `duration` or `timestamp`. + """ + + +class SubscriptionScheduleUpdateParamsBillingScheduleBillUntilDuration( + TypedDict, +): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ diff --git a/stripe/params/issuing/__init__.py b/stripe/params/issuing/__init__.py index a54258606..d38154cfe 100644 --- a/stripe/params/issuing/__init__.py +++ b/stripe/params/issuing/__init__.py @@ -316,6 +316,21 @@ from stripe.params.issuing._physical_bundle_retrieve_params import ( PhysicalBundleRetrieveParams as PhysicalBundleRetrieveParams, ) + from stripe.params.issuing._program_create_params import ( + ProgramCreateParams as ProgramCreateParams, + ) + from stripe.params.issuing._program_list_params import ( + ProgramListParams as ProgramListParams, + ) + from stripe.params.issuing._program_modify_params import ( + ProgramModifyParams as ProgramModifyParams, + ) + from stripe.params.issuing._program_retrieve_params import ( + ProgramRetrieveParams as ProgramRetrieveParams, + ) + from stripe.params.issuing._program_update_params import ( + ProgramUpdateParams as ProgramUpdateParams, + ) from stripe.params.issuing._token_list_params import ( TokenListParams as TokenListParams, TokenListParamsCreated as TokenListParamsCreated, @@ -1181,6 +1196,23 @@ "stripe.params.issuing._physical_bundle_retrieve_params", False, ), + "ProgramCreateParams": ( + "stripe.params.issuing._program_create_params", + False, + ), + "ProgramListParams": ("stripe.params.issuing._program_list_params", False), + "ProgramModifyParams": ( + "stripe.params.issuing._program_modify_params", + False, + ), + "ProgramRetrieveParams": ( + "stripe.params.issuing._program_retrieve_params", + False, + ), + "ProgramUpdateParams": ( + "stripe.params.issuing._program_update_params", + False, + ), "TokenListParams": ("stripe.params.issuing._token_list_params", False), "TokenListParamsCreated": ( "stripe.params.issuing._token_list_params", diff --git a/stripe/params/issuing/_program_create_params.py b/stripe/params/issuing/_program_create_params.py new file mode 100644 index 000000000..f8cee60e5 --- /dev/null +++ b/stripe/params/issuing/_program_create_params.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from typing import List +from typing_extensions import NotRequired + + +class ProgramCreateParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + is_default: NotRequired[bool] + """ + If true, makes the specified program the default for the given account. + """ + platform_program: str + """ + The program to use as the parent for the new program to create. + """ diff --git a/stripe/params/issuing/_program_list_params.py b/stripe/params/issuing/_program_list_params.py new file mode 100644 index 000000000..ecc5dd37e --- /dev/null +++ b/stripe/params/issuing/_program_list_params.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from typing import List +from typing_extensions import NotRequired + + +class ProgramListParams(RequestOptions): + ending_before: NotRequired[str] + """ + A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + limit: NotRequired[int] + """ + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + """ + starting_after: NotRequired[str] + """ + A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + """ diff --git a/stripe/params/issuing/_program_modify_params.py b/stripe/params/issuing/_program_modify_params.py new file mode 100644 index 000000000..2b252a3f0 --- /dev/null +++ b/stripe/params/issuing/_program_modify_params.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from typing import Dict, List +from typing_extensions import Literal, NotRequired + + +class ProgramModifyParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + is_default: NotRequired[bool] + """ + If true, makes the specified program the default. + """ + metadata: NotRequired["Literal['']|Dict[str, str]"] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ diff --git a/stripe/params/issuing/_program_retrieve_params.py b/stripe/params/issuing/_program_retrieve_params.py new file mode 100644 index 000000000..2fbd77286 --- /dev/null +++ b/stripe/params/issuing/_program_retrieve_params.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from typing import List +from typing_extensions import NotRequired + + +class ProgramRetrieveParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ diff --git a/stripe/params/issuing/_program_update_params.py b/stripe/params/issuing/_program_update_params.py new file mode 100644 index 000000000..8b2a8cf60 --- /dev/null +++ b/stripe/params/issuing/_program_update_params.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import Dict, List +from typing_extensions import Literal, NotRequired, TypedDict + + +class ProgramUpdateParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + is_default: NotRequired[bool] + """ + If true, makes the specified program the default. + """ + metadata: NotRequired["Literal['']|Dict[str, str]"] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """