From 4fe269b0fb463695170d3b3d4b8964b9ebfafe64 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein <52928443+richardm-stripe@users.noreply.github.com> Date: Thu, 26 Oct 2023 09:29:48 -0700 Subject: [PATCH] Inner resource classes (#1103) --- stripe/api_resources/account.py | 988 +++++++++- stripe/api_resources/account_session.py | 15 +- stripe/api_resources/apps/secret.py | 15 +- stripe/api_resources/balance.py | 156 +- stripe/api_resources/balance_transaction.py | 27 +- stripe/api_resources/bank_account.py | 250 ++- .../billing_portal/configuration.py | 159 +- .../api_resources/billing_portal/session.py | 138 +- stripe/api_resources/capability.py | 310 ++- stripe/api_resources/cash_balance.py | 15 +- stripe/api_resources/charge.py | 1599 +++++++++++++++- stripe/api_resources/checkout/session.py | 1381 +++++++++++++- stripe/api_resources/country_spec.py | 30 +- stripe/api_resources/coupon.py | 22 +- stripe/api_resources/credit_note.py | 127 +- stripe/api_resources/credit_note_line_item.py | 62 +- stripe/api_resources/customer.py | 162 +- .../customer_cash_balance_transaction.py | 132 +- stripe/api_resources/dispute.py | 163 +- stripe/api_resources/event.py | 29 +- .../financial_connections/account.py | 95 +- .../financial_connections/session.py | 36 +- stripe/api_resources/funding_instructions.py | 132 +- .../identity/verification_report.py | 282 ++- .../identity/verification_session.py | 145 +- stripe/api_resources/invoice.py | 902 ++++++++- stripe/api_resources/invoice_item.py | 15 +- stripe/api_resources/invoice_line_item.py | 93 +- stripe/api_resources/issuing/authorization.py | 220 ++- stripe/api_resources/issuing/card.py | 1083 ++++++++++- stripe/api_resources/issuing/cardholder.py | 1109 ++++++++++- stripe/api_resources/issuing/dispute.py | 214 ++- stripe/api_resources/issuing/token.py | 170 +- stripe/api_resources/issuing/transaction.py | 197 +- stripe/api_resources/line_item.py | 60 +- stripe/api_resources/mandate.py | 153 +- stripe/api_resources/payment_intent.py | 1675 ++++++++++++++++- stripe/api_resources/payment_link.py | 566 +++++- stripe/api_resources/payment_method.py | 1046 +++++++++- .../payment_method_configuration.py | 929 ++++++++- stripe/api_resources/payment_method_domain.py | 84 +- stripe/api_resources/person.py | 553 +++++- stripe/api_resources/plan.py | 39 +- stripe/api_resources/price.py | 153 +- stripe/api_resources/product.py | 34 +- stripe/api_resources/promotion_code.py | 31 +- stripe/api_resources/quote.py | 380 +++- stripe/api_resources/refund.py | 34 +- stripe/api_resources/reporting/report_run.py | 39 +- stripe/api_resources/review.py | 50 +- stripe/api_resources/setup_attempt.py | 617 +++++- stripe/api_resources/setup_intent.py | 552 +++++- stripe/api_resources/shipping_rate.py | 67 +- .../sigma/scheduled_query_run.py | 11 +- stripe/api_resources/source.py | 524 +++++- .../source_mandate_notification.py | 39 +- stripe/api_resources/source_transaction.py | 113 +- stripe/api_resources/subscription.py | 344 +++- stripe/api_resources/subscription_item.py | 11 +- stripe/api_resources/subscription_schedule.py | 278 ++- stripe/api_resources/tax/calculation.py | 328 +++- .../tax/calculation_line_item.py | 93 +- stripe/api_resources/tax/settings.py | 69 +- stripe/api_resources/tax/transaction.py | 265 ++- .../tax/transaction_line_item.py | 11 +- stripe/api_resources/tax_id.py | 19 +- .../api_resources/terminal/configuration.py | 266 ++- stripe/api_resources/terminal/location.py | 31 +- stripe/api_resources/terminal/reader.py | 180 +- .../api_resources/treasury/credit_reversal.py | 11 +- .../api_resources/treasury/debit_reversal.py | 22 +- .../treasury/financial_account.py | 92 +- .../treasury/financial_account_features.py | 480 ++++- .../treasury/inbound_transfer.py | 136 +- .../treasury/outbound_payment.py | 159 +- .../treasury/outbound_transfer.py | 132 +- .../api_resources/treasury/received_credit.py | 180 +- .../api_resources/treasury/received_debit.py | 139 +- stripe/api_resources/treasury/transaction.py | 103 +- .../treasury/transaction_entry.py | 90 +- stripe/api_resources/usage_record_summary.py | 15 +- stripe/stripe_object.py | 52 +- stripe/util.py | 6 + 83 files changed, 21326 insertions(+), 408 deletions(-) diff --git a/stripe/api_resources/account.py b/stripe/api_resources/account.py index f47132f72..fc6d26390 100644 --- a/stripe/api_resources/account.py +++ b/stripe/api_resources/account.py @@ -8,6 +8,7 @@ UpdateableAPIResource, nested_resource_class_methods, ) +from stripe.api_resources.expandable_field import ExpandableField from stripe.api_resources.list_object import ListObject from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject @@ -26,6 +27,7 @@ from stripe.api_resources.bank_account import BankAccount from stripe.api_resources.capability import Capability from stripe.api_resources.card import Card + from stripe.api_resources.file import File from stripe.api_resources.login_link import LoginLink from stripe.api_resources.person import Person @@ -52,6 +54,965 @@ class Account( """ OBJECT_NAME: ClassVar[Literal["account"]] = "account" + + class BusinessProfile(StripeObject): + class MonthlyEstimatedRevenue(StripeObject): + amount: int + """ + A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + 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). + """ + + class SupportAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + mcc: Optional[str] + """ + [The merchant category code for the account](https://stripe.com/docs/connect/setting-mcc). MCCs are used to classify businesses based on the goods or services they provide. + """ + monthly_estimated_revenue: Optional[MonthlyEstimatedRevenue] + name: Optional[str] + """ + The customer-facing business name. + """ + product_description: Optional[str] + """ + Internal-only description of the product sold or service provided by the business. It's used by Stripe for risk and underwriting purposes. + """ + support_address: Optional[SupportAddress] + """ + A publicly available mailing address for sending support issues to. + """ + support_email: Optional[str] + """ + A publicly available email address for sending support issues to. + """ + support_phone: Optional[str] + """ + A publicly available phone number to call with support issues. + """ + support_url: Optional[str] + """ + A publicly available website for handling support issues. + """ + url: Optional[str] + """ + The business's publicly available website. + """ + _inner_class_types = { + "monthly_estimated_revenue": MonthlyEstimatedRevenue, + "support_address": SupportAddress, + } + + class Capabilities(StripeObject): + acss_debit_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the Canadian pre-authorized debits payments capability of the account, or whether the account can directly process Canadian pre-authorized debits charges. + """ + affirm_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the Affirm capability of the account, or whether the account can directly process Affirm charges. + """ + afterpay_clearpay_payments: Optional[ + Literal["active", "inactive", "pending"] + ] + """ + The status of the Afterpay Clearpay capability of the account, or whether the account can directly process Afterpay Clearpay charges. + """ + au_becs_debit_payments: Optional[ + Literal["active", "inactive", "pending"] + ] + """ + The status of the BECS Direct Debit (AU) payments capability of the account, or whether the account can directly process BECS Direct Debit (AU) charges. + """ + bacs_debit_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the Bacs Direct Debits payments capability of the account, or whether the account can directly process Bacs Direct Debits charges. + """ + bancontact_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the Bancontact payments capability of the account, or whether the account can directly process Bancontact charges. + """ + bank_transfer_payments: Optional[ + Literal["active", "inactive", "pending"] + ] + """ + The status of the customer_balance payments capability of the account, or whether the account can directly process customer_balance charges. + """ + blik_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the blik payments capability of the account, or whether the account can directly process blik charges. + """ + boleto_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the boleto payments capability of the account, or whether the account can directly process boleto charges. + """ + card_issuing: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the card issuing capability of the account, or whether you can use Issuing to distribute funds on cards + """ + card_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the card payments capability of the account, or whether the account can directly process credit and debit card charges. + """ + cartes_bancaires_payments: Optional[ + Literal["active", "inactive", "pending"] + ] + """ + The status of the Cartes Bancaires payments capability of the account, or whether the account can directly process Cartes Bancaires card charges in EUR currency. + """ + cashapp_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the Cash App Pay capability of the account, or whether the account can directly process Cash App Pay payments. + """ + eps_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the EPS payments capability of the account, or whether the account can directly process EPS charges. + """ + fpx_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the FPX payments capability of the account, or whether the account can directly process FPX charges. + """ + giropay_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the giropay payments capability of the account, or whether the account can directly process giropay charges. + """ + grabpay_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the GrabPay payments capability of the account, or whether the account can directly process GrabPay charges. + """ + ideal_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the iDEAL payments capability of the account, or whether the account can directly process iDEAL charges. + """ + india_international_payments: Optional[ + Literal["active", "inactive", "pending"] + ] + """ + The status of the india_international_payments capability of the account, or whether the account can process international charges (non INR) in India. + """ + jcb_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the JCB payments capability of the account, or whether the account (Japan only) can directly process JCB credit card charges in JPY currency. + """ + klarna_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the Klarna payments capability of the account, or whether the account can directly process Klarna charges. + """ + konbini_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the konbini payments capability of the account, or whether the account can directly process konbini charges. + """ + legacy_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the legacy payments capability of the account. + """ + link_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the link_payments capability of the account, or whether the account can directly process Link charges. + """ + oxxo_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the OXXO payments capability of the account, or whether the account can directly process OXXO charges. + """ + p24_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the P24 payments capability of the account, or whether the account can directly process P24 charges. + """ + paynow_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the paynow payments capability of the account, or whether the account can directly process paynow charges. + """ + promptpay_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges. + """ + sepa_debit_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the SEPA Direct Debits payments capability of the account, or whether the account can directly process SEPA Direct Debits charges. + """ + sofort_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the Sofort payments capability of the account, or whether the account can directly process Sofort charges. + """ + tax_reporting_us_1099_k: Optional[ + Literal["active", "inactive", "pending"] + ] + """ + The status of the tax reporting 1099-K (US) capability of the account. + """ + tax_reporting_us_1099_misc: Optional[ + Literal["active", "inactive", "pending"] + ] + """ + The status of the tax reporting 1099-MISC (US) capability of the account. + """ + transfers: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the transfers capability of the account, or whether your platform can transfer funds to the account. + """ + treasury: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the banking capability, or whether the account can have bank accounts. + """ + us_bank_account_ach_payments: Optional[ + Literal["active", "inactive", "pending"] + ] + """ + The status of the US bank account ACH payments capability of the account, or whether the account can directly process US bank account charges. + """ + zip_payments: Optional[Literal["active", "inactive", "pending"]] + """ + The status of the Zip capability of the account, or whether the account can directly process Zip charges. + """ + + class Company(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class AddressKana(StripeObject): + city: Optional[str] + """ + City/Ward. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Block/Building number. + """ + line2: Optional[str] + """ + Building details. + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + Prefecture. + """ + town: Optional[str] + """ + Town/cho-me. + """ + + class AddressKanji(StripeObject): + city: Optional[str] + """ + City/Ward. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Block/Building number. + """ + line2: Optional[str] + """ + Building details. + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + Prefecture. + """ + town: Optional[str] + """ + Town/cho-me. + """ + + class OwnershipDeclaration(StripeObject): + date: Optional[int] + """ + The Unix timestamp marking when the beneficial owner attestation was made. + """ + ip: Optional[str] + """ + The IP address from which the beneficial owner attestation was made. + """ + user_agent: Optional[str] + """ + The user-agent string from the browser where the beneficial owner attestation was made. + """ + + class Verification(StripeObject): + class Document(StripeObject): + back: Optional[ExpandableField["File"]] + """ + The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. + """ + details: Optional[str] + """ + A user-displayable string describing the verification state of this document. + """ + details_code: Optional[str] + """ + One of `document_corrupt`, `document_expired`, `document_failed_copy`, `document_failed_greyscale`, `document_failed_other`, `document_failed_test_mode`, `document_fraudulent`, `document_incomplete`, `document_invalid`, `document_manipulated`, `document_not_readable`, `document_not_uploaded`, `document_type_not_supported`, or `document_too_large`. A machine-readable code specifying the verification state for this document. + """ + front: Optional[ExpandableField["File"]] + """ + The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. + """ + + document: Document + _inner_class_types = {"document": Document} + + address: Optional[Address] + address_kana: Optional[AddressKana] + """ + The Kana variation of the company's primary address (Japan only). + """ + address_kanji: Optional[AddressKanji] + """ + The Kanji variation of the company's primary address (Japan only). + """ + directors_provided: Optional[bool] + """ + Whether the company's directors have been provided. This Boolean will be `true` if you've manually indicated that all directors are provided via [the `directors_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-directors_provided). + """ + executives_provided: Optional[bool] + """ + Whether the company's executives have been provided. This Boolean will be `true` if you've manually indicated that all executives are provided via [the `executives_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-executives_provided), or if Stripe determined that sufficient executives were provided. + """ + export_license_id: Optional[str] + """ + The export license ID number of the company, also referred as Import Export Code (India only). + """ + export_purpose_code: Optional[str] + """ + The purpose code to use for export transactions (India only). + """ + name: Optional[str] + """ + The company's legal name. + """ + name_kana: Optional[str] + """ + The Kana variation of the company's legal name (Japan only). + """ + name_kanji: Optional[str] + """ + The Kanji variation of the company's legal name (Japan only). + """ + owners_provided: Optional[bool] + """ + Whether the company's owners have been provided. This Boolean will be `true` if you've manually indicated that all owners are provided via [the `owners_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-owners_provided), or if Stripe determined that sufficient owners were provided. Stripe determines ownership requirements using both the number of owners provided and their total percent ownership (calculated by adding the `percent_ownership` of each owner together). + """ + ownership_declaration: Optional[OwnershipDeclaration] + """ + This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. + """ + phone: Optional[str] + """ + The company's phone number (used for verification). + """ + structure: Optional[ + Literal[ + "free_zone_establishment", + "free_zone_llc", + "government_instrumentality", + "governmental_unit", + "incorporated_non_profit", + "incorporated_partnership", + "limited_liability_partnership", + "llc", + "multi_member_llc", + "private_company", + "private_corporation", + "private_partnership", + "public_company", + "public_corporation", + "public_partnership", + "single_member_llc", + "sole_establishment", + "sole_proprietorship", + "tax_exempt_government_instrumentality", + "unincorporated_association", + "unincorporated_non_profit", + "unincorporated_partnership", + ] + ] + """ + The category identifying the legal structure of the company or legal entity. See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. + """ + tax_id_provided: Optional[bool] + """ + Whether the company's business ID number was provided. + """ + tax_id_registrar: Optional[str] + """ + The jurisdiction in which the `tax_id` is registered (Germany-based companies only). + """ + vat_id_provided: Optional[bool] + """ + Whether the company's business VAT number was provided. + """ + verification: Optional[Verification] + """ + Information on the verification state of the company. + """ + _inner_class_types = { + "address": Address, + "address_kana": AddressKana, + "address_kanji": AddressKanji, + "ownership_declaration": OwnershipDeclaration, + "verification": Verification, + } + + class Controller(StripeObject): + is_controller: Optional[bool] + """ + `true` if the Connect application retrieving the resource controls the account and can therefore exercise [platform controls](https://stripe.com/docs/connect/platform-controls-for-standard-accounts). Otherwise, this field is null. + """ + type: Literal["account", "application"] + """ + The controller type. Can be `application`, if a Connect application controls the account, or `account`, if the account controls itself. + """ + + class FutureRequirements(StripeObject): + class Alternative(StripeObject): + alternative_fields_due: List[str] + """ + Fields that can be provided to satisfy all fields in `original_fields_due`. + """ + original_fields_due: List[str] + """ + Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`. + """ + + class Error(StripeObject): + code: Literal[ + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_length", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_requires_additional_memorandum_of_associations", + ] + """ + The code for the type of error. + """ + reason: str + """ + An informative message that indicates the error type and provides additional details about the error. + """ + requirement: str + """ + The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + """ + + alternatives: Optional[List[Alternative]] + """ + Fields that are due and can be satisfied by providing the corresponding alternative fields instead. + """ + current_deadline: Optional[int] + """ + Date on which `future_requirements` merges with the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on its enablement state prior to transitioning. + """ + currently_due: Optional[List[str]] + """ + Fields that need to be collected to keep the account enabled. If not collected by `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash. + """ + disabled_reason: Optional[str] + """ + This is typed as a string for consistency with `requirements.disabled_reason`, but it safe to assume `future_requirements.disabled_reason` is empty because fields in `future_requirements` will never disable the account. + """ + errors: Optional[List[Error]] + """ + Fields that are `currently_due` and need to be collected again because validation or verification failed. + """ + eventually_due: Optional[List[str]] + """ + Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well. + """ + past_due: Optional[List[str]] + """ + Fields that weren't collected by `requirements.current_deadline`. These fields need to be collected to enable the capability on the account. New fields will never appear here; `future_requirements.past_due` will always be a subset of `requirements.past_due`. + """ + pending_verification: Optional[List[str]] + """ + Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due` or `currently_due`. + """ + _inner_class_types = {"alternatives": Alternative, "errors": Error} + + class Requirements(StripeObject): + class Alternative(StripeObject): + alternative_fields_due: List[str] + """ + Fields that can be provided to satisfy all fields in `original_fields_due`. + """ + original_fields_due: List[str] + """ + Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`. + """ + + class Error(StripeObject): + code: Literal[ + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_length", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_requires_additional_memorandum_of_associations", + ] + """ + The code for the type of error. + """ + reason: str + """ + An informative message that indicates the error type and provides additional details about the error. + """ + requirement: str + """ + The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + """ + + alternatives: Optional[List[Alternative]] + """ + Fields that are due and can be satisfied by providing the corresponding alternative fields instead. + """ + current_deadline: Optional[int] + """ + Date by which the fields in `currently_due` must be collected to keep the account enabled. These fields may disable the account sooner if the next threshold is reached before they are collected. + """ + currently_due: Optional[List[str]] + """ + Fields that need to be collected to keep the account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + """ + disabled_reason: Optional[str] + """ + If the account is disabled, this string describes why. Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`. + """ + errors: Optional[List[Error]] + """ + Fields that are `currently_due` and need to be collected again because validation or verification failed. + """ + eventually_due: Optional[List[str]] + """ + Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set. + """ + past_due: Optional[List[str]] + """ + Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the account. + """ + pending_verification: Optional[List[str]] + """ + Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. + """ + _inner_class_types = {"alternatives": Alternative, "errors": Error} + + class Settings(StripeObject): + class BacsDebitPayments(StripeObject): + display_name: Optional[str] + """ + The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct Debit, this will appear on the mandate, and as the statement descriptor. + """ + + class Branding(StripeObject): + icon: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. Must be square and at least 128px x 128px. + """ + logo: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A logo for the account that will be used in Checkout instead of the icon and without the account's name next to it if provided. Must be at least 128px x 128px. + """ + primary_color: Optional[str] + """ + A CSS hex color value representing the primary branding color for this account + """ + secondary_color: Optional[str] + """ + A CSS hex color value representing the secondary branding color for this account + """ + + class CardIssuing(StripeObject): + class TosAcceptance(StripeObject): + date: Optional[int] + """ + The Unix timestamp marking when the account representative accepted the service agreement. + """ + ip: Optional[str] + """ + The IP address from which the account representative accepted the service agreement. + """ + user_agent: Optional[str] + """ + The user agent of the browser from which the account representative accepted the service agreement. + """ + + tos_acceptance: Optional[TosAcceptance] + _inner_class_types = {"tos_acceptance": TosAcceptance} + + class CardPayments(StripeObject): + class DeclineOn(StripeObject): + avs_failure: bool + """ + Whether Stripe automatically declines charges with an incorrect ZIP or postal code. This setting only applies when a ZIP or postal code is provided and they fail bank verification. + """ + cvc_failure: bool + """ + Whether Stripe automatically declines charges with an incorrect CVC. This setting only applies when a CVC is provided and it fails bank verification. + """ + + decline_on: Optional[DeclineOn] + statement_descriptor_prefix: Optional[str] + """ + The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. + """ + statement_descriptor_prefix_kana: Optional[str] + """ + The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion. + """ + statement_descriptor_prefix_kanji: Optional[str] + """ + The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion. + """ + _inner_class_types = {"decline_on": DeclineOn} + + class Dashboard(StripeObject): + display_name: Optional[str] + """ + The display name for this account. This is used on the Stripe Dashboard to differentiate between accounts. + """ + timezone: Optional[str] + """ + The timezone used in the Stripe Dashboard for this account. A list of possible time zone values is maintained at the [IANA Time Zone Database](http://www.iana.org/time-zones). + """ + + class Payments(StripeObject): + statement_descriptor: Optional[str] + """ + The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. + """ + statement_descriptor_kana: Optional[str] + """ + The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only) + """ + statement_descriptor_kanji: Optional[str] + """ + The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only) + """ + statement_descriptor_prefix_kana: Optional[str] + """ + The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion. + """ + statement_descriptor_prefix_kanji: Optional[str] + """ + The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion. + """ + + class Payouts(StripeObject): + class Schedule(StripeObject): + delay_days: int + """ + The number of days charges for the account will be held before being paid out. + """ + interval: str + """ + How frequently funds will be paid out. One of `manual` (payouts only created via API call), `daily`, `weekly`, or `monthly`. + """ + monthly_anchor: Optional[int] + """ + The day of the month funds will be paid out. Only shown if `interval` is monthly. Payouts scheduled between the 29th and 31st of the month are sent on the last day of shorter months. + """ + weekly_anchor: Optional[str] + """ + The day of the week funds will be paid out, of the style 'monday', 'tuesday', etc. Only shown if `interval` is weekly. + """ + + debit_negative_balances: bool + """ + A Boolean indicating if Stripe should try to reclaim negative balances from an attached bank account. See our [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances) documentation for details. Default value is `false` for Custom accounts, otherwise `true`. + """ + schedule: Schedule + statement_descriptor: Optional[str] + """ + The text that appears on the bank account statement for payouts. If not set, this defaults to the platform's bank descriptor as set in the Dashboard. + """ + _inner_class_types = {"schedule": Schedule} + + class SepaDebitPayments(StripeObject): + creditor_id: Optional[str] + """ + SEPA creditor identifier that identifies the company making the payment. + """ + + class Treasury(StripeObject): + class TosAcceptance(StripeObject): + date: Optional[int] + """ + The Unix timestamp marking when the account representative accepted the service agreement. + """ + ip: Optional[str] + """ + The IP address from which the account representative accepted the service agreement. + """ + user_agent: Optional[str] + """ + The user agent of the browser from which the account representative accepted the service agreement. + """ + + tos_acceptance: Optional[TosAcceptance] + _inner_class_types = {"tos_acceptance": TosAcceptance} + + bacs_debit_payments: Optional[BacsDebitPayments] + branding: Branding + card_issuing: Optional[CardIssuing] + card_payments: CardPayments + dashboard: Dashboard + payments: Payments + payouts: Optional[Payouts] + sepa_debit_payments: Optional[SepaDebitPayments] + treasury: Optional[Treasury] + _inner_class_types = { + "bacs_debit_payments": BacsDebitPayments, + "branding": Branding, + "card_issuing": CardIssuing, + "card_payments": CardPayments, + "dashboard": Dashboard, + "payments": Payments, + "payouts": Payouts, + "sepa_debit_payments": SepaDebitPayments, + "treasury": Treasury, + } + + class TosAcceptance(StripeObject): + date: Optional[int] + """ + The Unix timestamp marking when the account representative accepted their service agreement + """ + ip: Optional[str] + """ + The IP address from which the account representative accepted their service agreement + """ + service_agreement: Optional[str] + """ + The user's service agreement type + """ + user_agent: Optional[str] + """ + The user agent of the browser from which the account representative accepted their service agreement + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -2452,7 +3413,7 @@ class ListPersonsParamsRelationship(TypedDict): A filter on the list of people returned based on whether these people are the representative of the account's company. """ - business_profile: Optional[StripeObject] + business_profile: Optional[BusinessProfile] """ Business information about the account. """ @@ -2462,13 +3423,13 @@ class ListPersonsParamsRelationship(TypedDict): """ The business type. """ - capabilities: Optional[StripeObject] + capabilities: Optional[Capabilities] charges_enabled: Optional[bool] """ Whether the account can create live charges. """ - company: Optional[StripeObject] - controller: Optional[StripeObject] + company: Optional[Company] + controller: Optional[Controller] country: Optional[str] """ The account's country. @@ -2493,7 +3454,7 @@ class ListPersonsParamsRelationship(TypedDict): """ External accounts (bank accounts and debit cards) currently attached to this account """ - future_requirements: Optional[StripeObject] + future_requirements: Optional[FutureRequirements] id: str """ Unique identifier for the object. @@ -2519,12 +3480,12 @@ class ListPersonsParamsRelationship(TypedDict): """ Whether Stripe can send payouts to this account. """ - requirements: Optional[StripeObject] - settings: Optional[StripeObject] + requirements: Optional[Requirements] + settings: Optional[Settings] """ Options for customizing how the account functions within Stripe. """ - tos_acceptance: Optional[StripeObject] + tos_acceptance: Optional[TosAcceptance] type: Optional[Literal["custom", "express", "standard"]] """ The Stripe account type. Can be `standard`, `express`, or `custom`. @@ -3111,3 +4072,14 @@ def list_persons( params=params, ), ) + + _inner_class_types = { + "business_profile": BusinessProfile, + "capabilities": Capabilities, + "company": Company, + "controller": Controller, + "future_requirements": FutureRequirements, + "requirements": Requirements, + "settings": Settings, + "tos_acceptance": TosAcceptance, + } diff --git a/stripe/api_resources/account_session.py b/stripe/api_resources/account_session.py index 074c06b0f..cfbbe08ec 100644 --- a/stripe/api_resources/account_session.py +++ b/stripe/api_resources/account_session.py @@ -25,6 +25,17 @@ class AccountSession(CreateableAPIResource["AccountSession"]): """ OBJECT_NAME: ClassVar[Literal["account_session"]] = "account_session" + + class Components(StripeObject): + class AccountOnboarding(StripeObject): + enabled: bool + """ + Whether the embedded component is enabled. + """ + + account_onboarding: AccountOnboarding + _inner_class_types = {"account_onboarding": AccountOnboarding} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -67,7 +78,7 @@ class CreateParamsComponentsAccountOnboarding(TypedDict): Refer to our docs to [setup Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components) and learn about how `client_secret` should be handled. """ - components: StripeObject + components: Components expires_at: int """ The timestamp at which this AccountSession will expire. @@ -102,3 +113,5 @@ def create( params, ), ) + + _inner_class_types = {"components": Components} diff --git a/stripe/api_resources/apps/secret.py b/stripe/api_resources/apps/secret.py index a0d797345..ab313da88 100644 --- a/stripe/api_resources/apps/secret.py +++ b/stripe/api_resources/apps/secret.py @@ -31,6 +31,17 @@ class Secret(CreateableAPIResource["Secret"], ListableAPIResource["Secret"]): """ OBJECT_NAME: ClassVar[Literal["apps.secret"]] = "apps.secret" + + class Scope(StripeObject): + type: Literal["account", "user"] + """ + The secret scope type. + """ + user: Optional[str] + """ + The user ID, if type is set to "user" + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -177,7 +188,7 @@ class ListParamsScope(TypedDict): """ The plaintext secret value to be stored. """ - scope: StripeObject + scope: Scope @classmethod def create( @@ -265,3 +276,5 @@ def list( ) return result + + _inner_class_types = {"scope": Scope} diff --git a/stripe/api_resources/balance.py b/stripe/api_resources/balance.py index 74cdc5db0..4f80bb251 100644 --- a/stripe/api_resources/balance.py +++ b/stripe/api_resources/balance.py @@ -23,6 +23,144 @@ class Balance(SingletonAPIResource["Balance"]): """ OBJECT_NAME: ClassVar[Literal["balance"]] = "balance" + + class Available(StripeObject): + class SourceTypes(StripeObject): + bank_account: Optional[int] + """ + Amount for bank account. + """ + card: Optional[int] + """ + Amount for card. + """ + fpx: Optional[int] + """ + Amount for FPX. + """ + + amount: int + """ + Balance amount. + """ + 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). + """ + source_types: Optional[SourceTypes] + _inner_class_types = {"source_types": SourceTypes} + + class ConnectReserved(StripeObject): + class SourceTypes(StripeObject): + bank_account: Optional[int] + """ + Amount for bank account. + """ + card: Optional[int] + """ + Amount for card. + """ + fpx: Optional[int] + """ + Amount for FPX. + """ + + amount: int + """ + Balance amount. + """ + 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). + """ + source_types: Optional[SourceTypes] + _inner_class_types = {"source_types": SourceTypes} + + class InstantAvailable(StripeObject): + class SourceTypes(StripeObject): + bank_account: Optional[int] + """ + Amount for bank account. + """ + card: Optional[int] + """ + Amount for card. + """ + fpx: Optional[int] + """ + Amount for FPX. + """ + + amount: int + """ + Balance amount. + """ + 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). + """ + source_types: Optional[SourceTypes] + _inner_class_types = {"source_types": SourceTypes} + + class Issuing(StripeObject): + class Available(StripeObject): + class SourceTypes(StripeObject): + bank_account: Optional[int] + """ + Amount for bank account. + """ + card: Optional[int] + """ + Amount for card. + """ + fpx: Optional[int] + """ + Amount for FPX. + """ + + amount: int + """ + Balance amount. + """ + 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). + """ + source_types: Optional[SourceTypes] + _inner_class_types = {"source_types": SourceTypes} + + available: List[Available] + """ + Funds that are available for use. + """ + _inner_class_types = {"available": Available} + + class Pending(StripeObject): + class SourceTypes(StripeObject): + bank_account: Optional[int] + """ + Amount for bank account. + """ + card: Optional[int] + """ + Amount for card. + """ + fpx: Optional[int] + """ + Amount for FPX. + """ + + amount: int + """ + Balance amount. + """ + 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). + """ + source_types: Optional[SourceTypes] + _inner_class_types = {"source_types": SourceTypes} + if TYPE_CHECKING: class RetrieveParams(RequestOptions): @@ -31,19 +169,19 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - available: List[StripeObject] + available: List[Available] """ Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts). You can find the available balance for each currency and payment type in the `source_types` property. """ - connect_reserved: Optional[List[StripeObject]] + connect_reserved: Optional[List[ConnectReserved]] """ Funds held due to negative balances on connected Custom accounts. You can find the connect reserve balance for each currency and payment type in the `source_types` property. """ - instant_available: Optional[List[StripeObject]] + instant_available: Optional[List[InstantAvailable]] """ Funds that you can pay out using Instant Payouts. """ - issuing: Optional[StripeObject] + issuing: Optional[Issuing] livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -52,7 +190,7 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - pending: List[StripeObject] + pending: List[Pending] """ Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the `source_types` property. """ @@ -66,3 +204,11 @@ def retrieve(cls, **params: Unpack["Balance.RetrieveParams"]) -> "Balance": @classmethod def class_url(cls): return "/v1/balance" + + _inner_class_types = { + "available": Available, + "connect_reserved": ConnectReserved, + "instant_available": InstantAvailable, + "issuing": Issuing, + "pending": Pending, + } diff --git a/stripe/api_resources/balance_transaction.py b/stripe/api_resources/balance_transaction.py index 1c8a3f43c..6b06adbd6 100644 --- a/stripe/api_resources/balance_transaction.py +++ b/stripe/api_resources/balance_transaction.py @@ -53,6 +53,29 @@ class BalanceTransaction(ListableAPIResource["BalanceTransaction"]): OBJECT_NAME: ClassVar[ Literal["balance_transaction"] ] = "balance_transaction" + + class FeeDetail(StripeObject): + amount: int + """ + Amount of the fee, in cents. + """ + application: Optional[str] + """ + ID of the Connect application that earned the fee. + """ + 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). + """ + description: Optional[str] + """ + An arbitrary string attached to the object. Often useful for displaying to users. + """ + type: str + """ + Type of the fee, one of: `application_fee`, `stripe_fee` or `tax`. + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -144,7 +167,7 @@ class RetrieveParams(RequestOptions): """ Fees (in cents (or local equivalent)) paid for this transaction. Represented as a positive integer when assessed. """ - fee_details: List[StripeObject] + fee_details: List[FeeDetail] """ Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction. """ @@ -271,3 +294,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"fee_details": FeeDetail} diff --git a/stripe/api_resources/bank_account.py b/stripe/api_resources/bank_account.py index 218d2e6d0..51b831fcb 100644 --- a/stripe/api_resources/bank_account.py +++ b/stripe/api_resources/bank_account.py @@ -36,6 +36,247 @@ class BankAccount( """ OBJECT_NAME: ClassVar[Literal["bank_account"]] = "bank_account" + + class FutureRequirements(StripeObject): + class Error(StripeObject): + code: Literal[ + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_length", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_requires_additional_memorandum_of_associations", + ] + """ + The code for the type of error. + """ + reason: str + """ + An informative message that indicates the error type and provides additional details about the error. + """ + requirement: str + """ + The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + """ + + currently_due: Optional[List[str]] + """ + Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + """ + errors: Optional[List[Error]] + """ + Fields that are `currently_due` and need to be collected again because validation or verification failed. + """ + past_due: Optional[List[str]] + """ + Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the external account. + """ + pending_verification: Optional[List[str]] + """ + Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. + """ + _inner_class_types = {"errors": Error} + + class Requirements(StripeObject): + class Error(StripeObject): + code: Literal[ + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_length", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_requires_additional_memorandum_of_associations", + ] + """ + The code for the type of error. + """ + reason: str + """ + An informative message that indicates the error type and provides additional details about the error. + """ + requirement: str + """ + The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + """ + + currently_due: Optional[List[str]] + """ + Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + """ + errors: Optional[List[Error]] + """ + Fields that are `currently_due` and need to be collected again because validation or verification failed. + """ + past_due: Optional[List[str]] + """ + Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the external account. + """ + pending_verification: Optional[List[str]] + """ + Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. + """ + _inner_class_types = {"errors": Error} + if TYPE_CHECKING: class DeleteParams(RequestOptions): @@ -85,7 +326,7 @@ class DeleteParams(RequestOptions): """ Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. """ - future_requirements: Optional[StripeObject] + future_requirements: Optional[FutureRequirements] """ Information about the [upcoming new requirements for the bank account](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when. """ @@ -105,7 +346,7 @@ class DeleteParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - requirements: Optional[StripeObject] + requirements: Optional[Requirements] """ Information about the requirements for the bank account, including what information needs to be collected. """ @@ -215,3 +456,8 @@ def retrieve( "stripe.Account.retrieve_external_account('account_id', 'bank_account_id') " "(see https://stripe.com/docs/api/external_account_bank_accounts/retrieve)." ) + + _inner_class_types = { + "future_requirements": FutureRequirements, + "requirements": Requirements, + } diff --git a/stripe/api_resources/billing_portal/configuration.py b/stripe/api_resources/billing_portal/configuration.py index 34c9165f8..fc9452def 100644 --- a/stripe/api_resources/billing_portal/configuration.py +++ b/stripe/api_resources/billing_portal/configuration.py @@ -35,6 +35,153 @@ class Configuration( OBJECT_NAME: ClassVar[ Literal["billing_portal.configuration"] ] = "billing_portal.configuration" + + class BusinessProfile(StripeObject): + headline: Optional[str] + """ + The messaging shown to customers in the portal. + """ + privacy_policy_url: Optional[str] + """ + A link to the business's publicly available privacy policy. + """ + terms_of_service_url: Optional[str] + """ + A link to the business's publicly available terms of service. + """ + + class Features(StripeObject): + class CustomerUpdate(StripeObject): + allowed_updates: List[ + Literal[ + "address", "email", "name", "phone", "shipping", "tax_id" + ] + ] + """ + The types of customer updates that are supported. When empty, customers are not updateable. + """ + enabled: bool + """ + Whether the feature is enabled. + """ + + class InvoiceHistory(StripeObject): + enabled: bool + """ + Whether the feature is enabled. + """ + + class PaymentMethodUpdate(StripeObject): + enabled: bool + """ + Whether the feature is enabled. + """ + + class SubscriptionCancel(StripeObject): + class CancellationReason(StripeObject): + enabled: bool + """ + Whether the feature is enabled. + """ + options: List[ + Literal[ + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ] + ] + """ + Which cancellation reasons will be given as options to the customer. + """ + + cancellation_reason: CancellationReason + enabled: bool + """ + Whether the feature is enabled. + """ + mode: Literal["at_period_end", "immediately"] + """ + Whether to cancel subscriptions immediately or at the end of the billing period. + """ + proration_behavior: Literal[ + "always_invoice", "create_prorations", "none" + ] + """ + Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`. + """ + _inner_class_types = {"cancellation_reason": CancellationReason} + + class SubscriptionPause(StripeObject): + enabled: bool + """ + Whether the feature is enabled. + """ + + class SubscriptionUpdate(StripeObject): + class Product(StripeObject): + prices: List[str] + """ + The list of price IDs which, when subscribed to, a subscription can be updated. + """ + product: str + """ + The product ID. + """ + + default_allowed_updates: List[ + Literal["price", "promotion_code", "quantity"] + ] + """ + The types of subscription updates that are supported for items listed in the `products` attribute. When empty, subscriptions are not updateable. + """ + enabled: bool + """ + Whether the feature is enabled. + """ + products: Optional[List[Product]] + """ + The list of products that support subscription updates. + """ + proration_behavior: Literal[ + "always_invoice", "create_prorations", "none" + ] + """ + Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. + """ + _inner_class_types = {"products": Product} + + customer_update: CustomerUpdate + invoice_history: InvoiceHistory + payment_method_update: PaymentMethodUpdate + subscription_cancel: SubscriptionCancel + subscription_pause: SubscriptionPause + subscription_update: SubscriptionUpdate + _inner_class_types = { + "customer_update": CustomerUpdate, + "invoice_history": InvoiceHistory, + "payment_method_update": PaymentMethodUpdate, + "subscription_cancel": SubscriptionCancel, + "subscription_pause": SubscriptionPause, + "subscription_update": SubscriptionUpdate, + } + + class LoginPage(StripeObject): + enabled: bool + """ + If `true`, a shareable `url` will be generated that will take your customers to a hosted login page for the customer portal. + + If `false`, the previously generated `url`, if any, will be deactivated. + """ + url: Optional[str] + """ + A shareable URL to the hosted portal login page. Your customers will be able to log in with their [email](https://stripe.com/docs/api/customers/object#customer_object-email) and receive a link to their customer portal. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -469,7 +616,7 @@ class RetrieveParams(RequestOptions): """ ID of the Connect Application that created the configuration. """ - business_profile: StripeObject + business_profile: BusinessProfile created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -478,7 +625,7 @@ class RetrieveParams(RequestOptions): """ The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session. """ - features: StripeObject + features: Features id: str """ Unique identifier for the object. @@ -491,7 +638,7 @@ class RetrieveParams(RequestOptions): """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. """ - login_page: StripeObject + login_page: LoginPage metadata: Optional[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. @@ -569,3 +716,9 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "business_profile": BusinessProfile, + "features": Features, + "login_page": LoginPage, + } diff --git a/stripe/api_resources/billing_portal/session.py b/stripe/api_resources/billing_portal/session.py index 89d16bea2..5ffc0a42f 100644 --- a/stripe/api_resources/billing_portal/session.py +++ b/stripe/api_resources/billing_portal/session.py @@ -38,6 +38,140 @@ class Session(CreateableAPIResource["Session"]): OBJECT_NAME: ClassVar[ Literal["billing_portal.session"] ] = "billing_portal.session" + + class Flow(StripeObject): + class AfterCompletion(StripeObject): + class HostedConfirmation(StripeObject): + custom_message: Optional[str] + """ + A custom message to display to the customer after the flow is completed. + """ + + class Redirect(StripeObject): + return_url: str + """ + The URL the customer will be redirected to after the flow is completed. + """ + + hosted_confirmation: Optional[HostedConfirmation] + """ + Configuration when `after_completion.type=hosted_confirmation`. + """ + redirect: Optional[Redirect] + """ + Configuration when `after_completion.type=redirect`. + """ + type: Literal["hosted_confirmation", "portal_homepage", "redirect"] + """ + The specified type of behavior after the flow is completed. + """ + _inner_class_types = { + "hosted_confirmation": HostedConfirmation, + "redirect": Redirect, + } + + class SubscriptionCancel(StripeObject): + class Retention(StripeObject): + class CouponOffer(StripeObject): + coupon: str + """ + The ID of the coupon to be offered. + """ + + coupon_offer: Optional[CouponOffer] + """ + Configuration when `retention.type=coupon_offer`. + """ + type: Literal["coupon_offer"] + """ + Type of retention strategy that will be used. + """ + _inner_class_types = {"coupon_offer": CouponOffer} + + retention: Optional[Retention] + """ + Specify a retention strategy to be used in the cancellation flow. + """ + subscription: str + """ + The ID of the subscription to be canceled. + """ + _inner_class_types = {"retention": Retention} + + class SubscriptionUpdate(StripeObject): + subscription: str + """ + The ID of the subscription to be updated. + """ + + class SubscriptionUpdateConfirm(StripeObject): + class Discount(StripeObject): + coupon: Optional[str] + """ + The ID of the coupon to apply to this subscription update. + """ + promotion_code: Optional[str] + """ + The ID of a promotion code to apply to this subscription update. + """ + + class Item(StripeObject): + id: Optional[str] + """ + The ID of the [subscription item](https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id) to be updated. + """ + price: Optional[str] + """ + The price the customer should subscribe to through this flow. The price must also be included in the configuration's [`features.subscription_update.products`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-products). + """ + quantity: Optional[int] + """ + [Quantity](https://stripe.com/docs/subscriptions/quantities) for this item that the customer should subscribe to through this flow. + """ + + discounts: Optional[List[Discount]] + """ + The coupon or promotion code to apply to this subscription update. Currently, only up to one may be specified. + """ + items: List[Item] + """ + The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow. Currently, only up to one may be specified and subscriptions with multiple items are not updatable. + """ + subscription: str + """ + The ID of the subscription to be updated. + """ + _inner_class_types = {"discounts": Discount, "items": Item} + + after_completion: AfterCompletion + subscription_cancel: Optional[SubscriptionCancel] + """ + Configuration when `flow.type=subscription_cancel`. + """ + subscription_update: Optional[SubscriptionUpdate] + """ + Configuration when `flow.type=subscription_update`. + """ + subscription_update_confirm: Optional[SubscriptionUpdateConfirm] + """ + Configuration when `flow.type=subscription_update_confirm`. + """ + type: Literal[ + "payment_method_update", + "subscription_cancel", + "subscription_update", + "subscription_update_confirm", + ] + """ + Type of flow that the customer will go through. + """ + _inner_class_types = { + "after_completion": AfterCompletion, + "subscription_cancel": SubscriptionCancel, + "subscription_update": SubscriptionUpdate, + "subscription_update_confirm": SubscriptionUpdateConfirm, + } + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -227,7 +361,7 @@ class CreateParamsFlowDataAfterCompletionHostedConfirmation(TypedDict): """ The ID of the customer for this session. """ - flow: Optional[StripeObject] + flow: Optional[Flow] """ Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows. """ @@ -331,3 +465,5 @@ def create( params, ), ) + + _inner_class_types = {"flow": Flow} diff --git a/stripe/api_resources/capability.py b/stripe/api_resources/capability.py index 06189d852..24bc1c3f6 100644 --- a/stripe/api_resources/capability.py +++ b/stripe/api_resources/capability.py @@ -4,7 +4,7 @@ from stripe.api_resources.account import Account from stripe.api_resources.expandable_field import ExpandableField from stripe.stripe_object import StripeObject -from typing import ClassVar, Optional +from typing import ClassVar, List, Optional from typing_extensions import Literal from urllib.parse import quote_plus @@ -17,11 +17,310 @@ class Capability(UpdateableAPIResource["Capability"]): """ OBJECT_NAME: ClassVar[Literal["capability"]] = "capability" + + class FutureRequirements(StripeObject): + class Alternative(StripeObject): + alternative_fields_due: List[str] + """ + Fields that can be provided to satisfy all fields in `original_fields_due`. + """ + original_fields_due: List[str] + """ + Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`. + """ + + class Error(StripeObject): + code: Literal[ + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_length", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_requires_additional_memorandum_of_associations", + ] + """ + The code for the type of error. + """ + reason: str + """ + An informative message that indicates the error type and provides additional details about the error. + """ + requirement: str + """ + The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + """ + + alternatives: Optional[List[Alternative]] + """ + Fields that are due and can be satisfied by providing the corresponding alternative fields instead. + """ + current_deadline: Optional[int] + """ + Date on which `future_requirements` merges with the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on the capability's enablement state prior to transitioning. + """ + currently_due: List[str] + """ + Fields that need to be collected to keep the capability enabled. If not collected by `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash. + """ + disabled_reason: Optional[str] + """ + This is typed as a string for consistency with `requirements.disabled_reason`, but it safe to assume `future_requirements.disabled_reason` is empty because fields in `future_requirements` will never disable the account. + """ + errors: List[Error] + """ + Fields that are `currently_due` and need to be collected again because validation or verification failed. + """ + eventually_due: List[str] + """ + Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well. + """ + past_due: List[str] + """ + Fields that weren't collected by `requirements.current_deadline`. These fields need to be collected to enable the capability on the account. New fields will never appear here; `future_requirements.past_due` will always be a subset of `requirements.past_due`. + """ + pending_verification: List[str] + """ + Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due` or `currently_due`. + """ + _inner_class_types = {"alternatives": Alternative, "errors": Error} + + class Requirements(StripeObject): + class Alternative(StripeObject): + alternative_fields_due: List[str] + """ + Fields that can be provided to satisfy all fields in `original_fields_due`. + """ + original_fields_due: List[str] + """ + Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`. + """ + + class Error(StripeObject): + code: Literal[ + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_length", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_requires_additional_memorandum_of_associations", + ] + """ + The code for the type of error. + """ + reason: str + """ + An informative message that indicates the error type and provides additional details about the error. + """ + requirement: str + """ + The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + """ + + alternatives: Optional[List[Alternative]] + """ + Fields that are due and can be satisfied by providing the corresponding alternative fields instead. + """ + current_deadline: Optional[int] + """ + Date by which the fields in `currently_due` must be collected to keep the capability enabled for the account. These fields may disable the capability sooner if the next threshold is reached before they are collected. + """ + currently_due: List[str] + """ + Fields that need to be collected to keep the capability enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled. + """ + disabled_reason: Optional[str] + """ + If the capability is disabled, this string describes why. Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`. + + `rejected.unsupported_business` means that the account's business is not supported by the capability. For example, payment methods may restrict the businesses they support in their terms of service: + + - [Afterpay Clearpay's terms of service](https://stripe.com/afterpay-clearpay/legal#restricted-businesses) + + If you believe that the rejection is in error, please contact support at https://support.stripe.com/contact/ for assistance. + """ + errors: List[Error] + """ + Fields that are `currently_due` and need to be collected again because validation or verification failed. + """ + eventually_due: List[str] + """ + Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set. + """ + past_due: List[str] + """ + Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the capability on the account. + """ + pending_verification: List[str] + """ + Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. + """ + _inner_class_types = {"alternatives": Alternative, "errors": Error} + account: ExpandableField["Account"] """ The account for which the capability enables functionality. """ - future_requirements: Optional[StripeObject] + future_requirements: Optional[FutureRequirements] id: str """ The identifier for the capability. @@ -38,7 +337,7 @@ class Capability(UpdateableAPIResource["Capability"]): """ Time at which the capability was requested. Measured in seconds since the Unix epoch. """ - requirements: Optional[StripeObject] + requirements: Optional[Requirements] status: Literal["active", "disabled", "inactive", "pending", "unrequested"] """ The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`. @@ -67,3 +366,8 @@ def retrieve(cls, id, api_key=None, **params): "Can't retrieve a capability without an account ID. Retrieve a capability using " "account.retrieve_capability('acct_123', 'acap_123')" ) + + _inner_class_types = { + "future_requirements": FutureRequirements, + "requirements": Requirements, + } diff --git a/stripe/api_resources/cash_balance.py b/stripe/api_resources/cash_balance.py index 8b23c5f92..7201bb6bb 100644 --- a/stripe/api_resources/cash_balance.py +++ b/stripe/api_resources/cash_balance.py @@ -13,6 +13,17 @@ class CashBalance(StripeObject): """ OBJECT_NAME: ClassVar[Literal["cash_balance"]] = "cash_balance" + + class Settings(StripeObject): + reconciliation_mode: Literal["automatic", "manual"] + """ + The configuration for how funds that land in the customer cash balance are reconciled. + """ + using_merchant_default: bool + """ + A flag to indicate if reconciliation mode returned is the user's default or is specific to this customer cash balance + """ + available: Optional[Dict[str, int]] """ A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). @@ -29,7 +40,7 @@ class CashBalance(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ - settings: StripeObject + settings: Settings def instance_url(self): customer = self.customer @@ -43,3 +54,5 @@ def retrieve(cls, id, api_key=None, **params): "Can't retrieve a Customer Cash Balance without a Customer ID. " "Use Customer.retrieve_cash_balance('cus_123')" ) + + _inner_class_types = {"settings": Settings} diff --git a/stripe/api_resources/charge.py b/stripe/api_resources/charge.py index 68d9c78f9..f55f233cf 100644 --- a/stripe/api_resources/charge.py +++ b/stripe/api_resources/charge.py @@ -38,10 +38,12 @@ from stripe.api_resources.application_fee import ApplicationFee from stripe.api_resources.balance_transaction import BalanceTransaction from stripe.api_resources.bank_account import BankAccount - from stripe.api_resources.card import Card + from stripe.api_resources.card import Card as CardResource from stripe.api_resources.customer import Customer from stripe.api_resources.invoice import Invoice + from stripe.api_resources.mandate import Mandate from stripe.api_resources.payment_intent import PaymentIntent + from stripe.api_resources.payment_method import PaymentMethod from stripe.api_resources.refund import Refund from stripe.api_resources.review import Review from stripe.api_resources.source import Source @@ -62,6 +64,1572 @@ class Charge( """ OBJECT_NAME: ClassVar[Literal["charge"]] = "charge" + + class BillingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + """ + Billing address. + """ + email: Optional[str] + """ + Email address. + """ + name: Optional[str] + """ + Full name. + """ + phone: Optional[str] + """ + Billing phone number (including extension). + """ + _inner_class_types = {"address": Address} + + class FraudDetails(StripeObject): + stripe_report: Optional[str] + """ + Assessments from Stripe. If set, the value is `fraudulent`. + """ + user_report: Optional[str] + """ + Assessments reported by you. If set, possible values of are `safe` and `fraudulent`. + """ + + class Level3(StripeObject): + class LineItem(StripeObject): + discount_amount: Optional[int] + product_code: str + product_description: str + quantity: Optional[int] + tax_amount: Optional[int] + unit_cost: Optional[int] + + customer_reference: Optional[str] + line_items: List[LineItem] + merchant_reference: str + shipping_address_zip: Optional[str] + shipping_amount: Optional[int] + shipping_from_zip: Optional[str] + _inner_class_types = {"line_items": LineItem} + + class Outcome(StripeObject): + class Rule(StripeObject): + action: str + """ + The action taken on the payment. + """ + id: str + """ + Unique identifier for the object. + """ + predicate: str + """ + The predicate to evaluate the payment against. + """ + + network_status: Optional[str] + """ + Possible values are `approved_by_network`, `declined_by_network`, `not_sent_to_network`, and `reversed_after_approval`. The value `reversed_after_approval` indicates the payment was [blocked by Stripe](https://stripe.com/docs/declines#blocked-payments) after bank authorization, and may temporarily appear as "pending" on a cardholder's statement. + """ + reason: Optional[str] + """ + An enumerated value providing a more detailed explanation of the outcome's `type`. Charges blocked by Radar's default block rule have the value `highest_risk_level`. Charges placed in review by Radar's default review rule have the value `elevated_risk_level`. Charges authorized, blocked, or placed in review by custom rules have the value `rule`. See [understanding declines](https://stripe.com/docs/declines) for more details. + """ + risk_level: Optional[str] + """ + Stripe Radar's evaluation of the riskiness of the payment. Possible values for evaluated payments are `normal`, `elevated`, `highest`. For non-card payments, and card-based payments predating the public assignment of risk levels, this field will have the value `not_assessed`. In the event of an error in the evaluation, this field will have the value `unknown`. This field is only available with Radar. + """ + risk_score: Optional[int] + """ + Stripe Radar's evaluation of the riskiness of the payment. Possible values for evaluated payments are between 0 and 100. For non-card payments, card-based payments predating the public assignment of risk scores, or in the event of an error during evaluation, this field will not be present. This field is only available with Radar for Fraud Teams. + """ + rule: Optional[ExpandableField[Rule]] + """ + The ID of the Radar rule that matched the payment, if applicable. + """ + seller_message: Optional[str] + """ + A human-readable description of the outcome type and reason, designed for you (the recipient of the payment), not your customer. + """ + type: str + """ + Possible values are `authorized`, `manual_review`, `issuer_declined`, `blocked`, and `invalid`. See [understanding declines](https://stripe.com/docs/declines) and [Radar reviews](https://stripe.com/docs/radar/reviews) for details. + """ + _inner_class_types = {"rule": Rule} + + class PaymentMethodDetails(StripeObject): + class AchCreditTransfer(StripeObject): + account_number: Optional[str] + """ + Account number to transfer funds to. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the routing number. + """ + routing_number: Optional[str] + """ + Routing transit number for the bank account to transfer funds to. + """ + swift_code: Optional[str] + """ + SWIFT code of the bank associated with the routing number. + """ + + class AchDebit(StripeObject): + account_holder_type: Optional[Literal["company", "individual"]] + """ + Type of entity that holds the account. This can be either `individual` or `company`. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country the bank account is located in. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + routing_number: Optional[str] + """ + Routing transit number of the bank account. + """ + + class AcssDebit(StripeObject): + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + institution_number: Optional[str] + """ + Institution number of the bank account + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + mandate: Optional[str] + """ + ID of the mandate used to make this payment. + """ + transit_number: Optional[str] + """ + Transit number of the bank account. + """ + + class Affirm(StripeObject): + pass + + class AfterpayClearpay(StripeObject): + order_id: Optional[str] + """ + The Afterpay order ID associated with this payment intent. + """ + reference: Optional[str] + """ + Order identifier shown to the merchant in Afterpay's online portal. + """ + + class Alipay(StripeObject): + buyer_id: Optional[str] + """ + Uniquely identifies this particular Alipay account. You can use this attribute to check whether two Alipay accounts are the same. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular Alipay account. You can use this attribute to check whether two Alipay accounts are the same. + """ + transaction_id: Optional[str] + """ + Transaction ID of this particular Alipay transaction. + """ + + class AuBecsDebit(StripeObject): + bsb_number: Optional[str] + """ + Bank-State-Branch number of the bank account. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + mandate: Optional[str] + """ + ID of the mandate used to make this payment. + """ + + class BacsDebit(StripeObject): + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + mandate: Optional[str] + """ + ID of the mandate used to make this payment. + """ + sort_code: Optional[str] + """ + Sort code of the bank account. (e.g., `10-20-30`) + """ + + class Bancontact(StripeObject): + bank_code: Optional[str] + """ + Bank code of bank associated with the bank account. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + bic: Optional[str] + """ + Bank Identifier Code of the bank associated with the bank account. + """ + generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]] + """ + The ID of the SEPA Direct Debit PaymentMethod which was generated by this Charge. + """ + generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]] + """ + The mandate for the SEPA Direct Debit PaymentMethod which was generated by this Charge. + """ + iban_last4: Optional[str] + """ + Last four characters of the IBAN. + """ + preferred_language: Optional[Literal["de", "en", "fr", "nl"]] + """ + Preferred language of the Bancontact authorization page that the customer is redirected to. + Can be one of `en`, `de`, `fr`, or `nl` + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by Bancontact directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + + class Blik(StripeObject): + pass + + class Boleto(StripeObject): + tax_id: str + """ + The tax ID of the customer (CPF for individuals consumers or CNPJ for businesses consumers) + """ + + class Card(StripeObject): + class Checks(StripeObject): + address_line1_check: Optional[str] + """ + If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + address_postal_code_check: Optional[str] + """ + If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + cvc_check: Optional[str] + """ + If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + + class ExtendedAuthorization(StripeObject): + status: Literal["disabled", "enabled"] + """ + Indicates whether or not the capture window is extended beyond the standard authorization. + """ + + class IncrementalAuthorization(StripeObject): + status: Literal["available", "unavailable"] + """ + Indicates whether or not the incremental authorization feature is supported. + """ + + class Installments(StripeObject): + class Plan(StripeObject): + count: Optional[int] + """ + For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + """ + interval: Optional[Literal["month"]] + """ + For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + One of `month`. + """ + type: Literal["fixed_count"] + """ + Type of installment plan, one of `fixed_count`. + """ + + plan: Optional[Plan] + """ + Installment plan selected for the payment. + """ + _inner_class_types = {"plan": Plan} + + class Multicapture(StripeObject): + status: Literal["available", "unavailable"] + """ + Indicates whether or not multiple captures are supported. + """ + + class NetworkToken(StripeObject): + used: bool + """ + Indicates if Stripe used a network token, either user provided or Stripe managed when processing the transaction. + """ + + class Overcapture(StripeObject): + maximum_amount_capturable: int + """ + The maximum amount that can be captured. + """ + status: Literal["available", "unavailable"] + """ + Indicates whether or not the authorized amount can be over-captured. + """ + + class ThreeDSecure(StripeObject): + authentication_flow: Optional[ + Literal["challenge", "frictionless"] + ] + """ + For authenticated transactions: how the customer was authenticated by + the issuing bank. + """ + result: Optional[ + Literal[ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ] + ] + """ + Indicates the outcome of 3D Secure authentication. + """ + result_reason: Optional[ + Literal[ + "abandoned", + "bypassed", + "canceled", + "card_not_enrolled", + "network_not_supported", + "protocol_error", + "rejected", + ] + ] + """ + Additional information about why 3D Secure succeeded or failed based + on the `result`. + """ + version: Optional[Literal["1.0.2", "2.1.0", "2.2.0"]] + """ + The version of 3D Secure that was used. + """ + + class Wallet(StripeObject): + class AmexExpressCheckout(StripeObject): + pass + + class ApplePay(StripeObject): + pass + + class GooglePay(StripeObject): + pass + + class Link(StripeObject): + pass + + class Masterpass(StripeObject): + class BillingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class ShippingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + billing_address: Optional[BillingAddress] + """ + Owner's verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + email: Optional[str] + """ + Owner's verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + shipping_address: Optional[ShippingAddress] + """ + Owner's verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + _inner_class_types = { + "billing_address": BillingAddress, + "shipping_address": ShippingAddress, + } + + class SamsungPay(StripeObject): + pass + + class VisaCheckout(StripeObject): + class BillingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class ShippingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + billing_address: Optional[BillingAddress] + """ + Owner's verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + email: Optional[str] + """ + Owner's verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + shipping_address: Optional[ShippingAddress] + """ + Owner's verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + _inner_class_types = { + "billing_address": BillingAddress, + "shipping_address": ShippingAddress, + } + + amex_express_checkout: Optional[AmexExpressCheckout] + apple_pay: Optional[ApplePay] + dynamic_last4: Optional[str] + """ + (For tokenized numbers only.) The last four digits of the device account number. + """ + google_pay: Optional[GooglePay] + link: Optional[Link] + masterpass: Optional[Masterpass] + samsung_pay: Optional[SamsungPay] + type: Literal[ + "amex_express_checkout", + "apple_pay", + "google_pay", + "link", + "masterpass", + "samsung_pay", + "visa_checkout", + ] + """ + The type of the card wallet, one of `amex_express_checkout`, `apple_pay`, `google_pay`, `masterpass`, `samsung_pay`, `visa_checkout`, or `link`. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type. + """ + visa_checkout: Optional[VisaCheckout] + _inner_class_types = { + "amex_express_checkout": AmexExpressCheckout, + "apple_pay": ApplePay, + "google_pay": GooglePay, + "link": Link, + "masterpass": Masterpass, + "samsung_pay": SamsungPay, + "visa_checkout": VisaCheckout, + } + + amount_authorized: Optional[int] + """ + The authorized amount. + """ + brand: Optional[str] + """ + Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + checks: Optional[Checks] + """ + Check results by Card networks on Card address and CVC at time of payment. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + """ + description: Optional[str] + """ + A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.) + """ + exp_month: int + """ + Two-digit number representing the card's expiration month. + """ + exp_year: int + """ + Four-digit number representing the card's expiration year. + """ + extended_authorization: Optional[ExtendedAuthorization] + fingerprint: Optional[str] + """ + Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + + *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* + """ + funding: Optional[str] + """ + Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + """ + iin: Optional[str] + """ + Issuer identification number of the card. (For internal use only and not typically available in standard API requests.) + """ + incremental_authorization: Optional[IncrementalAuthorization] + installments: Optional[Installments] + """ + Installment details for this payment (Mexico only). + + For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). + """ + issuer: Optional[str] + """ + The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.) + """ + last4: Optional[str] + """ + The last four digits of the card. + """ + mandate: Optional[str] + """ + ID of the mandate used to make this payment or created by it. + """ + moto: Optional[bool] + """ + True if this payment was marked as MOTO and out of scope for SCA. + """ + multicapture: Optional[Multicapture] + network: Optional[str] + """ + Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + network_token: Optional[NetworkToken] + """ + If this card has network token credentials, this contains the details of the network token credentials. + """ + overcapture: Optional[Overcapture] + three_d_secure: Optional[ThreeDSecure] + """ + Populated if this transaction used 3D Secure authentication. + """ + wallet: Optional[Wallet] + """ + If this Card is part of a card wallet, this contains the details of the card wallet. + """ + _inner_class_types = { + "checks": Checks, + "extended_authorization": ExtendedAuthorization, + "incremental_authorization": IncrementalAuthorization, + "installments": Installments, + "multicapture": Multicapture, + "network_token": NetworkToken, + "overcapture": Overcapture, + "three_d_secure": ThreeDSecure, + "wallet": Wallet, + } + + class CardPresent(StripeObject): + class Receipt(StripeObject): + account_type: Optional[ + Literal["checking", "credit", "prepaid", "unknown"] + ] + """ + The type of account being debited or credited + """ + application_cryptogram: Optional[str] + """ + EMV tag 9F26, cryptogram generated by the integrated circuit chip. + """ + application_preferred_name: Optional[str] + """ + Mnenomic of the Application Identifier. + """ + authorization_code: Optional[str] + """ + Identifier for this transaction. + """ + authorization_response_code: Optional[str] + """ + EMV tag 8A. A code returned by the card issuer. + """ + cardholder_verification_method: Optional[str] + """ + How the cardholder verified ownership of the card. + """ + dedicated_file_name: Optional[str] + """ + EMV tag 84. Similar to the application identifier stored on the integrated circuit chip. + """ + terminal_verification_results: Optional[str] + """ + The outcome of a series of EMV functions performed by the card reader. + """ + transaction_status_information: Optional[str] + """ + An indication of various EMV functions performed during the transaction. + """ + + amount_authorized: Optional[int] + """ + The authorized amount + """ + brand: Optional[str] + """ + Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + capture_before: Optional[int] + """ + When using manual capture, a future timestamp after which the charge will be automatically refunded if uncaptured. + """ + cardholder_name: Optional[str] + """ + The cardholder name as read from the card, in [ISO 7813](https://en.wikipedia.org/wiki/ISO/IEC_7813) format. May include alphanumeric characters, special characters and first/last name separator (`/`). In some cases, the cardholder name may not be available depending on how the issuer has configured the card. Cardholder name is typically not available on swipe or contactless payments, such as those made with Apple Pay and Google Pay. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + """ + description: Optional[str] + """ + A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.) + """ + emv_auth_data: Optional[str] + """ + Authorization response cryptogram. + """ + exp_month: int + """ + Two-digit number representing the card's expiration month. + """ + exp_year: int + """ + Four-digit number representing the card's expiration year. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + + *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* + """ + funding: Optional[str] + """ + Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + """ + generated_card: Optional[str] + """ + ID of a card PaymentMethod generated from the card_present PaymentMethod that may be attached to a Customer for future transactions. Only present if it was possible to generate a card PaymentMethod. + """ + iin: Optional[str] + """ + Issuer identification number of the card. (For internal use only and not typically available in standard API requests.) + """ + incremental_authorization_supported: bool + """ + Whether this [PaymentIntent](https://stripe.com/docs/api/payment_intents) is eligible for incremental authorizations. Request support using [request_incremental_authorization_support](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_options-card_present-request_incremental_authorization_support). + """ + issuer: Optional[str] + """ + The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.) + """ + last4: Optional[str] + """ + The last four digits of the card. + """ + network: Optional[str] + """ + Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + overcapture_supported: bool + """ + Defines whether the authorized amount can be over-captured or not + """ + read_method: Optional[ + Literal[ + "contact_emv", + "contactless_emv", + "contactless_magstripe_mode", + "magnetic_stripe_fallback", + "magnetic_stripe_track2", + ] + ] + """ + How card details were read in this transaction. + """ + receipt: Optional[Receipt] + """ + A collection of fields required to be displayed on receipts. Only required for EMV transactions. + """ + _inner_class_types = {"receipt": Receipt} + + class Cashapp(StripeObject): + buyer_id: Optional[str] + """ + A unique and immutable identifier assigned by Cash App to every buyer. + """ + cashtag: Optional[str] + """ + A public identifier for buyers using Cash App. + """ + + class CustomerBalance(StripeObject): + pass + + class Eps(StripeObject): + bank: Optional[ + Literal[ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ] + ] + """ + The customer's bank. Should be one of `arzte_und_apotheker_bank`, `austrian_anadi_bank_ag`, `bank_austria`, `bankhaus_carl_spangler`, `bankhaus_schelhammer_und_schattera_ag`, `bawag_psk_ag`, `bks_bank_ag`, `brull_kallmus_bank_ag`, `btv_vier_lander_bank`, `capital_bank_grawe_gruppe_ag`, `deutsche_bank_ag`, `dolomitenbank`, `easybank_ag`, `erste_bank_und_sparkassen`, `hypo_alpeadriabank_international_ag`, `hypo_noe_lb_fur_niederosterreich_u_wien`, `hypo_oberosterreich_salzburg_steiermark`, `hypo_tirol_bank_ag`, `hypo_vorarlberg_bank_ag`, `hypo_bank_burgenland_aktiengesellschaft`, `marchfelder_bank`, `oberbank_ag`, `raiffeisen_bankengruppe_osterreich`, `schoellerbank_ag`, `sparda_bank_wien`, `volksbank_gruppe`, `volkskreditbank_ag`, or `vr_bank_braunau`. + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by EPS directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + EPS rarely provides this information so the attribute is usually empty. + """ + + class Fpx(StripeObject): + account_holder_type: Optional[Literal["company", "individual"]] + """ + Account holder type, if provided. Can be one of `individual` or `company`. + """ + bank: Literal[ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ] + """ + The customer's bank. Can be one of `affin_bank`, `agrobank`, `alliance_bank`, `ambank`, `bank_islam`, `bank_muamalat`, `bank_rakyat`, `bsn`, `cimb`, `hong_leong_bank`, `hsbc`, `kfh`, `maybank2u`, `ocbc`, `public_bank`, `rhb`, `standard_chartered`, `uob`, `deutsche_bank`, `maybank2e`, `pb_enterprise`, or `bank_of_china`. + """ + transaction_id: Optional[str] + """ + Unique transaction id generated by FPX for every request from the merchant + """ + + class Giropay(StripeObject): + bank_code: Optional[str] + """ + Bank code of bank associated with the bank account. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + bic: Optional[str] + """ + Bank Identifier Code of the bank associated with the bank account. + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by Giropay directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + Giropay rarely provides this information so the attribute is usually empty. + """ + + class Grabpay(StripeObject): + transaction_id: Optional[str] + """ + Unique transaction id generated by GrabPay + """ + + class Ideal(StripeObject): + bank: Optional[ + Literal[ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ] + ] + """ + The customer's bank. Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. + """ + bic: Optional[ + Literal[ + "ABNANL2A", + "ASNBNL21", + "BITSNL2A", + "BUNQNL2A", + "FVLBNL22", + "HANDNL2A", + "INGBNL2A", + "KNABNL2H", + "MOYONL21", + "NTSBDEB1", + "RABONL2U", + "RBRBNL21", + "REVOIE23", + "REVOLT21", + "SNSBNL2A", + "TRIONL2U", + ] + ] + """ + The Bank Identifier Code of the customer's bank. + """ + generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]] + """ + The ID of the SEPA Direct Debit PaymentMethod which was generated by this Charge. + """ + generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]] + """ + The mandate for the SEPA Direct Debit PaymentMethod which was generated by this Charge. + """ + iban_last4: Optional[str] + """ + Last four characters of the IBAN. + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by iDEAL directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + + class InteracPresent(StripeObject): + class Receipt(StripeObject): + account_type: Optional[ + Literal["checking", "savings", "unknown"] + ] + """ + The type of account being debited or credited + """ + application_cryptogram: Optional[str] + """ + EMV tag 9F26, cryptogram generated by the integrated circuit chip. + """ + application_preferred_name: Optional[str] + """ + Mnenomic of the Application Identifier. + """ + authorization_code: Optional[str] + """ + Identifier for this transaction. + """ + authorization_response_code: Optional[str] + """ + EMV tag 8A. A code returned by the card issuer. + """ + cardholder_verification_method: Optional[str] + """ + How the cardholder verified ownership of the card. + """ + dedicated_file_name: Optional[str] + """ + EMV tag 84. Similar to the application identifier stored on the integrated circuit chip. + """ + terminal_verification_results: Optional[str] + """ + The outcome of a series of EMV functions performed by the card reader. + """ + transaction_status_information: Optional[str] + """ + An indication of various EMV functions performed during the transaction. + """ + + brand: Optional[str] + """ + Card brand. Can be `interac`, `mastercard` or `visa`. + """ + cardholder_name: Optional[str] + """ + The cardholder name as read from the card, in [ISO 7813](https://en.wikipedia.org/wiki/ISO/IEC_7813) format. May include alphanumeric characters, special characters and first/last name separator (`/`). In some cases, the cardholder name may not be available depending on how the issuer has configured the card. Cardholder name is typically not available on swipe or contactless payments, such as those made with Apple Pay and Google Pay. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + """ + description: Optional[str] + """ + A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.) + """ + emv_auth_data: Optional[str] + """ + Authorization response cryptogram. + """ + exp_month: int + """ + Two-digit number representing the card's expiration month. + """ + exp_year: int + """ + Four-digit number representing the card's expiration year. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + + *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* + """ + funding: Optional[str] + """ + Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + """ + generated_card: Optional[str] + """ + ID of a card PaymentMethod generated from the card_present PaymentMethod that may be attached to a Customer for future transactions. Only present if it was possible to generate a card PaymentMethod. + """ + iin: Optional[str] + """ + Issuer identification number of the card. (For internal use only and not typically available in standard API requests.) + """ + issuer: Optional[str] + """ + The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.) + """ + last4: Optional[str] + """ + The last four digits of the card. + """ + network: Optional[str] + """ + Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + preferred_locales: Optional[List[str]] + """ + EMV tag 5F2D. Preferred languages specified by the integrated circuit chip. + """ + read_method: Optional[ + Literal[ + "contact_emv", + "contactless_emv", + "contactless_magstripe_mode", + "magnetic_stripe_fallback", + "magnetic_stripe_track2", + ] + ] + """ + How card details were read in this transaction. + """ + receipt: Optional[Receipt] + """ + A collection of fields required to be displayed on receipts. Only required for EMV transactions. + """ + _inner_class_types = {"receipt": Receipt} + + class Klarna(StripeObject): + payment_method_category: Optional[str] + """ + The Klarna payment method used for this transaction. + Can be one of `pay_later`, `pay_now`, `pay_with_financing`, or `pay_in_installments` + """ + preferred_locale: Optional[str] + """ + Preferred language of the Klarna authorization page that the customer is redirected to. + Can be one of `de-AT`, `en-AT`, `nl-BE`, `fr-BE`, `en-BE`, `de-DE`, `en-DE`, `da-DK`, `en-DK`, `es-ES`, `en-ES`, `fi-FI`, `sv-FI`, `en-FI`, `en-GB`, `en-IE`, `it-IT`, `en-IT`, `nl-NL`, `en-NL`, `nb-NO`, `en-NO`, `sv-SE`, `en-SE`, `en-US`, `es-US`, `fr-FR`, `en-FR`, `cs-CZ`, `en-CZ`, `el-GR`, `en-GR`, `en-AU`, `en-NZ`, `en-CA`, `fr-CA`, `pl-PL`, `en-PL`, `pt-PT`, `en-PT`, `de-CH`, `fr-CH`, `it-CH`, or `en-CH` + """ + + class Konbini(StripeObject): + class Store(StripeObject): + chain: Optional[ + Literal["familymart", "lawson", "ministop", "seicomart"] + ] + """ + The name of the convenience store chain where the payment was completed. + """ + + store: Optional[Store] + """ + If the payment succeeded, this contains the details of the convenience store where the payment was completed. + """ + _inner_class_types = {"store": Store} + + class Link(StripeObject): + country: Optional[str] + """ + Two-letter ISO code representing the funding source country beneath the Link payment. + You could use this attribute to get a sense of international fees. + """ + + class Multibanco(StripeObject): + entity: Optional[str] + """ + Entity number associated with this Multibanco payment. + """ + reference: Optional[str] + """ + Reference number associated with this Multibanco payment. + """ + + class Oxxo(StripeObject): + number: Optional[str] + """ + OXXO reference number + """ + + class P24(StripeObject): + bank: Optional[ + Literal[ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "volkswagen_bank", + ] + ] + """ + The customer's bank. Can be one of `ing`, `citi_handlowy`, `tmobile_usbugi_bankowe`, `plus_bank`, `etransfer_pocztowy24`, `banki_spbdzielcze`, `bank_nowy_bfg_sa`, `getin_bank`, `blik`, `noble_pay`, `ideabank`, `envelobank`, `santander_przelew24`, `nest_przelew`, `mbank_mtransfer`, `inteligo`, `pbac_z_ipko`, `bnp_paribas`, `credit_agricole`, `toyota_bank`, `bank_pekao_sa`, `volkswagen_bank`, `bank_millennium`, `alior_bank`, or `boz`. + """ + reference: Optional[str] + """ + Unique reference for this Przelewy24 payment. + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by Przelewy24 directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + Przelewy24 rarely provides this information so the attribute is usually empty. + """ + + class Paynow(StripeObject): + reference: Optional[str] + """ + Reference number associated with this PayNow payment + """ + + class Paypal(StripeObject): + class SellerProtection(StripeObject): + dispute_categories: Optional[ + List[Literal["fraudulent", "product_not_received"]] + ] + """ + An array of conditions that are covered for the transaction, if applicable. + """ + status: Literal[ + "eligible", "not_eligible", "partially_eligible" + ] + """ + Indicates whether the transaction is eligible for PayPal's seller protection. + """ + + payer_email: Optional[str] + """ + Owner's email. Values are provided by PayPal directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + payer_id: Optional[str] + """ + PayPal account PayerID. This identifier uniquely identifies the PayPal customer. + """ + payer_name: Optional[str] + """ + Owner's full name. Values provided by PayPal directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + seller_protection: Optional[SellerProtection] + """ + The level of protection offered as defined by PayPal Seller Protection for Merchants, for this transaction. + """ + transaction_id: Optional[str] + """ + A unique ID generated by PayPal for this transaction. + """ + _inner_class_types = {"seller_protection": SellerProtection} + + class Pix(StripeObject): + bank_transaction_id: Optional[str] + """ + Unique transaction id generated by BCB + """ + + class Promptpay(StripeObject): + reference: Optional[str] + """ + Bill reference generated by PromptPay + """ + + class SepaCreditTransfer(StripeObject): + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + bic: Optional[str] + """ + Bank Identifier Code of the bank associated with the bank account. + """ + iban: Optional[str] + """ + IBAN of the bank account to transfer funds to. + """ + + class SepaDebit(StripeObject): + bank_code: Optional[str] + """ + Bank code of bank associated with the bank account. + """ + branch_code: Optional[str] + """ + Branch code of bank associated with the bank account. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country the bank account is located in. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four characters of the IBAN. + """ + mandate: Optional[str] + """ + ID of the mandate used to make this payment. + """ + + class Sofort(StripeObject): + bank_code: Optional[str] + """ + Bank code of bank associated with the bank account. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + bic: Optional[str] + """ + Bank Identifier Code of the bank associated with the bank account. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country the bank account is located in. + """ + generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]] + """ + The ID of the SEPA Direct Debit PaymentMethod which was generated by this Charge. + """ + generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]] + """ + The mandate for the SEPA Direct Debit PaymentMethod which was generated by this Charge. + """ + iban_last4: Optional[str] + """ + Last four characters of the IBAN. + """ + preferred_language: Optional[ + Literal["de", "en", "es", "fr", "it", "nl", "pl"] + ] + """ + Preferred language of the SOFORT authorization page that the customer is redirected to. + Can be one of `de`, `en`, `es`, `fr`, `it`, `nl`, or `pl` + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by SOFORT directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + + class StripeAccount(StripeObject): + pass + + class UsBankAccount(StripeObject): + account_holder_type: Optional[Literal["company", "individual"]] + """ + Account holder type: individual or company. + """ + account_type: Optional[Literal["checking", "savings"]] + """ + Account type: checkings or savings. Defaults to checking if omitted. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + routing_number: Optional[str] + """ + Routing number of the bank account. + """ + + class Wechat(StripeObject): + pass + + class WechatPay(StripeObject): + fingerprint: Optional[str] + """ + Uniquely identifies this particular WeChat Pay account. You can use this attribute to check whether two WeChat accounts are the same. + """ + transaction_id: Optional[str] + """ + Transaction ID of this particular WeChat Pay transaction. + """ + + class Zip(StripeObject): + pass + + ach_credit_transfer: Optional[AchCreditTransfer] + ach_debit: Optional[AchDebit] + acss_debit: Optional[AcssDebit] + affirm: Optional[Affirm] + afterpay_clearpay: Optional[AfterpayClearpay] + alipay: Optional[Alipay] + au_becs_debit: Optional[AuBecsDebit] + bacs_debit: Optional[BacsDebit] + bancontact: Optional[Bancontact] + blik: Optional[Blik] + boleto: Optional[Boleto] + card: Optional[Card] + card_present: Optional[CardPresent] + cashapp: Optional[Cashapp] + customer_balance: Optional[CustomerBalance] + eps: Optional[Eps] + fpx: Optional[Fpx] + giropay: Optional[Giropay] + grabpay: Optional[Grabpay] + ideal: Optional[Ideal] + interac_present: Optional[InteracPresent] + klarna: Optional[Klarna] + konbini: Optional[Konbini] + link: Optional[Link] + multibanco: Optional[Multibanco] + oxxo: Optional[Oxxo] + p24: Optional[P24] + paynow: Optional[Paynow] + paypal: Optional[Paypal] + pix: Optional[Pix] + promptpay: Optional[Promptpay] + sepa_credit_transfer: Optional[SepaCreditTransfer] + sepa_debit: Optional[SepaDebit] + sofort: Optional[Sofort] + stripe_account: Optional[StripeAccount] + type: str + """ + The type of transaction-specific details of the payment method used in the payment, one of `ach_credit_transfer`, `ach_debit`, `acss_debit`, `alipay`, `au_becs_debit`, `bancontact`, `card`, `card_present`, `eps`, `giropay`, `ideal`, `klarna`, `multibanco`, `p24`, `sepa_debit`, `sofort`, `stripe_account`, or `wechat`. + An additional hash is included on `payment_method_details` with a name matching this value. + It contains information specific to the payment method. + """ + us_bank_account: Optional[UsBankAccount] + wechat: Optional[Wechat] + wechat_pay: Optional[WechatPay] + zip: Optional[Zip] + _inner_class_types = { + "ach_credit_transfer": AchCreditTransfer, + "ach_debit": AchDebit, + "acss_debit": AcssDebit, + "affirm": Affirm, + "afterpay_clearpay": AfterpayClearpay, + "alipay": Alipay, + "au_becs_debit": AuBecsDebit, + "bacs_debit": BacsDebit, + "bancontact": Bancontact, + "blik": Blik, + "boleto": Boleto, + "card": Card, + "card_present": CardPresent, + "cashapp": Cashapp, + "customer_balance": CustomerBalance, + "eps": Eps, + "fpx": Fpx, + "giropay": Giropay, + "grabpay": Grabpay, + "ideal": Ideal, + "interac_present": InteracPresent, + "klarna": Klarna, + "konbini": Konbini, + "link": Link, + "multibanco": Multibanco, + "oxxo": Oxxo, + "p24": P24, + "paynow": Paynow, + "paypal": Paypal, + "pix": Pix, + "promptpay": Promptpay, + "sepa_credit_transfer": SepaCreditTransfer, + "sepa_debit": SepaDebit, + "sofort": Sofort, + "stripe_account": StripeAccount, + "us_bank_account": UsBankAccount, + "wechat": Wechat, + "wechat_pay": WechatPay, + "zip": Zip, + } + + class RadarOptions(StripeObject): + session: Optional[str] + """ + A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. + """ + + class Shipping(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + carrier: Optional[str] + """ + The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + """ + name: Optional[str] + """ + Recipient name. + """ + phone: Optional[str] + """ + Recipient phone (including extension). + """ + tracking_number: Optional[str] + """ + The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + """ + _inner_class_types = {"address": Address} + + class TransferData(StripeObject): + amount: Optional[int] + """ + The amount transferred to the destination account, if specified. By default, the entire charge amount is transferred to the destination account. + """ + destination: ExpandableField["Account"] + """ + ID of an existing, connected Stripe account to transfer funds to if `transfer_data` was specified in the charge request. + """ + if TYPE_CHECKING: class CaptureParams(RequestOptions): @@ -447,7 +2015,7 @@ class SearchParams(RequestOptions): """ ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes). """ - billing_details: StripeObject + billing_details: BillingDetails calculated_statement_descriptor: Optional[str] """ The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined. @@ -490,7 +2058,7 @@ class SearchParams(RequestOptions): """ Message to user further explaining reason for charge failure if available. """ - fraud_details: Optional[StripeObject] + fraud_details: Optional[FraudDetails] """ Information on fraud assessments for the charge. """ @@ -502,7 +2070,7 @@ class SearchParams(RequestOptions): """ ID of the invoice this charge is for if one exists. """ - level3: Optional[StripeObject] + level3: Optional[Level3] livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -519,7 +2087,7 @@ class SearchParams(RequestOptions): """ The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the [Connect documentation](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. """ - outcome: Optional[StripeObject] + outcome: Optional[Outcome] """ Details about whether the payment was accepted, and why. See [understanding declines](https://stripe.com/docs/declines) for details. """ @@ -535,11 +2103,11 @@ class SearchParams(RequestOptions): """ ID of the payment method used in this charge. """ - payment_method_details: Optional[StripeObject] + payment_method_details: Optional[PaymentMethodDetails] """ Details about the payment method at the time of the transaction. """ - radar_options: Optional[StripeObject] + radar_options: Optional[RadarOptions] """ Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. """ @@ -567,11 +2135,11 @@ class SearchParams(RequestOptions): """ ID of the review associated with this charge if one exists. """ - shipping: Optional[StripeObject] + shipping: Optional[Shipping] """ Shipping information for the charge. """ - source: Optional[Union["Account", "BankAccount", "Card", "Source"]] + source: Optional[Union["Account", "BankAccount", "CardResource", "Source"]] """ This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to `payment_method` or `payment_method_details` instead. """ @@ -595,7 +2163,7 @@ class SearchParams(RequestOptions): """ ID of the transfer to the `destination` account (only applicable if the charge was created using the `destination` parameter). """ - transfer_data: Optional[StripeObject] + transfer_data: Optional[TransferData] """ An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. """ @@ -755,3 +2323,14 @@ def mark_as_safe(self, idempotency_key=None): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + _inner_class_types = { + "billing_details": BillingDetails, + "fraud_details": FraudDetails, + "level3": Level3, + "outcome": Outcome, + "payment_method_details": PaymentMethodDetails, + "radar_options": RadarOptions, + "shipping": Shipping, + "transfer_data": TransferData, + } diff --git a/stripe/api_resources/checkout/session.py b/stripe/api_resources/checkout/session.py index 918ac61e1..5caeee8ca 100644 --- a/stripe/api_resources/checkout/session.py +++ b/stripe/api_resources/checkout/session.py @@ -21,12 +21,16 @@ if TYPE_CHECKING: from stripe.api_resources.customer import Customer + from stripe.api_resources.discount import Discount as DiscountResource from stripe.api_resources.invoice import Invoice from stripe.api_resources.line_item import LineItem from stripe.api_resources.payment_intent import PaymentIntent from stripe.api_resources.payment_link import PaymentLink from stripe.api_resources.setup_intent import SetupIntent + from stripe.api_resources.shipping_rate import ShippingRate from stripe.api_resources.subscription import Subscription + from stripe.api_resources.tax_id import TaxId as TaxIdResource + from stripe.api_resources.tax_rate import TaxRate class Session( @@ -50,6 +54,1324 @@ class Session( """ OBJECT_NAME: ClassVar[Literal["checkout.session"]] = "checkout.session" + + class AfterExpiration(StripeObject): + class Recovery(StripeObject): + allow_promotion_codes: bool + """ + Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to `false` + """ + enabled: bool + """ + If `true`, a recovery url will be generated to recover this Checkout Session if it + expires before a transaction is completed. It will be attached to the + Checkout Session object upon expiration. + """ + expires_at: Optional[int] + """ + The timestamp at which the recovery URL will expire. + """ + url: Optional[str] + """ + URL that creates a new Checkout Session when clicked that is a copy of this expired Checkout Session + """ + + recovery: Optional[Recovery] + """ + When set, configuration used to recover the Checkout Session on expiry. + """ + _inner_class_types = {"recovery": Recovery} + + class AutomaticTax(StripeObject): + enabled: bool + """ + Indicates whether automatic tax is enabled for the session + """ + status: Optional[ + Literal["complete", "failed", "requires_location_inputs"] + ] + """ + The status of the most recent automated tax calculation for this session. + """ + + class Consent(StripeObject): + promotions: Optional[Literal["opt_in", "opt_out"]] + """ + If `opt_in`, the customer consents to receiving promotional communications + from the merchant about this Checkout Session. + """ + terms_of_service: Optional[Literal["accepted"]] + """ + If `accepted`, the customer in this Checkout Session has agreed to the merchant's terms of service. + """ + + class ConsentCollection(StripeObject): + promotions: Optional[Literal["auto", "none"]] + """ + If set to `auto`, enables the collection of customer consent for promotional communications. The Checkout + Session will determine whether to display an option to opt into promotional communication + from the merchant depending on the customer's locale. Only available to US merchants. + """ + terms_of_service: Optional[Literal["none", "required"]] + """ + If set to `required`, it requires customers to accept the terms of service before being able to pay. + """ + + class CurrencyConversion(StripeObject): + amount_subtotal: int + """ + Total of all items in source currency before discounts or taxes are applied. + """ + amount_total: int + """ + Total of all items in source currency after discounts and taxes are applied. + """ + fx_rate: str + """ + Exchange rate used to convert source currency amounts to customer currency amounts + """ + source_currency: str + """ + Creation currency of the CheckoutSession before localization + """ + + class CustomField(StripeObject): + class Dropdown(StripeObject): + class Option(StripeObject): + label: str + """ + The label for the option, displayed to the customer. Up to 100 characters. + """ + value: str + """ + The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters. + """ + + options: List[Option] + """ + The options available for the customer to select. Up to 200 options allowed. + """ + value: Optional[str] + """ + The option selected by the customer. This will be the `value` for the option. + """ + _inner_class_types = {"options": Option} + + class Label(StripeObject): + custom: Optional[str] + """ + Custom text for the label, displayed to the customer. Up to 50 characters. + """ + type: Literal["custom"] + """ + The type of the label. + """ + + class Numeric(StripeObject): + maximum_length: Optional[int] + """ + The maximum character length constraint for the customer's input. + """ + minimum_length: Optional[int] + """ + The minimum character length requirement for the customer's input. + """ + value: Optional[str] + """ + The value entered by the customer, containing only digits. + """ + + class Text(StripeObject): + maximum_length: Optional[int] + """ + The maximum character length constraint for the customer's input. + """ + minimum_length: Optional[int] + """ + The minimum character length requirement for the customer's input. + """ + value: Optional[str] + """ + The value entered by the customer. + """ + + dropdown: Optional[Dropdown] + key: str + """ + String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters. + """ + label: Label + numeric: Optional[Numeric] + optional: bool + """ + Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`. + """ + text: Optional[Text] + type: Literal["dropdown", "numeric", "text"] + """ + The type of the field. + """ + _inner_class_types = { + "dropdown": Dropdown, + "label": Label, + "numeric": Numeric, + "text": Text, + } + + class CustomText(StripeObject): + class ShippingAddress(StripeObject): + message: str + """ + Text may be up to 1200 characters in length. + """ + + class Submit(StripeObject): + message: str + """ + Text may be up to 1200 characters in length. + """ + + class TermsOfServiceAcceptance(StripeObject): + message: str + """ + Text may be up to 1200 characters in length. + """ + + shipping_address: Optional[ShippingAddress] + """ + Custom text that should be displayed alongside shipping address collection. + """ + submit: Optional[Submit] + """ + Custom text that should be displayed alongside the payment confirmation button. + """ + terms_of_service_acceptance: Optional[TermsOfServiceAcceptance] + """ + Custom text that should be displayed in place of the default terms of service agreement text. + """ + _inner_class_types = { + "shipping_address": ShippingAddress, + "submit": Submit, + "terms_of_service_acceptance": TermsOfServiceAcceptance, + } + + class CustomerDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class TaxId(StripeObject): + type: Literal[ + "ad_nrt", + "ae_trn", + "ar_cuit", + "au_abn", + "au_arn", + "bg_uic", + "bo_tin", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sv_nit", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "unknown", + "us_ein", + "uy_ruc", + "ve_rif", + "vn_tin", + "za_vat", + ] + """ + The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, or `unknown` + """ + value: Optional[str] + """ + The value of the tax ID. + """ + + address: Optional[Address] + """ + The customer's address after a completed Checkout Session. Note: This property is populated only for sessions on or after March 30, 2022. + """ + email: Optional[str] + """ + The email associated with the Customer, if one exists, on the Checkout Session after a completed Checkout Session or at time of session expiry. + Otherwise, if the customer has consented to promotional content, this value is the most recent valid email provided by the customer on the Checkout form. + """ + name: Optional[str] + """ + The customer's name after a completed Checkout Session. Note: This property is populated only for sessions on or after March 30, 2022. + """ + phone: Optional[str] + """ + The customer's phone number after a completed Checkout Session. + """ + tax_exempt: Optional[Literal["exempt", "none", "reverse"]] + """ + The customer's tax exempt status after a completed Checkout Session. + """ + tax_ids: Optional[List[TaxId]] + """ + The customer's tax IDs after a completed Checkout Session. + """ + _inner_class_types = {"address": Address, "tax_ids": TaxId} + + class InvoiceCreation(StripeObject): + class InvoiceData(StripeObject): + class CustomField(StripeObject): + name: str + """ + The name of the custom field. + """ + value: str + """ + The value of the custom field. + """ + + class RenderingOptions(StripeObject): + amount_tax_display: Optional[str] + """ + How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + """ + + account_tax_ids: Optional[List[ExpandableField["TaxIdResource"]]] + """ + The account tax IDs associated with the invoice. + """ + custom_fields: Optional[List[CustomField]] + """ + Custom fields displayed on the invoice. + """ + description: Optional[str] + """ + An arbitrary string attached to the object. Often useful for displaying to users. + """ + footer: Optional[str] + """ + Footer displayed on the invoice. + """ + metadata: Optional[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. + """ + rendering_options: Optional[RenderingOptions] + """ + Options for invoice PDF rendering. + """ + _inner_class_types = { + "custom_fields": CustomField, + "rendering_options": RenderingOptions, + } + + enabled: bool + """ + Indicates whether invoice creation is enabled for the Checkout Session. + """ + invoice_data: InvoiceData + _inner_class_types = {"invoice_data": InvoiceData} + + class PaymentMethodConfigurationDetails(StripeObject): + id: str + """ + ID of the payment method configuration used. + """ + parent: Optional[str] + """ + ID of the parent payment method configuration used. + """ + + class PaymentMethodOptions(StripeObject): + class AcssDebit(StripeObject): + class MandateOptions(StripeObject): + custom_mandate_url: Optional[str] + """ + A URL for custom mandate text + """ + default_for: Optional[List[Literal["invoice", "subscription"]]] + """ + List of Stripe products where this mandate can be selected automatically. Returned when the Session is in `setup` mode. + """ + interval_description: Optional[str] + """ + Description of the interval. Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. + """ + payment_schedule: Optional[ + Literal["combined", "interval", "sporadic"] + ] + """ + Payment schedule for the mandate. + """ + transaction_type: Optional[Literal["business", "personal"]] + """ + Transaction type of the mandate. + """ + + currency: Optional[Literal["cad", "usd"]] + """ + Currency supported by the bank account. Returned when the Session is in `setup` mode. + """ + mandate_options: Optional[MandateOptions] + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = {"mandate_options": MandateOptions} + + class Affirm(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class AfterpayClearpay(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Alipay(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class AuBecsDebit(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class BacsDebit(StripeObject): + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Bancontact(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Boleto(StripeObject): + expires_after_days: int + """ + The number of calendar days before a Boleto voucher expires. For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto voucher will expire on Wednesday at 23:59 America/Sao_Paulo time. + """ + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Card(StripeObject): + class Installments(StripeObject): + enabled: Optional[bool] + """ + Indicates if installments are enabled + """ + + installments: Optional[Installments] + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + statement_descriptor_suffix_kana: Optional[str] + """ + Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters. + """ + statement_descriptor_suffix_kanji: Optional[str] + """ + Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. + """ + _inner_class_types = {"installments": Installments} + + class Cashapp(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class CustomerBalance(StripeObject): + class BankTransfer(StripeObject): + class EuBankTransfer(StripeObject): + country: Literal["BE", "DE", "ES", "FR", "IE", "NL"] + """ + The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. + """ + + eu_bank_transfer: Optional[EuBankTransfer] + requested_address_types: Optional[ + List[ + Literal[ + "aba", + "iban", + "sepa", + "sort_code", + "spei", + "swift", + "zengin", + ] + ] + ] + """ + List of address types that should be returned in the financial_addresses response. If not specified, all valid types will be returned. + + Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. + """ + type: Optional[ + Literal[ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ] + ] + """ + The bank transfer type that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. + """ + _inner_class_types = {"eu_bank_transfer": EuBankTransfer} + + bank_transfer: Optional[BankTransfer] + funding_type: Optional[Literal["bank_transfer"]] + """ + The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + _inner_class_types = {"bank_transfer": BankTransfer} + + class Eps(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Fpx(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Giropay(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Grabpay(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Ideal(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Klarna(StripeObject): + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Konbini(StripeObject): + expires_after_days: Optional[int] + """ + The number of calendar days (between 1 and 60) after which Konbini payment instructions will expire. For example, if a PaymentIntent is confirmed with Konbini and `expires_after_days` set to 2 on Monday JST, the instructions will expire on Wednesday 23:59:59 JST. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Link(StripeObject): + setup_future_usage: Optional[Literal["none", "off_session"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Oxxo(StripeObject): + expires_after_days: int + """ + The number of calendar days before an OXXO invoice expires. For example, if you create an OXXO invoice on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class P24(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Paynow(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Pix(StripeObject): + expires_after_seconds: Optional[int] + """ + The number of seconds after which Pix payment will expire. + """ + + class SepaDebit(StripeObject): + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Sofort(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class UsBankAccount(StripeObject): + class FinancialConnections(StripeObject): + permissions: Optional[ + List[ + Literal[ + "balances", + "ownership", + "payment_method", + "transactions", + ] + ] + ] + """ + The list of permissions to request. The `payment_method` permission must be included. + """ + prefetch: Optional[List[Literal["balances"]]] + """ + Data features requested to be retrieved upon account creation. + """ + return_url: Optional[str] + """ + For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. + """ + + financial_connections: Optional[FinancialConnections] + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + verification_method: Optional[Literal["automatic", "instant"]] + """ + Bank account verification method. + """ + _inner_class_types = { + "financial_connections": FinancialConnections + } + + acss_debit: Optional[AcssDebit] + affirm: Optional[Affirm] + afterpay_clearpay: Optional[AfterpayClearpay] + alipay: Optional[Alipay] + au_becs_debit: Optional[AuBecsDebit] + bacs_debit: Optional[BacsDebit] + bancontact: Optional[Bancontact] + boleto: Optional[Boleto] + card: Optional[Card] + cashapp: Optional[Cashapp] + customer_balance: Optional[CustomerBalance] + eps: Optional[Eps] + fpx: Optional[Fpx] + giropay: Optional[Giropay] + grabpay: Optional[Grabpay] + ideal: Optional[Ideal] + klarna: Optional[Klarna] + konbini: Optional[Konbini] + link: Optional[Link] + oxxo: Optional[Oxxo] + p24: Optional[P24] + paynow: Optional[Paynow] + pix: Optional[Pix] + sepa_debit: Optional[SepaDebit] + sofort: Optional[Sofort] + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "acss_debit": AcssDebit, + "affirm": Affirm, + "afterpay_clearpay": AfterpayClearpay, + "alipay": Alipay, + "au_becs_debit": AuBecsDebit, + "bacs_debit": BacsDebit, + "bancontact": Bancontact, + "boleto": Boleto, + "card": Card, + "cashapp": Cashapp, + "customer_balance": CustomerBalance, + "eps": Eps, + "fpx": Fpx, + "giropay": Giropay, + "grabpay": Grabpay, + "ideal": Ideal, + "klarna": Klarna, + "konbini": Konbini, + "link": Link, + "oxxo": Oxxo, + "p24": P24, + "paynow": Paynow, + "pix": Pix, + "sepa_debit": SepaDebit, + "sofort": Sofort, + "us_bank_account": UsBankAccount, + } + + class PhoneNumberCollection(StripeObject): + enabled: bool + """ + Indicates whether phone number collection is enabled for the session + """ + + class ShippingAddressCollection(StripeObject): + allowed_countries: List[ + Literal[ + "AC", + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MK", + "ML", + "MM", + "MN", + "MO", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TA", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + "ZZ", + ] + ] + """ + An array of two-letter ISO country codes representing which countries Checkout should provide as options for + shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. + """ + + class ShippingCost(StripeObject): + class Tax(StripeObject): + amount: int + """ + Amount of tax applied for this rate. + """ + rate: "TaxRate" + """ + Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + + Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + + amount_subtotal: int + """ + Total shipping cost before any discounts or taxes are applied. + """ + amount_tax: int + """ + Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0. + """ + amount_total: int + """ + Total shipping cost after discounts and taxes are applied. + """ + shipping_rate: Optional[ExpandableField["ShippingRate"]] + """ + The ID of the ShippingRate for this order. + """ + taxes: Optional[List[Tax]] + """ + The taxes applied to the shipping rate. + """ + _inner_class_types = {"taxes": Tax} + + class ShippingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + carrier: Optional[str] + """ + The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + """ + name: Optional[str] + """ + Recipient name. + """ + phone: Optional[str] + """ + Recipient phone (including extension). + """ + tracking_number: Optional[str] + """ + The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + """ + _inner_class_types = {"address": Address} + + class ShippingOption(StripeObject): + shipping_amount: int + """ + A non-negative integer in cents representing how much to charge. + """ + shipping_rate: ExpandableField["ShippingRate"] + """ + The shipping rate. + """ + + class TaxIdCollection(StripeObject): + enabled: bool + """ + Indicates whether tax ID collection is enabled for the session + """ + + class TotalDetails(StripeObject): + class Breakdown(StripeObject): + class Discount(StripeObject): + amount: int + """ + The amount discounted. + """ + discount: "DiscountResource" + """ + A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). + It contains information about when the discount began, when it will end, and what it is applied to. + + Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) + """ + + class Tax(StripeObject): + amount: int + """ + Amount of tax applied for this rate. + """ + rate: "TaxRate" + """ + Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + + Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + + discounts: List[Discount] + """ + The aggregated discounts. + """ + taxes: List[Tax] + """ + The aggregated tax amounts by rate. + """ + _inner_class_types = {"discounts": Discount, "taxes": Tax} + + amount_discount: int + """ + This is the sum of all the discounts. + """ + amount_shipping: Optional[int] + """ + This is the sum of all the shipping amounts. + """ + amount_tax: int + """ + This is the sum of all the tax amounts. + """ + breakdown: Optional[Breakdown] + _inner_class_types = {"breakdown": Breakdown} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -2000,7 +3322,7 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - after_expiration: Optional[StripeObject] + after_expiration: Optional[AfterExpiration] """ When set, provides configuration for actions to take if this Checkout Session expires. """ @@ -2016,7 +3338,7 @@ class RetrieveParams(RequestOptions): """ Total of all items after discounts and taxes are applied. """ - automatic_tax: StripeObject + automatic_tax: AutomaticTax billing_address_collection: Optional[Literal["auto", "required"]] """ Describes whether Checkout should collect the customer's billing address. @@ -2035,11 +3357,11 @@ class RetrieveParams(RequestOptions): """ Client secret to be used when initializing Stripe.js embedded checkout. """ - consent: Optional[StripeObject] + consent: Optional[Consent] """ Results of `consent_collection` for this session. """ - consent_collection: Optional[StripeObject] + consent_collection: Optional[ConsentCollection] """ When set, provides configuration for the Checkout Session to gather active consent from customers. """ @@ -2051,15 +3373,15 @@ class RetrieveParams(RequestOptions): """ 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). """ - currency_conversion: Optional[StripeObject] + currency_conversion: Optional[CurrencyConversion] """ Currency conversion details for automatic currency conversion sessions """ - custom_fields: List[StripeObject] + custom_fields: List[CustomField] """ Collect additional information from your customer using custom fields. Up to 2 fields are supported. """ - custom_text: StripeObject + custom_text: CustomText customer: Optional[ExpandableField["Customer"]] """ The ID of the customer for this Session. @@ -2072,7 +3394,7 @@ class RetrieveParams(RequestOptions): """ Configure whether a Checkout Session creates a Customer when the Checkout Session completes. """ - customer_details: Optional[StripeObject] + customer_details: Optional[CustomerDetails] """ The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in `setup` mode. """ @@ -2096,7 +3418,7 @@ class RetrieveParams(RequestOptions): """ ID of the invoice created by the Checkout Session, if it exists. """ - invoice_creation: Optional[StripeObject] + invoice_creation: Optional[InvoiceCreation] """ Details on the state of invoice creation for the Checkout Session. """ @@ -2180,11 +3502,13 @@ class RetrieveParams(RequestOptions): """ Configure whether a Checkout Session should collect a payment method. """ - payment_method_configuration_details: Optional[StripeObject] + payment_method_configuration_details: Optional[ + PaymentMethodConfigurationDetails + ] """ Information about the payment method configuration used for this Checkout session if using dynamic payment methods. """ - payment_method_options: Optional[StripeObject] + payment_method_options: Optional[PaymentMethodOptions] """ Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession. """ @@ -2198,7 +3522,7 @@ class RetrieveParams(RequestOptions): The payment status of the Checkout Session, one of `paid`, `unpaid`, or `no_payment_required`. You can use this value to decide when to fulfill your customer's order. """ - phone_number_collection: Optional[StripeObject] + phone_number_collection: Optional[PhoneNumberCollection] recovered_from: Optional[str] """ The ID of the original expired Checkout Session that triggered the recovery flow. @@ -2215,19 +3539,19 @@ class RetrieveParams(RequestOptions): """ The ID of the SetupIntent for Checkout Sessions in `setup` mode. """ - shipping_address_collection: Optional[StripeObject] + shipping_address_collection: Optional[ShippingAddressCollection] """ When set, provides configuration for Checkout to collect a shipping address from a customer. """ - shipping_cost: Optional[StripeObject] + shipping_cost: Optional[ShippingCost] """ The details of the customer cost of shipping, including the customer chosen ShippingRate. """ - shipping_details: Optional[StripeObject] + shipping_details: Optional[ShippingDetails] """ Shipping information for this Checkout Session. """ - shipping_options: List[StripeObject] + shipping_options: List[ShippingOption] """ The shipping rate options applied to this Session. """ @@ -2251,8 +3575,8 @@ class RetrieveParams(RequestOptions): The URL the customer will be directed to after the payment or subscription creation is successful. """ - tax_id_collection: Optional[StripeObject] - total_details: Optional[StripeObject] + tax_id_collection: Optional[TaxIdCollection] + total_details: Optional[TotalDetails] """ Tax and discount details for the computed total amount. """ @@ -2442,3 +3766,24 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "after_expiration": AfterExpiration, + "automatic_tax": AutomaticTax, + "consent": Consent, + "consent_collection": ConsentCollection, + "currency_conversion": CurrencyConversion, + "custom_fields": CustomField, + "custom_text": CustomText, + "customer_details": CustomerDetails, + "invoice_creation": InvoiceCreation, + "payment_method_configuration_details": PaymentMethodConfigurationDetails, + "payment_method_options": PaymentMethodOptions, + "phone_number_collection": PhoneNumberCollection, + "shipping_address_collection": ShippingAddressCollection, + "shipping_cost": ShippingCost, + "shipping_details": ShippingDetails, + "shipping_options": ShippingOption, + "tax_id_collection": TaxIdCollection, + "total_details": TotalDetails, + } diff --git a/stripe/api_resources/country_spec.py b/stripe/api_resources/country_spec.py index 702917243..9e71b433e 100644 --- a/stripe/api_resources/country_spec.py +++ b/stripe/api_resources/country_spec.py @@ -19,6 +19,32 @@ class CountrySpec(ListableAPIResource["CountrySpec"]): """ OBJECT_NAME: ClassVar[Literal["country_spec"]] = "country_spec" + + class VerificationFields(StripeObject): + class Company(StripeObject): + additional: List[str] + """ + Additional fields which are only required for some users. + """ + minimum: List[str] + """ + Fields which every account must eventually provide. + """ + + class Individual(StripeObject): + additional: List[str] + """ + Additional fields which are only required for some users. + """ + minimum: List[str] + """ + Fields which every account must eventually provide. + """ + + company: Company + individual: Individual + _inner_class_types = {"company": Company, "individual": Individual} + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -73,7 +99,7 @@ class RetrieveParams(RequestOptions): """ Countries that can accept transfers from the specified country. """ - verification_fields: StripeObject + verification_fields: VerificationFields @classmethod def list( @@ -107,3 +133,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"verification_fields": VerificationFields} diff --git a/stripe/api_resources/coupon.py b/stripe/api_resources/coupon.py index c846e3b6f..f98a2af07 100644 --- a/stripe/api_resources/coupon.py +++ b/stripe/api_resources/coupon.py @@ -34,6 +34,19 @@ class Coupon( """ OBJECT_NAME: ClassVar[Literal["coupon"]] = "coupon" + + class AppliesTo(StripeObject): + products: List[str] + """ + A list of product IDs this coupon applies to + """ + + class CurrencyOptions(StripeObject): + amount_off: int + """ + Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -185,7 +198,7 @@ class RetrieveParams(RequestOptions): """ Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer. """ - applies_to: Optional[StripeObject] + applies_to: Optional[AppliesTo] created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -194,7 +207,7 @@ class RetrieveParams(RequestOptions): """ If `amount_off` has been set, the three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the amount to take off. """ - currency_options: Optional[Dict[str, StripeObject]] + currency_options: Optional[Dict[str, CurrencyOptions]] """ Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). """ @@ -346,3 +359,8 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "applies_to": AppliesTo, + "currency_options": CurrencyOptions, + } diff --git a/stripe/api_resources/credit_note.py b/stripe/api_resources/credit_note.py index b97b91d14..fd7e2456b 100644 --- a/stripe/api_resources/credit_note.py +++ b/stripe/api_resources/credit_note.py @@ -28,8 +28,11 @@ from stripe.api_resources.customer_balance_transaction import ( CustomerBalanceTransaction, ) + from stripe.api_resources.discount import Discount from stripe.api_resources.invoice import Invoice from stripe.api_resources.refund import Refund + from stripe.api_resources.shipping_rate import ShippingRate + from stripe.api_resources.tax_rate import TaxRate @nested_resource_class_methods("line") @@ -45,6 +48,118 @@ class CreditNote( """ OBJECT_NAME: ClassVar[Literal["credit_note"]] = "credit_note" + + class DiscountAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the discount. + """ + discount: ExpandableField["Discount"] + """ + The discount that was applied to get this discount amount. + """ + + class ShippingCost(StripeObject): + class Tax(StripeObject): + amount: int + """ + Amount of tax applied for this rate. + """ + rate: "TaxRate" + """ + Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + + Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + + amount_subtotal: int + """ + Total shipping cost before any taxes are applied. + """ + amount_tax: int + """ + Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0. + """ + amount_total: int + """ + Total shipping cost after taxes are applied. + """ + shipping_rate: Optional[ExpandableField["ShippingRate"]] + """ + The ID of the ShippingRate for this invoice. + """ + taxes: Optional[List[Tax]] + """ + The taxes applied to the shipping rate. + """ + _inner_class_types = {"taxes": Tax} + + class TaxAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the tax. + """ + inclusive: bool + """ + Whether this tax amount is inclusive or exclusive. + """ + tax_rate: ExpandableField["TaxRate"] + """ + The tax rate that was applied to get this tax amount. + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -453,7 +568,7 @@ class ListLinesParams(RequestOptions): """ The integer amount in cents (or local equivalent) representing the total amount of discount that was credited. """ - discount_amounts: List[StripeObject] + discount_amounts: List[DiscountAmount] """ The aggregate amounts calculated per discount for all line items. """ @@ -513,7 +628,7 @@ class ListLinesParams(RequestOptions): """ Refund related to this credit note. """ - shipping_cost: Optional[StripeObject] + shipping_cost: Optional[ShippingCost] """ The details of the cost of shipping, including the ShippingRate applied to the invoice. """ @@ -529,7 +644,7 @@ class ListLinesParams(RequestOptions): """ The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding all tax and invoice level discounts. """ - tax_amounts: List[StripeObject] + tax_amounts: List[TaxAmount] """ The aggregate amounts calculated per tax rate for all line items. """ @@ -736,3 +851,9 @@ def list_lines( params=params, ), ) + + _inner_class_types = { + "discount_amounts": DiscountAmount, + "shipping_cost": ShippingCost, + "tax_amounts": TaxAmount, + } diff --git a/stripe/api_resources/credit_note_line_item.py b/stripe/api_resources/credit_note_line_item.py index eb4dad793..474fcc15c 100644 --- a/stripe/api_resources/credit_note_line_item.py +++ b/stripe/api_resources/credit_note_line_item.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe.api_resources.abstract import ListableAPIResource +from stripe.api_resources.expandable_field import ExpandableField from stripe.api_resources.list_object import ListObject from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject @@ -8,6 +9,7 @@ from typing_extensions import Literal, NotRequired, Unpack, TYPE_CHECKING if TYPE_CHECKING: + from stripe.api_resources.discount import Discount from stripe.api_resources.tax_rate import TaxRate @@ -19,6 +21,57 @@ class CreditNoteLineItem(ListableAPIResource["CreditNoteLineItem"]): OBJECT_NAME: ClassVar[ Literal["credit_note_line_item"] ] = "credit_note_line_item" + + class DiscountAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the discount. + """ + discount: ExpandableField["Discount"] + """ + The discount that was applied to get this discount amount. + """ + + class TaxAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the tax. + """ + inclusive: bool + """ + Whether this tax amount is inclusive or exclusive. + """ + tax_rate: ExpandableField["TaxRate"] + """ + The tax rate that was applied to get this tax amount. + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -55,7 +108,7 @@ class ListParams(RequestOptions): """ The integer amount in cents (or local equivalent) representing the discount being credited for this line item. """ - discount_amounts: List[StripeObject] + discount_amounts: List[DiscountAmount] """ The amount of discount calculated per discount for this line item """ @@ -79,7 +132,7 @@ class ListParams(RequestOptions): """ The number of units of product being credited. """ - tax_amounts: List[StripeObject] + tax_amounts: List[TaxAmount] """ The amount of tax calculated per tax rate for this line item """ @@ -128,3 +181,8 @@ def list( ) return result + + _inner_class_types = { + "discount_amounts": DiscountAmount, + "tax_amounts": TaxAmount, + } diff --git a/stripe/api_resources/customer.py b/stripe/api_resources/customer.py index fca0e4426..d37d05fbd 100644 --- a/stripe/api_resources/customer.py +++ b/stripe/api_resources/customer.py @@ -74,6 +74,153 @@ class Customer( """ OBJECT_NAME: ClassVar[Literal["customer"]] = "customer" + + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class InvoiceSettings(StripeObject): + class CustomField(StripeObject): + name: str + """ + The name of the custom field. + """ + value: str + """ + The value of the custom field. + """ + + class RenderingOptions(StripeObject): + amount_tax_display: Optional[str] + """ + How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + """ + + custom_fields: Optional[List[CustomField]] + """ + Default custom fields to be displayed on invoices for this customer. + """ + default_payment_method: Optional[ExpandableField["PaymentMethod"]] + """ + ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices. + """ + footer: Optional[str] + """ + Default footer to be displayed on invoices for this customer. + """ + rendering_options: Optional[RenderingOptions] + """ + Default options for invoice PDF rendering for this customer. + """ + _inner_class_types = { + "custom_fields": CustomField, + "rendering_options": RenderingOptions, + } + + class Shipping(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + carrier: Optional[str] + """ + The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + """ + name: Optional[str] + """ + Recipient name. + """ + phone: Optional[str] + """ + Recipient phone (including extension). + """ + tracking_number: Optional[str] + """ + The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + """ + _inner_class_types = {"address": Address} + + class Tax(StripeObject): + class Location(StripeObject): + country: str + """ + The customer's country as identified by Stripe Tax. + """ + source: Literal[ + "billing_address", + "ip_address", + "payment_method", + "shipping_destination", + ] + """ + The data source used to infer the customer's location. + """ + state: Optional[str] + """ + The customer's state, county, province, or region as identified by Stripe Tax. + """ + + automatic_tax: Literal[ + "failed", "not_collecting", "supported", "unrecognized_location" + ] + """ + Surfaces if automatic tax computation is possible given the current customer location information. + """ + ip_address: Optional[str] + """ + A recent IP address of the customer used for tax reporting and tax location inference. + """ + location: Optional[Location] + """ + The customer's location as identified by Stripe Tax. + """ + _inner_class_types = {"location": Location} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -1137,7 +1284,7 @@ class ListTaxIdsParams(RequestOptions): 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. """ - address: Optional[StripeObject] + address: Optional[Address] """ The customer's address. """ @@ -1197,7 +1344,7 @@ class ListTaxIdsParams(RequestOptions): """ The prefix for the customer used to generate unique invoice numbers. """ - invoice_settings: Optional[StripeObject] + invoice_settings: Optional[InvoiceSettings] livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -1226,7 +1373,7 @@ class ListTaxIdsParams(RequestOptions): """ The customer's preferred locales (languages), ordered by preference. """ - shipping: Optional[StripeObject] + shipping: Optional[Shipping] """ Mailing and shipping address for the customer. Appears on invoices emailed to this customer. """ @@ -1240,7 +1387,7 @@ class ListTaxIdsParams(RequestOptions): """ The customer's current subscriptions, if any. """ - tax: Optional[StripeObject] + tax: Optional[Tax] tax_exempt: Optional[Literal["exempt", "none", "reverse"]] """ Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`. When set to `reverse`, invoice and receipt PDFs include the following text: **"Reverse charge"**. @@ -2091,5 +2238,12 @@ def fund_cash_balance( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "address": Address, + "invoice_settings": InvoiceSettings, + "shipping": Shipping, + "tax": Tax, + } + Customer.TestHelpers._resource_cls = Customer diff --git a/stripe/api_resources/customer_cash_balance_transaction.py b/stripe/api_resources/customer_cash_balance_transaction.py index b3bc46e4b..89b5599f5 100644 --- a/stripe/api_resources/customer_cash_balance_transaction.py +++ b/stripe/api_resources/customer_cash_balance_transaction.py @@ -9,7 +9,10 @@ from typing_extensions import Literal, NotRequired, Unpack, TYPE_CHECKING if TYPE_CHECKING: + from stripe.api_resources.balance_transaction import BalanceTransaction from stripe.api_resources.customer import Customer + from stripe.api_resources.payment_intent import PaymentIntent + from stripe.api_resources.refund import Refund class CustomerCashBalanceTransaction( @@ -25,6 +28,117 @@ class CustomerCashBalanceTransaction( OBJECT_NAME: ClassVar[ Literal["customer_cash_balance_transaction"] ] = "customer_cash_balance_transaction" + + class AdjustedForOverdraft(StripeObject): + balance_transaction: ExpandableField["BalanceTransaction"] + """ + The [Balance Transaction](https://stripe.com/docs/api/balance_transactions/object) that corresponds to funds taken out of your Stripe balance. + """ + linked_transaction: ExpandableField["CustomerCashBalanceTransaction"] + """ + The [Cash Balance Transaction](https://stripe.com/docs/api/cash_balance_transactions/object) that brought the customer balance negative, triggering the clawback of funds. + """ + + class AppliedToPayment(StripeObject): + payment_intent: ExpandableField["PaymentIntent"] + """ + The [Payment Intent](https://stripe.com/docs/api/payment_intents/object) that funds were applied to. + """ + + class Funded(StripeObject): + class BankTransfer(StripeObject): + class EuBankTransfer(StripeObject): + bic: Optional[str] + """ + The BIC of the bank of the sender of the funding. + """ + iban_last4: Optional[str] + """ + The last 4 digits of the IBAN of the sender of the funding. + """ + sender_name: Optional[str] + """ + The full name of the sender, as supplied by the sending bank. + """ + + class GbBankTransfer(StripeObject): + account_number_last4: Optional[str] + """ + The last 4 digits of the account number of the sender of the funding. + """ + sender_name: Optional[str] + """ + The full name of the sender, as supplied by the sending bank. + """ + sort_code: Optional[str] + """ + The sort code of the bank of the sender of the funding + """ + + class JpBankTransfer(StripeObject): + sender_bank: Optional[str] + """ + The name of the bank of the sender of the funding. + """ + sender_branch: Optional[str] + """ + The name of the bank branch of the sender of the funding. + """ + sender_name: Optional[str] + """ + The full name of the sender, as supplied by the sending bank. + """ + + class UsBankTransfer(StripeObject): + network: Optional[Literal["ach", "domestic_wire_us", "swift"]] + """ + The banking network used for this funding. + """ + sender_name: Optional[str] + """ + The full name of the sender, as supplied by the sending bank. + """ + + eu_bank_transfer: Optional[EuBankTransfer] + gb_bank_transfer: Optional[GbBankTransfer] + jp_bank_transfer: Optional[JpBankTransfer] + reference: Optional[str] + """ + The user-supplied reference field on the bank transfer. + """ + type: Literal[ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ] + """ + The funding method type used to fund the customer balance. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. + """ + us_bank_transfer: Optional[UsBankTransfer] + _inner_class_types = { + "eu_bank_transfer": EuBankTransfer, + "gb_bank_transfer": GbBankTransfer, + "jp_bank_transfer": JpBankTransfer, + "us_bank_transfer": UsBankTransfer, + } + + bank_transfer: BankTransfer + _inner_class_types = {"bank_transfer": BankTransfer} + + class RefundedFromPayment(StripeObject): + refund: ExpandableField["Refund"] + """ + The [Refund](https://stripe.com/docs/api/refunds/object) that moved these funds into the customer's cash balance. + """ + + class UnappliedFromPayment(StripeObject): + payment_intent: ExpandableField["PaymentIntent"] + """ + The [Payment Intent](https://stripe.com/docs/api/payment_intents/object) that funds were unapplied from. + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -51,8 +165,8 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - adjusted_for_overdraft: Optional[StripeObject] - applied_to_payment: Optional[StripeObject] + adjusted_for_overdraft: Optional[AdjustedForOverdraft] + applied_to_payment: Optional[AppliedToPayment] created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -69,7 +183,7 @@ class RetrieveParams(RequestOptions): """ The total available cash balance for the specified currency after this transaction was applied. Represented in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). """ - funded: Optional[StripeObject] + funded: Optional[Funded] id: str """ Unique identifier for the object. @@ -86,7 +200,7 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - refunded_from_payment: Optional[StripeObject] + refunded_from_payment: Optional[RefundedFromPayment] type: Literal[ "adjusted_for_overdraft", "applied_to_payment", @@ -100,7 +214,7 @@ class RetrieveParams(RequestOptions): """ The type of the cash balance transaction. New types may be added in future. See [Customer Balance](https://stripe.com/docs/payments/customer-balance#types) to learn more about these types. """ - unapplied_from_payment: Optional[StripeObject] + unapplied_from_payment: Optional[UnappliedFromPayment] @classmethod def list( @@ -136,3 +250,11 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "adjusted_for_overdraft": AdjustedForOverdraft, + "applied_to_payment": AppliedToPayment, + "funded": Funded, + "refunded_from_payment": RefundedFromPayment, + "unapplied_from_payment": UnappliedFromPayment, + } diff --git a/stripe/api_resources/dispute.py b/stripe/api_resources/dispute.py index 6578ca33d..7cea5bce0 100644 --- a/stripe/api_resources/dispute.py +++ b/stripe/api_resources/dispute.py @@ -23,6 +23,7 @@ if TYPE_CHECKING: from stripe.api_resources.balance_transaction import BalanceTransaction from stripe.api_resources.charge import Charge + from stripe.api_resources.file import File from stripe.api_resources.payment_intent import PaymentIntent @@ -38,6 +39,156 @@ class Dispute( """ OBJECT_NAME: ClassVar[Literal["dispute"]] = "dispute" + + class Evidence(StripeObject): + access_activity_log: Optional[str] + """ + Any server or activity logs showing proof that the customer accessed or downloaded the purchased digital product. This information should include IP addresses, corresponding timestamps, and any detailed recorded activity. + """ + billing_address: Optional[str] + """ + The billing address provided by the customer. + """ + cancellation_policy: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your subscription cancellation policy, as shown to the customer. + """ + cancellation_policy_disclosure: Optional[str] + """ + An explanation of how and when the customer was shown your refund policy prior to purchase. + """ + cancellation_rebuttal: Optional[str] + """ + A justification for why the customer's subscription was not canceled. + """ + customer_communication: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any communication with the customer that you feel is relevant to your case. Examples include emails proving that the customer received the product or service, or demonstrating their use of or satisfaction with the product or service. + """ + customer_email_address: Optional[str] + """ + The email address of the customer. + """ + customer_name: Optional[str] + """ + The name of the customer. + """ + customer_purchase_ip: Optional[str] + """ + The IP address that the customer used when making the purchase. + """ + customer_signature: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A relevant document or contract showing the customer's signature. + """ + duplicate_charge_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation for the prior charge that can uniquely identify the charge, such as a receipt, shipping label, work order, etc. This document should be paired with a similar document from the disputed payment that proves the two payments are separate. + """ + duplicate_charge_explanation: Optional[str] + """ + An explanation of the difference between the disputed charge versus the prior charge that appears to be a duplicate. + """ + duplicate_charge_id: Optional[str] + """ + The Stripe ID for the prior charge which appears to be a duplicate of the disputed charge. + """ + product_description: Optional[str] + """ + A description of the product or service that was sold. + """ + receipt: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any receipt or message sent to the customer notifying them of the charge. + """ + refund_policy: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your refund policy, as shown to the customer. + """ + refund_policy_disclosure: Optional[str] + """ + Documentation demonstrating that the customer was shown your refund policy prior to purchase. + """ + refund_refusal_explanation: Optional[str] + """ + A justification for why the customer is not entitled to a refund. + """ + service_date: Optional[str] + """ + The date on which the customer received or began receiving the purchased service, in a clear human-readable format. + """ + service_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation showing proof that a service was provided to the customer. This could include a copy of a signed contract, work order, or other form of written agreement. + """ + shipping_address: Optional[str] + """ + The address to which a physical product was shipped. You should try to include as complete address information as possible. + """ + shipping_carrier: Optional[str] + """ + The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. If multiple carriers were used for this purchase, please separate them with commas. + """ + shipping_date: Optional[str] + """ + The date on which a physical product began its route to the shipping address, in a clear human-readable format. + """ + shipping_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation showing proof that a product was shipped to the customer at the same address the customer provided to you. This could include a copy of the shipment receipt, shipping label, etc. It should show the customer's full shipping address, if possible. + """ + shipping_tracking_number: Optional[str] + """ + The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + """ + uncategorized_file: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any additional evidence or statements. + """ + uncategorized_text: Optional[str] + """ + Any additional evidence or statements. + """ + + class EvidenceDetails(StripeObject): + due_by: Optional[int] + """ + Date by which evidence must be submitted in order to successfully challenge dispute. Will be 0 if the customer's bank or credit card company doesn't allow a response for this particular dispute. + """ + has_evidence: bool + """ + Whether evidence has been staged for this dispute. + """ + past_due: bool + """ + Whether the last evidence submission was submitted past the due date. Defaults to `false` if no evidence submissions have occurred. If `true`, then delivery of the latest evidence is *not* guaranteed. + """ + submission_count: int + """ + The number of times evidence has been submitted. Typically, you may only submit evidence once. + """ + + class PaymentMethodDetails(StripeObject): + class Card(StripeObject): + brand: str + """ + Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + network_reason_code: Optional[str] + """ + The card network's specific dispute reason code, which maps to one of Stripe's primary dispute categories to simplify response guidance. The [Network code map](https://stripe.com/docs/disputes/categories#network-code-map) lists all available dispute reason codes by network. + """ + + card: Optional[Card] + """ + Card specific dispute details. + """ + type: Literal["card"] + """ + Payment method type. + """ + _inner_class_types = {"card": Card} + if TYPE_CHECKING: class CloseParams(RequestOptions): @@ -245,8 +396,8 @@ class RetrieveParams(RequestOptions): """ 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). """ - evidence: StripeObject - evidence_details: StripeObject + evidence: Evidence + evidence_details: EvidenceDetails id: str """ Unique identifier for the object. @@ -275,7 +426,7 @@ class RetrieveParams(RequestOptions): """ ID of the PaymentIntent that's disputed. """ - payment_method_details: Optional[StripeObject] + payment_method_details: Optional[PaymentMethodDetails] reason: str """ Reason given by cardholder for dispute. Possible values are `bank_cannot_process`, `check_returned`, `credit_not_processed`, `customer_initiated`, `debit_not_authorized`, `duplicate`, `fraudulent`, `general`, `incorrect_account_details`, `insufficient_funds`, `product_not_received`, `product_unacceptable`, `subscription_canceled`, or `unrecognized`. Learn more about [dispute reasons](https://stripe.com/docs/disputes/categories). @@ -396,3 +547,9 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "evidence": Evidence, + "evidence_details": EvidenceDetails, + "payment_method_details": PaymentMethodDetails, + } diff --git a/stripe/api_resources/event.py b/stripe/api_resources/event.py index 7d2aa248c..04b819157 100644 --- a/stripe/api_resources/event.py +++ b/stripe/api_resources/event.py @@ -4,7 +4,7 @@ from stripe.api_resources.list_object import ListObject from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject -from typing import ClassVar, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import ( Literal, NotRequired, @@ -49,6 +49,27 @@ class Event(ListableAPIResource["Event"]): """ OBJECT_NAME: ClassVar[Literal["event"]] = "event" + + class Data(StripeObject): + object: Dict[str, Any] + """ + Object containing the API resource relevant to the event. For example, an `invoice.created` event will have a full [invoice object](https://stripe.com/docs/api#invoice_object) as the value of the object key. + """ + previous_attributes: Optional[Dict[str, Any]] + """ + Object containing the names of the updated attributes and their values prior to the event (only included in events of type `*.updated`). If an array attribute has any updated elements, this object contains the entire array. In Stripe API versions 2017-04-06 or earlier, an updated array attribute in this object includes only the updated array elements. + """ + + class Request(StripeObject): + id: Optional[str] + """ + ID of the API request that caused the event. If null, the event was automatic (e.g., Stripe's automatic subscription handling). Request logs are available in the [dashboard](https://dashboard.stripe.com/logs), but currently not in the API. + """ + idempotency_key: Optional[str] + """ + The idempotency key transmitted during the request, if any. *Note: This property is populated only for events on or after May 23, 2017*. + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -118,7 +139,7 @@ class RetrieveParams(RequestOptions): """ Time at which the object was created. Measured in seconds since the Unix epoch. """ - data: StripeObject + data: Data id: str """ Unique identifier for the object. @@ -135,7 +156,7 @@ class RetrieveParams(RequestOptions): """ Number of webhooks that haven't been successfully delivered (for example, to return a 20x response) to the URLs you specify. """ - request: Optional[StripeObject] + request: Optional[Request] """ Information on the API request that triggers the event. """ @@ -402,3 +423,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"data": Data, "request": Request} diff --git a/stripe/api_resources/financial_connections/account.py b/stripe/api_resources/financial_connections/account.py index 7c55ce9b9..7014ad4f9 100644 --- a/stripe/api_resources/financial_connections/account.py +++ b/stripe/api_resources/financial_connections/account.py @@ -7,7 +7,7 @@ from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject from stripe.util import class_method_variant -from typing import ClassVar, List, Optional, cast, overload +from typing import ClassVar, Dict, List, Optional, cast, overload from typing_extensions import ( Literal, NotRequired, @@ -17,6 +17,8 @@ ) if TYPE_CHECKING: + from stripe.api_resources.account import Account as AccountResource + from stripe.api_resources.customer import Customer from stripe.api_resources.financial_connections.account_owner import ( AccountOwner, ) @@ -33,6 +35,82 @@ class Account(ListableAPIResource["Account"]): OBJECT_NAME: ClassVar[ Literal["financial_connections.account"] ] = "financial_connections.account" + + class AccountHolder(StripeObject): + account: Optional[ExpandableField["AccountResource"]] + """ + The ID of the Stripe account this account belongs to. Should only be present if `account_holder.type` is `account`. + """ + customer: Optional[ExpandableField["Customer"]] + """ + ID of the Stripe customer this account belongs to. Present if and only if `account_holder.type` is `customer`. + """ + type: Literal["account", "customer"] + """ + Type of account holder that this account belongs to. + """ + + class Balance(StripeObject): + class Cash(StripeObject): + available: Optional[Dict[str, int]] + """ + The funds available to the account holder. Typically this is the current balance less any holds. + + Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + + Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder. + """ + + class Credit(StripeObject): + used: Optional[Dict[str, int]] + """ + The credit that has been used by the account holder. + + Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + + Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder. + """ + + as_of: int + """ + The time that the external institution calculated this balance. Measured in seconds since the Unix epoch. + """ + cash: Optional[Cash] + credit: Optional[Credit] + current: Dict[str, int] + """ + The balances owed to (or by) the account holder. + + Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + + Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder. + """ + type: Literal["cash", "credit"] + """ + The `type` of the balance. An additional hash is included on the balance with a name matching this value. + """ + _inner_class_types = {"cash": Cash, "credit": Credit} + + class BalanceRefresh(StripeObject): + last_attempted_at: int + """ + The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch. + """ + status: Literal["failed", "pending", "succeeded"] + """ + The status of the last refresh attempt. + """ + + class OwnershipRefresh(StripeObject): + last_attempted_at: int + """ + The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch. + """ + status: Literal["failed", "pending", "succeeded"] + """ + The status of the last refresh attempt. + """ + if TYPE_CHECKING: class DisconnectParams(RequestOptions): @@ -115,15 +193,15 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - account_holder: Optional[StripeObject] + account_holder: Optional[AccountHolder] """ The account holder that this account belongs to. """ - balance: Optional[StripeObject] + balance: Optional[Balance] """ The most recent information about the account's balance. """ - balance_refresh: Optional[StripeObject] + balance_refresh: Optional[BalanceRefresh] """ The state of the most recent attempt to refresh the account balance. """ @@ -163,7 +241,7 @@ class RetrieveParams(RequestOptions): """ The most recent information about the account's owners. """ - ownership_refresh: Optional[StripeObject] + ownership_refresh: Optional[OwnershipRefresh] """ The state of the most recent attempt to refresh the account owners. """ @@ -423,3 +501,10 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "account_holder": AccountHolder, + "balance": Balance, + "balance_refresh": BalanceRefresh, + "ownership_refresh": OwnershipRefresh, + } diff --git a/stripe/api_resources/financial_connections/session.py b/stripe/api_resources/financial_connections/session.py index ea42fca7e..b6c3d87c0 100644 --- a/stripe/api_resources/financial_connections/session.py +++ b/stripe/api_resources/financial_connections/session.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe.api_resources.abstract import CreateableAPIResource +from stripe.api_resources.expandable_field import ExpandableField from stripe.api_resources.list_object import ListObject from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject @@ -14,7 +15,11 @@ ) if TYPE_CHECKING: - from stripe.api_resources.financial_connections.account import Account + from stripe.api_resources.account import Account as AccountResource + from stripe.api_resources.customer import Customer + from stripe.api_resources.financial_connections.account import ( + Account as FinancialConnectionsAccountResource, + ) class Session(CreateableAPIResource["Session"]): @@ -25,6 +30,27 @@ class Session(CreateableAPIResource["Session"]): OBJECT_NAME: ClassVar[ Literal["financial_connections.session"] ] = "financial_connections.session" + + class AccountHolder(StripeObject): + account: Optional[ExpandableField["AccountResource"]] + """ + The ID of the Stripe account this account belongs to. Should only be present if `account_holder.type` is `account`. + """ + customer: Optional[ExpandableField["Customer"]] + """ + ID of the Stripe customer this account belongs to. Present if and only if `account_holder.type` is `customer`. + """ + type: Literal["account", "customer"] + """ + Type of account holder that this account belongs to. + """ + + class Filters(StripeObject): + countries: Optional[List[str]] + """ + List of countries from which to filter accounts. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -87,11 +113,11 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - account_holder: Optional[StripeObject] + account_holder: Optional[AccountHolder] """ The account holder for whom accounts are collected in this session. """ - accounts: ListObject["Account"] + accounts: ListObject["FinancialConnectionsAccountResource"] """ The accounts that were collected as part of this Session. """ @@ -99,7 +125,7 @@ class RetrieveParams(RequestOptions): """ A value that will be passed to the client to launch the authentication flow. """ - filters: Optional[StripeObject] + filters: Optional[Filters] id: str """ Unique identifier for the object. @@ -156,3 +182,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"account_holder": AccountHolder, "filters": Filters} diff --git a/stripe/api_resources/funding_instructions.py b/stripe/api_resources/funding_instructions.py index 162e28984..e2b1ce0e3 100644 --- a/stripe/api_resources/funding_instructions.py +++ b/stripe/api_resources/funding_instructions.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe.stripe_object import StripeObject -from typing import ClassVar +from typing import ClassVar, List, Optional from typing_extensions import Literal @@ -17,7 +17,133 @@ class FundingInstructions(StripeObject): OBJECT_NAME: ClassVar[ Literal["funding_instructions"] ] = "funding_instructions" - bank_transfer: StripeObject + + class BankTransfer(StripeObject): + class FinancialAddress(StripeObject): + class Iban(StripeObject): + account_holder_name: str + """ + The name of the person or business that owns the bank account + """ + bic: str + """ + The BIC/SWIFT code of the account. + """ + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + iban: str + """ + The IBAN of the account. + """ + + class SortCode(StripeObject): + account_holder_name: str + """ + The name of the person or business that owns the bank account + """ + account_number: str + """ + The account number + """ + sort_code: str + """ + The six-digit sort code + """ + + class Spei(StripeObject): + bank_code: str + """ + The three-digit bank code + """ + bank_name: str + """ + The short banking institution name + """ + clabe: str + """ + The CLABE number + """ + + class Zengin(StripeObject): + account_holder_name: Optional[str] + """ + The account holder name + """ + account_number: Optional[str] + """ + The account number + """ + account_type: Optional[str] + """ + The bank account type. In Japan, this can only be `futsu` or `toza`. + """ + bank_code: Optional[str] + """ + The bank code of the account + """ + bank_name: Optional[str] + """ + The bank name of the account + """ + branch_code: Optional[str] + """ + The branch code of the account + """ + branch_name: Optional[str] + """ + The branch name of the account + """ + + iban: Optional[Iban] + """ + Iban Records contain E.U. bank account details per the SEPA format. + """ + sort_code: Optional[SortCode] + """ + Sort Code Records contain U.K. bank account details per the sort code format. + """ + spei: Optional[Spei] + """ + SPEI Records contain Mexico bank account details per the SPEI format. + """ + supported_networks: Optional[ + List[Literal["bacs", "fps", "sepa", "spei", "zengin"]] + ] + """ + The payment networks supported by this FinancialAddress + """ + type: Literal["iban", "sort_code", "spei", "zengin"] + """ + The type of financial address + """ + zengin: Optional[Zengin] + """ + Zengin Records contain Japan bank account details per the Zengin format. + """ + _inner_class_types = { + "iban": Iban, + "sort_code": SortCode, + "spei": Spei, + "zengin": Zengin, + } + + country: str + """ + The country of the bank account to fund + """ + financial_addresses: List[FinancialAddress] + """ + A list of financial addresses that can be used to fund a particular balance + """ + type: Literal["eu_bank_transfer", "jp_bank_transfer"] + """ + The bank_transfer type + """ + _inner_class_types = {"financial_addresses": FinancialAddress} + + bank_transfer: BankTransfer 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). @@ -34,3 +160,5 @@ class FundingInstructions(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ + + _inner_class_types = {"bank_transfer": BankTransfer} diff --git a/stripe/api_resources/identity/verification_report.py b/stripe/api_resources/identity/verification_report.py index bc6f26d97..2c7e3a91d 100644 --- a/stripe/api_resources/identity/verification_report.py +++ b/stripe/api_resources/identity/verification_report.py @@ -32,6 +32,273 @@ class VerificationReport(ListableAPIResource["VerificationReport"]): OBJECT_NAME: ClassVar[ Literal["identity.verification_report"] ] = "identity.verification_report" + + class Document(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class Dob(StripeObject): + day: Optional[int] + """ + Numerical day between 1 and 31. + """ + month: Optional[int] + """ + Numerical month between 1 and 12. + """ + year: Optional[int] + """ + The four-digit year. + """ + + class Error(StripeObject): + code: Optional[ + Literal[ + "document_expired", + "document_type_not_supported", + "document_unverified_other", + ] + ] + """ + A short machine-readable string giving the reason for the verification failure. + """ + reason: Optional[str] + """ + A human-readable message giving the reason for the failure. These messages can be shown to your users. + """ + + class ExpirationDate(StripeObject): + day: Optional[int] + """ + Numerical day between 1 and 31. + """ + month: Optional[int] + """ + Numerical month between 1 and 12. + """ + year: Optional[int] + """ + The four-digit year. + """ + + class IssuedDate(StripeObject): + day: Optional[int] + """ + Numerical day between 1 and 31. + """ + month: Optional[int] + """ + Numerical month between 1 and 12. + """ + year: Optional[int] + """ + The four-digit year. + """ + + address: Optional[Address] + """ + Address as it appears in the document. + """ + dob: Optional[Dob] + """ + Date of birth as it appears in the document. + """ + error: Optional[Error] + """ + Details on the verification error. Present when status is `unverified`. + """ + expiration_date: Optional[ExpirationDate] + """ + Expiration date of the document. + """ + files: Optional[List[str]] + """ + Array of [File](https://stripe.com/docs/api/files) ids containing images for this document. + """ + first_name: Optional[str] + """ + First name as it appears in the document. + """ + issued_date: Optional[IssuedDate] + """ + Issued date of the document. + """ + issuing_country: Optional[str] + """ + Issuing country of the document. + """ + last_name: Optional[str] + """ + Last name as it appears in the document. + """ + number: Optional[str] + """ + Document ID number. + """ + status: Literal["unverified", "verified"] + """ + Status of this `document` check. + """ + type: Optional[Literal["driving_license", "id_card", "passport"]] + """ + Type of the document. + """ + _inner_class_types = { + "address": Address, + "dob": Dob, + "error": Error, + "expiration_date": ExpirationDate, + "issued_date": IssuedDate, + } + + class IdNumber(StripeObject): + class Dob(StripeObject): + day: Optional[int] + """ + Numerical day between 1 and 31. + """ + month: Optional[int] + """ + Numerical month between 1 and 12. + """ + year: Optional[int] + """ + The four-digit year. + """ + + class Error(StripeObject): + code: Optional[ + Literal[ + "id_number_insufficient_document_data", + "id_number_mismatch", + "id_number_unverified_other", + ] + ] + """ + A short machine-readable string giving the reason for the verification failure. + """ + reason: Optional[str] + """ + A human-readable message giving the reason for the failure. These messages can be shown to your users. + """ + + dob: Optional[Dob] + """ + Date of birth. + """ + error: Optional[Error] + """ + Details on the verification error. Present when status is `unverified`. + """ + first_name: Optional[str] + """ + First name. + """ + id_number: Optional[str] + """ + ID number. + """ + id_number_type: Optional[Literal["br_cpf", "sg_nric", "us_ssn"]] + """ + Type of ID number. + """ + last_name: Optional[str] + """ + Last name. + """ + status: Literal["unverified", "verified"] + """ + Status of this `id_number` check. + """ + _inner_class_types = {"dob": Dob, "error": Error} + + class Options(StripeObject): + class Document(StripeObject): + allowed_types: Optional[ + List[Literal["driving_license", "id_card", "passport"]] + ] + """ + Array of strings of allowed identity document types. If the provided identity document isn't one of the allowed types, the verification check will fail with a document_type_not_allowed error code. + """ + require_id_number: Optional[bool] + """ + Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document's extracted name and date of birth. + """ + require_live_capture: Optional[bool] + """ + Disable image uploads, identity document images have to be captured using the device's camera. + """ + require_matching_selfie: Optional[bool] + """ + Capture a face image and perform a [selfie check](https://stripe.com/docs/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user's face. [Learn more](https://stripe.com/docs/identity/selfie). + """ + + class IdNumber(StripeObject): + pass + + document: Optional[Document] + id_number: Optional[IdNumber] + _inner_class_types = {"document": Document, "id_number": IdNumber} + + class Selfie(StripeObject): + class Error(StripeObject): + code: Optional[ + Literal[ + "selfie_document_missing_photo", + "selfie_face_mismatch", + "selfie_manipulated", + "selfie_unverified_other", + ] + ] + """ + A short machine-readable string giving the reason for the verification failure. + """ + reason: Optional[str] + """ + A human-readable message giving the reason for the failure. These messages can be shown to your users. + """ + + document: Optional[str] + """ + ID of the [File](https://stripe.com/docs/api/files) holding the image of the identity document used in this check. + """ + error: Optional[Error] + """ + Details on the verification error. Present when status is `unverified`. + """ + selfie: Optional[str] + """ + ID of the [File](https://stripe.com/docs/api/files) holding the image of the selfie used in this check. + """ + status: Literal["unverified", "verified"] + """ + Status of this `selfie` check. + """ + _inner_class_types = {"error": Error} + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -91,7 +358,7 @@ class RetrieveParams(RequestOptions): """ Time at which the object was created. Measured in seconds since the Unix epoch. """ - document: Optional[StripeObject] + document: Optional[Document] """ Result from a document check """ @@ -99,7 +366,7 @@ class RetrieveParams(RequestOptions): """ Unique identifier for the object. """ - id_number: Optional[StripeObject] + id_number: Optional[IdNumber] """ Result from an id_number check """ @@ -111,8 +378,8 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - options: Optional[StripeObject] - selfie: Optional[StripeObject] + options: Optional[Options] + selfie: Optional[Selfie] """ Result from a selfie check """ @@ -157,3 +424,10 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "document": Document, + "id_number": IdNumber, + "options": Options, + "selfie": Selfie, + } diff --git a/stripe/api_resources/identity/verification_session.py b/stripe/api_resources/identity/verification_session.py index fb1ebbb8b..c6d84233b 100644 --- a/stripe/api_resources/identity/verification_session.py +++ b/stripe/api_resources/identity/verification_session.py @@ -49,6 +49,136 @@ class VerificationSession( OBJECT_NAME: ClassVar[ Literal["identity.verification_session"] ] = "identity.verification_session" + + class LastError(StripeObject): + code: Optional[ + Literal[ + "abandoned", + "consent_declined", + "country_not_supported", + "device_not_supported", + "document_expired", + "document_type_not_supported", + "document_unverified_other", + "id_number_insufficient_document_data", + "id_number_mismatch", + "id_number_unverified_other", + "selfie_document_missing_photo", + "selfie_face_mismatch", + "selfie_manipulated", + "selfie_unverified_other", + "under_supported_age", + ] + ] + """ + A short machine-readable string giving the reason for the verification or user-session failure. + """ + reason: Optional[str] + """ + A message that explains the reason for verification or user-session failure. + """ + + class Options(StripeObject): + class Document(StripeObject): + allowed_types: Optional[ + List[Literal["driving_license", "id_card", "passport"]] + ] + """ + Array of strings of allowed identity document types. If the provided identity document isn't one of the allowed types, the verification check will fail with a document_type_not_allowed error code. + """ + require_id_number: Optional[bool] + """ + Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document's extracted name and date of birth. + """ + require_live_capture: Optional[bool] + """ + Disable image uploads, identity document images have to be captured using the device's camera. + """ + require_matching_selfie: Optional[bool] + """ + Capture a face image and perform a [selfie check](https://stripe.com/docs/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user's face. [Learn more](https://stripe.com/docs/identity/selfie). + """ + + class IdNumber(StripeObject): + pass + + document: Optional[Document] + id_number: Optional[IdNumber] + _inner_class_types = {"document": Document, "id_number": IdNumber} + + class Redaction(StripeObject): + status: Literal["processing", "redacted"] + """ + Indicates whether this object and its related objects have been redacted or not. + """ + + class VerifiedOutputs(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class Dob(StripeObject): + day: Optional[int] + """ + Numerical day between 1 and 31. + """ + month: Optional[int] + """ + Numerical month between 1 and 12. + """ + year: Optional[int] + """ + The four-digit year. + """ + + address: Optional[Address] + """ + The user's verified address. + """ + dob: Optional[Dob] + """ + The user's verified date of birth. + """ + first_name: Optional[str] + """ + The user's verified first name. + """ + id_number: Optional[str] + """ + The user's verified id number. + """ + id_number_type: Optional[Literal["br_cpf", "sg_nric", "us_ssn"]] + """ + The user's verified id number type. + """ + last_name: Optional[str] + """ + The user's verified last name. + """ + _inner_class_types = {"address": Address, "dob": Dob} + if TYPE_CHECKING: class CancelParams(RequestOptions): @@ -226,7 +356,7 @@ class RetrieveParams(RequestOptions): """ Unique identifier for the object. """ - last_error: Optional[StripeObject] + last_error: Optional[LastError] """ If present, this property tells you the last error encountered when processing the verification. """ @@ -246,11 +376,11 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - options: Optional[StripeObject] + options: Optional[Options] """ A set of options for the session's verification checks. """ - redaction: Optional[StripeObject] + redaction: Optional[Redaction] """ Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null. """ @@ -266,7 +396,7 @@ class RetrieveParams(RequestOptions): """ The short-lived URL that you use to redirect a user to Stripe to submit their identity information. This URL expires after 48 hours and can only be used once. Don't store it, log it, send it in emails or expose it to anyone other than the user. Refer to our docs on [verifying identity documents](https://stripe.com/docs/identity/verify-identity-documents?platform=web&type=redirect) to learn how to redirect users to Stripe. """ - verified_outputs: Optional[StripeObject] + verified_outputs: Optional[VerifiedOutputs] """ The user's verified data. """ @@ -457,3 +587,10 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "last_error": LastError, + "options": Options, + "redaction": Redaction, + "verified_outputs": VerifiedOutputs, + } diff --git a/stripe/api_resources/invoice.py b/stripe/api_resources/invoice.py index 98ddf4322..cb4a3b44d 100644 --- a/stripe/api_resources/invoice.py +++ b/stripe/api_resources/invoice.py @@ -37,7 +37,7 @@ from stripe.api_resources.account import Account from stripe.api_resources.application import Application from stripe.api_resources.bank_account import BankAccount - from stripe.api_resources.card import Card + from stripe.api_resources.card import Card as CardResource from stripe.api_resources.charge import Charge from stripe.api_resources.customer import Customer from stripe.api_resources.discount import Discount @@ -45,6 +45,8 @@ from stripe.api_resources.payment_intent import PaymentIntent from stripe.api_resources.payment_method import PaymentMethod from stripe.api_resources.quote import Quote + from stripe.api_resources.setup_intent import SetupIntent + from stripe.api_resources.shipping_rate import ShippingRate from stripe.api_resources.source import Source from stripe.api_resources.subscription import Subscription from stripe.api_resources.tax_id import TaxId @@ -95,6 +97,843 @@ class Invoice( """ OBJECT_NAME: ClassVar[Literal["invoice"]] = "invoice" + + class AutomaticTax(StripeObject): + enabled: bool + """ + Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. + """ + status: Optional[ + Literal["complete", "failed", "requires_location_inputs"] + ] + """ + The status of the most recent automated tax calculation for this invoice. + """ + + class CustomField(StripeObject): + name: str + """ + The name of the custom field. + """ + value: str + """ + The value of the custom field. + """ + + class CustomerAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class CustomerShipping(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + carrier: Optional[str] + """ + The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + """ + name: Optional[str] + """ + Recipient name. + """ + phone: Optional[str] + """ + Recipient phone (including extension). + """ + tracking_number: Optional[str] + """ + The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + """ + _inner_class_types = {"address": Address} + + class CustomerTaxId(StripeObject): + type: Literal[ + "ad_nrt", + "ae_trn", + "ar_cuit", + "au_abn", + "au_arn", + "bg_uic", + "bo_tin", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sv_nit", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "unknown", + "us_ein", + "uy_ruc", + "ve_rif", + "vn_tin", + "za_vat", + ] + """ + The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, or `unknown` + """ + value: Optional[str] + """ + The value of the tax ID. + """ + + class FromInvoice(StripeObject): + action: str + """ + The relation between this invoice and the cloned invoice + """ + invoice: ExpandableField["Invoice"] + """ + The invoice that was cloned. + """ + + class LastFinalizationError(StripeObject): + charge: Optional[str] + """ + For card errors, the ID of the failed charge. + """ + code: Optional[ + Literal[ + "account_closed", + "account_country_invalid_address", + "account_error_country_change_requires_additional_steps", + "account_information_mismatch", + "account_invalid", + "account_number_invalid", + "acss_debit_session_incomplete", + "alipay_upgrade_required", + "amount_too_large", + "amount_too_small", + "api_key_expired", + "application_fees_not_allowed", + "authentication_required", + "balance_insufficient", + "bank_account_bad_routing_numbers", + "bank_account_declined", + "bank_account_exists", + "bank_account_restricted", + "bank_account_unusable", + "bank_account_unverified", + "bank_account_verification_failed", + "billing_invalid_mandate", + "bitcoin_upgrade_required", + "capture_charge_authorization_expired", + "capture_unauthorized_payment", + "card_decline_rate_limit_exceeded", + "card_declined", + "cardholder_phone_number_required", + "charge_already_captured", + "charge_already_refunded", + "charge_disputed", + "charge_exceeds_source_limit", + "charge_expired_for_capture", + "charge_invalid_parameter", + "charge_not_refundable", + "clearing_code_unsupported", + "country_code_invalid", + "country_unsupported", + "coupon_expired", + "customer_max_payment_methods", + "customer_max_subscriptions", + "debit_not_authorized", + "email_invalid", + "expired_card", + "idempotency_key_in_use", + "incorrect_address", + "incorrect_cvc", + "incorrect_number", + "incorrect_zip", + "instant_payouts_config_disabled", + "instant_payouts_currency_disabled", + "instant_payouts_limit_exceeded", + "instant_payouts_unsupported", + "insufficient_funds", + "intent_invalid_state", + "intent_verification_method_missing", + "invalid_card_type", + "invalid_characters", + "invalid_charge_amount", + "invalid_cvc", + "invalid_expiry_month", + "invalid_expiry_year", + "invalid_number", + "invalid_source_usage", + "invalid_tax_location", + "invoice_no_customer_line_items", + "invoice_no_payment_method_types", + "invoice_no_subscription_line_items", + "invoice_not_editable", + "invoice_on_behalf_of_not_editable", + "invoice_payment_intent_requires_action", + "invoice_upcoming_none", + "livemode_mismatch", + "lock_timeout", + "missing", + "no_account", + "not_allowed_on_standard_account", + "out_of_inventory", + "ownership_declaration_not_allowed", + "parameter_invalid_empty", + "parameter_invalid_integer", + "parameter_invalid_string_blank", + "parameter_invalid_string_empty", + "parameter_missing", + "parameter_unknown", + "parameters_exclusive", + "payment_intent_action_required", + "payment_intent_authentication_failure", + "payment_intent_incompatible_payment_method", + "payment_intent_invalid_parameter", + "payment_intent_konbini_rejected_confirmation_number", + "payment_intent_mandate_invalid", + "payment_intent_payment_attempt_expired", + "payment_intent_payment_attempt_failed", + "payment_intent_unexpected_state", + "payment_method_bank_account_already_verified", + "payment_method_bank_account_blocked", + "payment_method_billing_details_address_missing", + "payment_method_configuration_failures", + "payment_method_currency_mismatch", + "payment_method_customer_decline", + "payment_method_invalid_parameter", + "payment_method_invalid_parameter_testmode", + "payment_method_microdeposit_failed", + "payment_method_microdeposit_verification_amounts_invalid", + "payment_method_microdeposit_verification_amounts_mismatch", + "payment_method_microdeposit_verification_attempts_exceeded", + "payment_method_microdeposit_verification_descriptor_code_mismatch", + "payment_method_microdeposit_verification_timeout", + "payment_method_not_available", + "payment_method_provider_decline", + "payment_method_provider_timeout", + "payment_method_unactivated", + "payment_method_unexpected_state", + "payment_method_unsupported_type", + "payout_reconciliation_not_ready", + "payouts_limit_exceeded", + "payouts_not_allowed", + "platform_account_required", + "platform_api_key_expired", + "postal_code_invalid", + "processing_error", + "product_inactive", + "progressive_onboarding_limit_exceeded", + "rate_limit", + "refer_to_customer", + "refund_disputed_payment", + "resource_already_exists", + "resource_missing", + "return_intent_already_processed", + "routing_number_invalid", + "secret_key_required", + "sepa_unsupported_account", + "setup_attempt_failed", + "setup_intent_authentication_failure", + "setup_intent_invalid_parameter", + "setup_intent_mandate_invalid", + "setup_intent_setup_attempt_expired", + "setup_intent_unexpected_state", + "shipping_calculation_failed", + "sku_inactive", + "state_unsupported", + "status_transition_invalid", + "stripe_tax_inactive", + "tax_id_invalid", + "taxes_calculation_failed", + "terminal_location_country_unsupported", + "terminal_reader_busy", + "terminal_reader_offline", + "terminal_reader_timeout", + "testmode_charges_only", + "tls_version_unsupported", + "token_already_used", + "token_in_use", + "transfer_source_balance_parameters_mismatch", + "transfers_not_allowed", + "url_invalid", + ] + ] + """ + For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported. + """ + decline_code: Optional[str] + """ + For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one. + """ + doc_url: Optional[str] + """ + A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported. + """ + message: Optional[str] + """ + A human-readable message providing more details about the error. For card errors, these messages can be shown to your users. + """ + param: Optional[str] + """ + If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. + """ + payment_intent: Optional["PaymentIntent"] + """ + A PaymentIntent guides you through the process of collecting a payment from your customer. + We recommend that you create exactly one PaymentIntent for each order or + customer session in your system. You can reference the PaymentIntent later to + see the history of payment attempts for a particular session. + + A PaymentIntent transitions through + [multiple statuses](https://stripe.com/docs/payments/intents#intent-statuses) + throughout its lifetime as it interfaces with Stripe.js to perform + authentication flows and ultimately creates at most one successful charge. + + Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents) + """ + payment_method: Optional["PaymentMethod"] + """ + PaymentMethod objects represent your customer's payment instruments. + You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to + Customer objects to store instrument details for future payments. + + Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios). + """ + payment_method_type: Optional[str] + """ + If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors. + """ + request_log_url: Optional[str] + """ + A URL to the request log entry in your dashboard. + """ + setup_intent: Optional["SetupIntent"] + """ + A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments. + For example, you can use a SetupIntent to set up and save your customer's card without immediately collecting a payment. + Later, you can use [PaymentIntents](https://stripe.com/docs/api#payment_intents) to drive the payment flow. + + Create a SetupIntent when you're ready to collect your customer's payment credentials. + Don't maintain long-lived, unconfirmed SetupIntents because they might not be valid. + The SetupIntent transitions through multiple [statuses](https://stripe.com/docs/payments/intents#intent-statuses) as it guides + you through the setup process. + + Successful SetupIntents result in payment credentials that are optimized for future payments. + For example, cardholders in [certain regions](https://stripe.com/guides/strong-customer-authentication) might need to be run through + [Strong Customer Authentication](https://stripe.com/docs/strong-customer-authentication) during payment method collection + to streamline later [off-session payments](https://stripe.com/docs/payments/setup-intents). + If you use the SetupIntent with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer), + it automatically attaches the resulting payment method to that Customer after successful setup. + We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on + PaymentIntents to save payment methods to prevent saving invalid or unoptimized payment methods. + + By using SetupIntents, you can reduce friction for your customers, even as regulations change over time. + + Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents) + """ + source: Optional[ + Union["Account", "BankAccount", "CardResource", "Source"] + ] + type: Literal[ + "api_error", + "card_error", + "idempotency_error", + "invalid_request_error", + ] + """ + The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error` + """ + + class PaymentSettings(StripeObject): + class PaymentMethodOptions(StripeObject): + class AcssDebit(StripeObject): + class MandateOptions(StripeObject): + transaction_type: Optional[Literal["business", "personal"]] + """ + Transaction type of the mandate. + """ + + mandate_options: Optional[MandateOptions] + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = {"mandate_options": MandateOptions} + + class Bancontact(StripeObject): + preferred_language: Literal["de", "en", "fr", "nl"] + """ + Preferred language of the Bancontact authorization page that the customer is redirected to. + """ + + class Card(StripeObject): + class Installments(StripeObject): + enabled: Optional[bool] + """ + Whether Installments are enabled for this Invoice. + """ + + installments: Optional[Installments] + request_three_d_secure: Optional[Literal["any", "automatic"]] + """ + We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + """ + _inner_class_types = {"installments": Installments} + + class CustomerBalance(StripeObject): + class BankTransfer(StripeObject): + class EuBankTransfer(StripeObject): + country: Literal["BE", "DE", "ES", "FR", "IE", "NL"] + """ + The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. + """ + + eu_bank_transfer: Optional[EuBankTransfer] + type: Optional[str] + """ + The bank transfer type that can be used for funding. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. + """ + _inner_class_types = {"eu_bank_transfer": EuBankTransfer} + + bank_transfer: Optional[BankTransfer] + funding_type: Optional[Literal["bank_transfer"]] + """ + The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`. + """ + _inner_class_types = {"bank_transfer": BankTransfer} + + class Konbini(StripeObject): + pass + + class UsBankAccount(StripeObject): + class FinancialConnections(StripeObject): + permissions: Optional[ + List[ + Literal[ + "balances", "payment_method", "transactions" + ] + ] + ] + """ + The list of permissions to request. The `payment_method` permission must be included. + """ + prefetch: Optional[List[Literal["balances"]]] + """ + Data features requested to be retrieved upon account creation. + """ + + financial_connections: Optional[FinancialConnections] + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = { + "financial_connections": FinancialConnections, + } + + acss_debit: Optional[AcssDebit] + """ + If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice's PaymentIntent. + """ + bancontact: Optional[Bancontact] + """ + If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice's PaymentIntent. + """ + card: Optional[Card] + """ + If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice's PaymentIntent. + """ + customer_balance: Optional[CustomerBalance] + """ + If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice's PaymentIntent. + """ + konbini: Optional[Konbini] + """ + If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice's PaymentIntent. + """ + us_bank_account: Optional[UsBankAccount] + """ + If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice's PaymentIntent. + """ + _inner_class_types = { + "acss_debit": AcssDebit, + "bancontact": Bancontact, + "card": Card, + "customer_balance": CustomerBalance, + "konbini": Konbini, + "us_bank_account": UsBankAccount, + } + + default_mandate: Optional[str] + """ + ID of the mandate to be used for this invoice. It must correspond to the payment method used to pay the invoice, including the invoice's default_payment_method or default_source, if set. + """ + payment_method_options: Optional[PaymentMethodOptions] + """ + Payment-method-specific configuration to provide to the invoice's PaymentIntent. + """ + payment_method_types: Optional[ + List[ + Literal[ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "fpx", + "giropay", + "grabpay", + "ideal", + "konbini", + "link", + "paynow", + "paypal", + "promptpay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "us_bank_account", + "wechat_pay", + ] + ] + ] + """ + The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). + """ + _inner_class_types = {"payment_method_options": PaymentMethodOptions} + + class Rendering(StripeObject): + class Pdf(StripeObject): + page_size: Optional[Literal["a4", "auto", "letter"]] + """ + Page size of invoice pdf. Options include a4, letter, and auto. If set to auto, page size will be switched to a4 or letter based on customer locale. + """ + + amount_tax_display: Optional[str] + """ + How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + """ + pdf: Optional[Pdf] + """ + Invoice pdf rendering options + """ + _inner_class_types = {"pdf": Pdf} + + class RenderingOptions(StripeObject): + amount_tax_display: Optional[str] + """ + How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + """ + + class ShippingCost(StripeObject): + class Tax(StripeObject): + amount: int + """ + Amount of tax applied for this rate. + """ + rate: "TaxRate" + """ + Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + + Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + + amount_subtotal: int + """ + Total shipping cost before any taxes are applied. + """ + amount_tax: int + """ + Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0. + """ + amount_total: int + """ + Total shipping cost after taxes are applied. + """ + shipping_rate: Optional[ExpandableField["ShippingRate"]] + """ + The ID of the ShippingRate for this invoice. + """ + taxes: Optional[List[Tax]] + """ + The taxes applied to the shipping rate. + """ + _inner_class_types = {"taxes": Tax} + + class ShippingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + carrier: Optional[str] + """ + The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + """ + name: Optional[str] + """ + Recipient name. + """ + phone: Optional[str] + """ + Recipient phone (including extension). + """ + tracking_number: Optional[str] + """ + The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + """ + _inner_class_types = {"address": Address} + + class StatusTransitions(StripeObject): + finalized_at: Optional[int] + """ + The time that the invoice draft was finalized. + """ + marked_uncollectible_at: Optional[int] + """ + The time that the invoice was marked uncollectible. + """ + paid_at: Optional[int] + """ + The time that the invoice was paid. + """ + voided_at: Optional[int] + """ + The time that the invoice was voided. + """ + + class SubscriptionDetails(StripeObject): + metadata: Optional[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will reflect the metadata of the subscription at the time of invoice creation. *Note: This attribute is populated only for invoices created on or after June 29, 2023.* + """ + + class ThresholdReason(StripeObject): + class ItemReason(StripeObject): + line_item_ids: List[str] + """ + The IDs of the line items that triggered the threshold invoice. + """ + usage_gte: int + """ + The quantity threshold boundary that applied to the given line item. + """ + + amount_gte: Optional[int] + """ + The total invoice amount threshold boundary if it triggered the threshold invoice. + """ + item_reasons: List[ItemReason] + """ + Indicates which line items triggered a threshold invoice. + """ + _inner_class_types = {"item_reasons": ItemReason} + + class TotalDiscountAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the discount. + """ + discount: ExpandableField["Discount"] + """ + The discount that was applied to get this discount amount. + """ + + class TotalTaxAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the tax. + """ + inclusive: bool + """ + Whether this tax amount is inclusive or exclusive. + """ + tax_rate: ExpandableField["TaxRate"] + """ + The tax rate that was applied to get this tax amount. + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + + class TransferData(StripeObject): + amount: Optional[int] + """ + The amount in cents (or local equivalent) that will be transferred to the destination account when the invoice is paid. By default, the entire amount is transferred to the destination. + """ + destination: ExpandableField["Account"] + """ + The account where funds from the payment will be transferred to upon payment success. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -2468,7 +3307,7 @@ class SearchParams(RequestOptions): """ Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. """ - automatic_tax: StripeObject + automatic_tax: AutomaticTax billing_reason: Optional[ Literal[ "automatic_pending_invoice_item_invoice", @@ -2509,7 +3348,7 @@ class SearchParams(RequestOptions): """ 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). """ - custom_fields: Optional[List[StripeObject]] + custom_fields: Optional[List[CustomField]] """ Custom fields displayed on the invoice. """ @@ -2517,7 +3356,7 @@ class SearchParams(RequestOptions): """ The ID of the customer who will be billed. """ - customer_address: Optional[StripeObject] + customer_address: Optional[CustomerAddress] """ The customer's address. Until the invoice is finalized, this field will equal `customer.address`. Once the invoice is finalized, this field will no longer be updated. """ @@ -2533,7 +3372,7 @@ class SearchParams(RequestOptions): """ The customer's phone number. Until the invoice is finalized, this field will equal `customer.phone`. Once the invoice is finalized, this field will no longer be updated. """ - customer_shipping: Optional[StripeObject] + customer_shipping: Optional[CustomerShipping] """ The customer's shipping information. Until the invoice is finalized, this field will equal `customer.shipping`. Once the invoice is finalized, this field will no longer be updated. """ @@ -2541,7 +3380,7 @@ class SearchParams(RequestOptions): """ The customer's tax exempt status. Until the invoice is finalized, this field will equal `customer.tax_exempt`. Once the invoice is finalized, this field will no longer be updated. """ - customer_tax_ids: Optional[List[StripeObject]] + customer_tax_ids: Optional[List[CustomerTaxId]] """ The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as `customer.tax_ids`. Once the invoice is finalized, this field will no longer be updated. """ @@ -2550,7 +3389,9 @@ class SearchParams(RequestOptions): ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. """ default_source: Optional[ - ExpandableField[Union["Account", "BankAccount", "Card", "Source"]] + ExpandableField[ + Union["Account", "BankAccount", "CardResource", "Source"] + ] ] """ ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source. @@ -2587,7 +3428,7 @@ class SearchParams(RequestOptions): """ Footer displayed on the invoice. """ - from_invoice: Optional[StripeObject] + from_invoice: Optional[FromInvoice] """ Details of the invoice that was cloned. See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details. """ @@ -2603,7 +3444,7 @@ class SearchParams(RequestOptions): """ The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null. """ - last_finalization_error: Optional[StripeObject] + last_finalization_error: Optional[LastFinalizationError] """ The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized. """ @@ -2651,7 +3492,7 @@ class SearchParams(RequestOptions): """ The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. """ - payment_settings: StripeObject + payment_settings: PaymentSettings period_end: int """ End of the usage period during which invoice items were added to this invoice. @@ -2676,19 +3517,19 @@ class SearchParams(RequestOptions): """ This is the transaction number that appears on email receipts sent for this invoice. """ - rendering: Optional[StripeObject] + rendering: Optional[Rendering] """ The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. """ - rendering_options: Optional[StripeObject] + rendering_options: Optional[RenderingOptions] """ This is a legacy field that will be removed soon. For details about `rendering_options`, refer to `rendering` instead. Options for invoice PDF rendering. """ - shipping_cost: Optional[StripeObject] + shipping_cost: Optional[ShippingCost] """ The details of the cost of shipping, including the ShippingRate applied on the invoice. """ - shipping_details: Optional[StripeObject] + shipping_details: Optional[ShippingDetails] """ Shipping details for the invoice. The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer. """ @@ -2704,12 +3545,12 @@ class SearchParams(RequestOptions): """ The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview) """ - status_transitions: StripeObject + status_transitions: StatusTransitions subscription: Optional[ExpandableField["Subscription"]] """ The subscription that this invoice was prepared for, if any. """ - subscription_details: Optional[StripeObject] + subscription_details: Optional[SubscriptionDetails] """ Details about the subscription that created this invoice. """ @@ -2733,12 +3574,12 @@ class SearchParams(RequestOptions): """ ID of the test clock this invoice belongs to. """ - threshold_reason: Optional[StripeObject] + threshold_reason: Optional[ThresholdReason] total: int """ Total after discounts and taxes. """ - total_discount_amounts: Optional[List[StripeObject]] + total_discount_amounts: Optional[List[TotalDiscountAmount]] """ The aggregate amounts calculated per discount across all line items. """ @@ -2746,11 +3587,11 @@ class SearchParams(RequestOptions): """ The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax. """ - total_tax_amounts: List[StripeObject] + total_tax_amounts: List[TotalTaxAmount] """ The aggregate amounts calculated per tax rate for all line items. """ - transfer_data: Optional[StripeObject] + transfer_data: Optional[TransferData] """ The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice. """ @@ -3215,3 +4056,24 @@ def search_auto_paging_iter( cls, *args, **kwargs: Unpack["Invoice.SearchParams"] ) -> Iterator["Invoice"]: return cls.search(*args, **kwargs).auto_paging_iter() + + _inner_class_types = { + "automatic_tax": AutomaticTax, + "custom_fields": CustomField, + "customer_address": CustomerAddress, + "customer_shipping": CustomerShipping, + "customer_tax_ids": CustomerTaxId, + "from_invoice": FromInvoice, + "last_finalization_error": LastFinalizationError, + "payment_settings": PaymentSettings, + "rendering": Rendering, + "rendering_options": RenderingOptions, + "shipping_cost": ShippingCost, + "shipping_details": ShippingDetails, + "status_transitions": StatusTransitions, + "subscription_details": SubscriptionDetails, + "threshold_reason": ThresholdReason, + "total_discount_amounts": TotalDiscountAmount, + "total_tax_amounts": TotalTaxAmount, + "transfer_data": TransferData, + } diff --git a/stripe/api_resources/invoice_item.py b/stripe/api_resources/invoice_item.py index d74dbc0ca..55bb21b32 100644 --- a/stripe/api_resources/invoice_item.py +++ b/stripe/api_resources/invoice_item.py @@ -53,6 +53,17 @@ class InvoiceItem( """ OBJECT_NAME: ClassVar[Literal["invoiceitem"]] = "invoiceitem" + + class Period(StripeObject): + end: int + """ + The end of the period, which must be greater than or equal to the start. This value is inclusive. + """ + start: int + """ + The start of the period. This value is inclusive. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -397,7 +408,7 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - period: StripeObject + period: Period plan: Optional["Plan"] """ If the invoice item is a proration, the plan of the subscription that the proration was computed for. @@ -540,3 +551,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"period": Period} diff --git a/stripe/api_resources/invoice_line_item.py b/stripe/api_resources/invoice_line_item.py index 8edcc8a07..591dfc5c8 100644 --- a/stripe/api_resources/invoice_line_item.py +++ b/stripe/api_resources/invoice_line_item.py @@ -17,6 +17,84 @@ class InvoiceLineItem(StripeObject): OBJECT_NAME: ClassVar[Literal["line_item"]] = "line_item" + + class DiscountAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the discount. + """ + discount: ExpandableField["Discount"] + """ + The discount that was applied to get this discount amount. + """ + + class Period(StripeObject): + end: int + """ + The end of the period, which must be greater than or equal to the start. This value is inclusive. + """ + start: int + """ + The start of the period. This value is inclusive. + """ + + 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} + + class TaxAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the tax. + """ + inclusive: bool + """ + Whether this tax amount is inclusive or exclusive. + """ + tax_rate: ExpandableField["TaxRate"] + """ + The tax rate that was applied to get this tax amount. + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + amount: int """ The amount, in cents (or local equivalent). @@ -33,7 +111,7 @@ class InvoiceLineItem(StripeObject): """ An arbitrary string attached to the object. Often useful for displaying to users. """ - discount_amounts: Optional[List[StripeObject]] + discount_amounts: Optional[List[DiscountAmount]] """ The amount of discount calculated per discount for this line item. """ @@ -65,7 +143,7 @@ class InvoiceLineItem(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ - period: StripeObject + period: Period plan: Optional["Plan"] """ The plan of the subscription, if the line item is a subscription or a proration. @@ -78,7 +156,7 @@ class InvoiceLineItem(StripeObject): """ Whether this is a proration. """ - proration_details: Optional[StripeObject] + proration_details: Optional[ProrationDetails] """ Additional details for proration line items """ @@ -94,7 +172,7 @@ class InvoiceLineItem(StripeObject): """ The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription. """ - tax_amounts: Optional[List[StripeObject]] + tax_amounts: Optional[List[TaxAmount]] """ The amount of tax calculated per tax rate for this line item """ @@ -110,3 +188,10 @@ class InvoiceLineItem(StripeObject): """ The amount in cents (or local equivalent) representing the unit amount for this line item, excluding all tax and discounts. """ + + _inner_class_types = { + "discount_amounts": DiscountAmount, + "period": Period, + "proration_details": ProrationDetails, + "tax_amounts": TaxAmount, + } diff --git a/stripe/api_resources/issuing/authorization.py b/stripe/api_resources/issuing/authorization.py index 82b2c4dbf..98454dde5 100644 --- a/stripe/api_resources/issuing/authorization.py +++ b/stripe/api_resources/issuing/authorization.py @@ -45,6 +45,202 @@ class Authorization( OBJECT_NAME: ClassVar[ Literal["issuing.authorization"] ] = "issuing.authorization" + + class AmountDetails(StripeObject): + atm_fee: Optional[int] + """ + The fee charged by the ATM for the cash withdrawal. + """ + cashback_amount: Optional[int] + """ + The amount of cash requested by the cardholder. + """ + + class MerchantData(StripeObject): + category: str + """ + A categorization of the seller's type of business. See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. + """ + category_code: str + """ + The merchant category code for the seller's business + """ + city: Optional[str] + """ + City where the seller is located + """ + country: Optional[str] + """ + Country where the seller is located + """ + name: Optional[str] + """ + Name of the seller + """ + network_id: str + """ + Identifier assigned to the seller by the card network. Different card networks may assign different network_id fields to the same merchant. + """ + postal_code: Optional[str] + """ + Postal code where the seller is located + """ + state: Optional[str] + """ + State where the seller is located + """ + terminal_id: Optional[str] + """ + An ID assigned by the seller to the location of the sale. + """ + + class NetworkData(StripeObject): + acquiring_institution_id: Optional[str] + """ + Identifier assigned to the acquirer by the card network. Sometimes this value is not provided by the network; in this case, the value will be `null`. + """ + + class PendingRequest(StripeObject): + class AmountDetails(StripeObject): + atm_fee: Optional[int] + """ + The fee charged by the ATM for the cash withdrawal. + """ + cashback_amount: Optional[int] + """ + The amount of cash requested by the cardholder. + """ + + amount: int + """ + The additional amount Stripe will hold if the authorization is approved, in the card's [currency](https://stripe.com/docs/api#issuing_authorization_object-pending-request-currency) and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + amount_details: Optional[AmountDetails] + """ + Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + 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). + """ + is_amount_controllable: bool + """ + If set `true`, you may provide [amount](https://stripe.com/docs/api/issuing/authorizations/approve#approve_issuing_authorization-amount) to control how much to hold for the authorization. + """ + merchant_amount: int + """ + The amount the merchant is requesting to be authorized in the `merchant_currency`. The amount is in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + merchant_currency: str + """ + The local currency the merchant is requesting to authorize. + """ + _inner_class_types = {"amount_details": AmountDetails} + + class RequestHistory(StripeObject): + class AmountDetails(StripeObject): + atm_fee: Optional[int] + """ + The fee charged by the ATM for the cash withdrawal. + """ + cashback_amount: Optional[int] + """ + The amount of cash requested by the cardholder. + """ + + amount: int + """ + The `pending_request.amount` at the time of the request, presented in your card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). Stripe held this amount from your account to fund the authorization if the request was approved. + """ + amount_details: Optional[AmountDetails] + """ + Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + approved: bool + """ + Whether this request was approved. + """ + authorization_code: Optional[str] + """ + A code created by Stripe which is shared with the merchant to validate the authorization. This field will be populated if the authorization message was approved. The code typically starts with the letter "S", followed by a six-digit number. For example, "S498162". Please note that the code is not guaranteed to be unique across authorizations. + """ + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + 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). + """ + merchant_amount: int + """ + The `pending_request.merchant_amount` at the time of the request, presented in the `merchant_currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + merchant_currency: str + """ + The currency that was collected by the merchant and presented to the cardholder for the authorization. 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). + """ + reason: Literal[ + "account_disabled", + "card_active", + "card_inactive", + "cardholder_inactive", + "cardholder_verification_required", + "insufficient_funds", + "not_allowed", + "spending_controls", + "suspected_fraud", + "verification_failed", + "webhook_approved", + "webhook_declined", + "webhook_error", + "webhook_timeout", + ] + """ + When an authorization is approved or declined by you or by Stripe, this field provides additional detail on the reason for the outcome. + """ + reason_message: Optional[str] + """ + If approve/decline decision is directly responsed to the webhook with json payload and if the response is invalid (e.g., parsing errors), we surface the detailed message via this field. + """ + _inner_class_types = {"amount_details": AmountDetails} + + class Treasury(StripeObject): + received_credits: List[str] + """ + The array of [ReceivedCredits](https://stripe.com/docs/api/treasury/received_credits) associated with this authorization + """ + received_debits: List[str] + """ + The array of [ReceivedDebits](https://stripe.com/docs/api/treasury/received_debits) associated with this authorization + """ + transaction: Optional[str] + """ + The Treasury [Transaction](https://stripe.com/docs/api/treasury/transactions) associated with this authorization + """ + + class VerificationData(StripeObject): + address_line1_check: Literal["match", "mismatch", "not_provided"] + """ + Whether the cardholder provided an address first line and if it matched the cardholder's `billing.address.line1`. + """ + address_postal_code_check: Literal["match", "mismatch", "not_provided"] + """ + Whether the cardholder provided a postal code and if it matched the cardholder's `billing.address.postal_code`. + """ + cvc_check: Literal["match", "mismatch", "not_provided"] + """ + Whether the cardholder provided a CVC and if it matched Stripe's record. + """ + expiry_check: Literal["match", "mismatch", "not_provided"] + """ + Whether the cardholder provided an expiry date and if it matched Stripe's record. + """ + postal_code: Optional[str] + """ + The postal code submitted as part of the authorization used for postal code verification. + """ + if TYPE_CHECKING: class ApproveParams(RequestOptions): @@ -447,7 +643,7 @@ class ReverseParams(RequestOptions): """ The total amount that was authorized or rejected. This amount is in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). """ - amount_details: Optional[StripeObject] + amount_details: Optional[AmountDetails] """ Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). """ @@ -497,12 +693,12 @@ class ReverseParams(RequestOptions): """ The currency that was presented to the cardholder for the authorization. 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). """ - merchant_data: StripeObject + merchant_data: MerchantData 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. """ - network_data: Optional[StripeObject] + network_data: Optional[NetworkData] """ Details about the authorization, such as identifiers, set by the card network. """ @@ -510,11 +706,11 @@ class ReverseParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - pending_request: Optional[StripeObject] + pending_request: Optional[PendingRequest] """ The pending authorization request. This field will only be non-null during an `issuing_authorization.request` webhook. """ - request_history: List[StripeObject] + request_history: List[RequestHistory] """ History of every time a `pending_request` authorization was approved/declined, either by you directly or by Stripe (e.g. based on your spending_controls). If the merchant changes the authorization by performing an incremental authorization, you can look at this field to see the previous requests for the authorization. This field can be helpful in determining why a given authorization was approved/declined. """ @@ -530,11 +726,11 @@ class ReverseParams(RequestOptions): """ List of [transactions](https://stripe.com/docs/api/issuing/transactions) associated with this authorization. """ - treasury: Optional[StripeObject] + treasury: Optional[Treasury] """ [Treasury](https://stripe.com/docs/api/treasury) details related to this authorization if it was created on a [FinancialAccount](https://stripe.com/docs/api/treasury/financial_accounts). """ - verification_data: StripeObject + verification_data: VerificationData wallet: Optional[str] """ The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. Will populate as `null` when no digital wallet was utilized. @@ -976,5 +1172,15 @@ def reverse( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "amount_details": AmountDetails, + "merchant_data": MerchantData, + "network_data": NetworkData, + "pending_request": PendingRequest, + "request_history": RequestHistory, + "treasury": Treasury, + "verification_data": VerificationData, + } + Authorization.TestHelpers._resource_cls = Authorization diff --git a/stripe/api_resources/issuing/card.py b/stripe/api_resources/issuing/card.py index 1072f6659..0e06b60e4 100644 --- a/stripe/api_resources/issuing/card.py +++ b/stripe/api_resources/issuing/card.py @@ -37,6 +37,1077 @@ class Card( """ OBJECT_NAME: ClassVar[Literal["issuing.card"]] = "issuing.card" + + class Shipping(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class Customs(StripeObject): + eori_number: Optional[str] + """ + A registration number used for customs in Europe. See [https://www.gov.uk/eori](https://www.gov.uk/eori) for the UK and [https://ec.europa.eu/taxation_customs/business/customs-procedures-import-and-export/customs-procedures/economic-operators-registration-and-identification-number-eori_en](https://ec.europa.eu/taxation_customs/business/customs-procedures-import-and-export/customs-procedures/economic-operators-registration-and-identification-number-eori_en) for the EU. + """ + + address: Address + carrier: Optional[Literal["dhl", "fedex", "royal_mail", "usps"]] + """ + The delivery company that shipped a card. + """ + customs: Optional[Customs] + """ + Additional information that may be required for clearing customs. + """ + eta: Optional[int] + """ + A unix timestamp representing a best estimate of when the card will be delivered. + """ + name: str + """ + Recipient name. + """ + phone_number: Optional[str] + """ + The phone number of the receiver of the shipment. Our courier partners will use this number to contact you in the event of card delivery issues. For individual shipments to the EU/UK, if this field is empty, we will provide them with the phone number provided when the cardholder was initially created. + """ + require_signature: Optional[bool] + """ + Whether a signature is required for card delivery. This feature is only supported for US users. Standard shipping service does not support signature on delivery. The default value for standard shipping service is false and for express and priority services is true. + """ + service: Literal["express", "priority", "standard"] + """ + Shipment service, such as `standard` or `express`. + """ + status: Optional[ + Literal[ + "canceled", + "delivered", + "failure", + "pending", + "returned", + "shipped", + ] + ] + """ + The delivery status of the card. + """ + tracking_number: Optional[str] + """ + A tracking number for a card shipment. + """ + tracking_url: Optional[str] + """ + A link to the shipping carrier's site where you can view detailed information about a card shipment. + """ + type: Literal["bulk", "individual"] + """ + Packaging options. + """ + _inner_class_types = {"address": Address, "customs": Customs} + + class SpendingControls(StripeObject): + class SpendingLimit(StripeObject): + amount: int + """ + Maximum amount allowed to spend per interval. This amount is in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + categories: Optional[ + List[ + Literal[ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ] + ] + ] + """ + Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. Omitting this field will apply the limit to all categories. + """ + interval: Literal[ + "all_time", + "daily", + "monthly", + "per_authorization", + "weekly", + "yearly", + ] + """ + Interval (or event) to which the amount applies. + """ + + allowed_categories: Optional[ + List[ + Literal[ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ] + ] + ] + """ + Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. All other categories will be blocked. Cannot be set with `blocked_categories`. + """ + blocked_categories: Optional[ + List[ + Literal[ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ] + ] + ] + """ + Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. All other categories will be allowed. Cannot be set with `allowed_categories`. + """ + spending_limits: Optional[List[SpendingLimit]] + """ + Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). + """ + spending_limits_currency: Optional[str] + """ + Currency of the amounts within `spending_limits`. Always the same as the currency of the card. + """ + _inner_class_types = {"spending_limits": SpendingLimit} + + class Wallets(StripeObject): + class ApplePay(StripeObject): + eligible: bool + """ + Apple Pay Eligibility + """ + ineligible_reason: Optional[ + Literal[ + "missing_agreement", + "missing_cardholder_contact", + "unsupported_region", + ] + ] + """ + Reason the card is ineligible for Apple Pay + """ + + class GooglePay(StripeObject): + eligible: bool + """ + Google Pay Eligibility + """ + ineligible_reason: Optional[ + Literal[ + "missing_agreement", + "missing_cardholder_contact", + "unsupported_region", + ] + ] + """ + Reason the card is ineligible for Google Pay + """ + + apple_pay: ApplePay + google_pay: GooglePay + primary_account_identifier: Optional[str] + """ + Unique identifier for a card used with digital wallets + """ + _inner_class_types = {"apple_pay": ApplePay, "google_pay": GooglePay} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -444,11 +1515,11 @@ class ShipCardParams(RequestOptions): """ The reason why the previous card needed to be replaced. """ - shipping: Optional[StripeObject] + shipping: Optional[Shipping] """ Where and how the card will be shipped. """ - spending_controls: StripeObject + spending_controls: SpendingControls status: Literal["active", "canceled", "inactive"] """ Whether authorizations can be approved on this card. May be blocked from activating cards depending on past-due Cardholder requirements. Defaults to `inactive`. @@ -457,7 +1528,7 @@ class ShipCardParams(RequestOptions): """ The type of the card. """ - wallets: Optional[StripeObject] + wallets: Optional[Wallets] """ Information relating to digital wallets (like Apple Pay and Google Pay). """ @@ -776,5 +1847,11 @@ def ship_card( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "shipping": Shipping, + "spending_controls": SpendingControls, + "wallets": Wallets, + } + Card.TestHelpers._resource_cls = Card diff --git a/stripe/api_resources/issuing/cardholder.py b/stripe/api_resources/issuing/cardholder.py index 1a686453f..4d790eb98 100644 --- a/stripe/api_resources/issuing/cardholder.py +++ b/stripe/api_resources/issuing/cardholder.py @@ -5,6 +5,7 @@ ListableAPIResource, UpdateableAPIResource, ) +from stripe.api_resources.expandable_field import ExpandableField from stripe.api_resources.list_object import ListObject from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject @@ -18,6 +19,9 @@ ) from urllib.parse import quote_plus +if TYPE_CHECKING: + from stripe.api_resources.file import File + class Cardholder( CreateableAPIResource["Cardholder"], @@ -31,6 +35,1093 @@ class Cardholder( """ OBJECT_NAME: ClassVar[Literal["issuing.cardholder"]] = "issuing.cardholder" + + class Billing(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Address + _inner_class_types = {"address": Address} + + class Company(StripeObject): + tax_id_provided: bool + """ + Whether the company's business ID number was provided. + """ + + class Individual(StripeObject): + class CardIssuing(StripeObject): + class UserTermsAcceptance(StripeObject): + date: Optional[int] + """ + The Unix timestamp marking when the cardholder accepted the Authorized User Terms. Required for Celtic Spend Card users. + """ + ip: Optional[str] + """ + The IP address from which the cardholder accepted the Authorized User Terms. Required for Celtic Spend Card users. + """ + user_agent: Optional[str] + """ + The user agent of the browser from which the cardholder accepted the Authorized User Terms. + """ + + user_terms_acceptance: Optional[UserTermsAcceptance] + """ + Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). + """ + _inner_class_types = {"user_terms_acceptance": UserTermsAcceptance} + + class Dob(StripeObject): + day: Optional[int] + """ + The day of birth, between 1 and 31. + """ + month: Optional[int] + """ + The month of birth, between 1 and 12. + """ + year: Optional[int] + """ + The four-digit year of birth. + """ + + class Verification(StripeObject): + class Document(StripeObject): + back: Optional[ExpandableField["File"]] + """ + The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + """ + front: Optional[ExpandableField["File"]] + """ + The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + """ + + document: Optional[Document] + """ + An identifying document, either a passport or local ID card. + """ + _inner_class_types = {"document": Document} + + card_issuing: Optional[CardIssuing] + """ + Information related to the card_issuing program for this cardholder. + """ + dob: Optional[Dob] + """ + The date of birth of this cardholder. + """ + first_name: Optional[str] + """ + The first name of this cardholder. Required before activating Cards. This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters. + """ + last_name: Optional[str] + """ + The last name of this cardholder. Required before activating Cards. This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters. + """ + verification: Optional[Verification] + """ + Government-issued ID document for this cardholder. + """ + _inner_class_types = { + "card_issuing": CardIssuing, + "dob": Dob, + "verification": Verification, + } + + class Requirements(StripeObject): + disabled_reason: Optional[ + Literal[ + "listed", + "rejected.listed", + "requirements.past_due", + "under_review", + ] + ] + """ + If `disabled_reason` is present, all cards will decline authorizations with `cardholder_verification_required` reason. + """ + past_due: Optional[ + List[ + Literal[ + "company.tax_id", + "individual.card_issuing.user_terms_acceptance.date", + "individual.card_issuing.user_terms_acceptance.ip", + "individual.dob.day", + "individual.dob.month", + "individual.dob.year", + "individual.first_name", + "individual.last_name", + "individual.verification.document", + ] + ] + ] + """ + Array of fields that need to be collected in order to verify and re-enable the cardholder. + """ + + class SpendingControls(StripeObject): + class SpendingLimit(StripeObject): + amount: int + """ + Maximum amount allowed to spend per interval. This amount is in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + categories: Optional[ + List[ + Literal[ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ] + ] + ] + """ + Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. Omitting this field will apply the limit to all categories. + """ + interval: Literal[ + "all_time", + "daily", + "monthly", + "per_authorization", + "weekly", + "yearly", + ] + """ + Interval (or event) to which the amount applies. + """ + + allowed_categories: Optional[ + List[ + Literal[ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ] + ] + ] + """ + Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. All other categories will be blocked. Cannot be set with `blocked_categories`. + """ + blocked_categories: Optional[ + List[ + Literal[ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ] + ] + ] + """ + Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. All other categories will be allowed. Cannot be set with `allowed_categories`. + """ + spending_limits: Optional[List[SpendingLimit]] + """ + Limit spending with amount-based rules that apply across this cardholder's cards. + """ + spending_limits_currency: Optional[str] + """ + Currency of the amounts within `spending_limits`. + """ + _inner_class_types = {"spending_limits": SpendingLimit} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -529,8 +1620,8 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - billing: StripeObject - company: Optional[StripeObject] + billing: Billing + company: Optional[Company] """ Additional information about a `company` cardholder. """ @@ -546,7 +1637,7 @@ class RetrieveParams(RequestOptions): """ Unique identifier for the object. """ - individual: Optional[StripeObject] + individual: Optional[Individual] """ Additional information about an `individual` cardholder. """ @@ -575,8 +1666,8 @@ class RetrieveParams(RequestOptions): The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`. This changes the language of the [3D Secure flow](https://stripe.com/docs/issuing/3d-secure) and one-time password messages sent to the cardholder. """ - requirements: StripeObject - spending_controls: Optional[StripeObject] + requirements: Requirements + spending_controls: Optional[SpendingControls] """ Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. """ @@ -653,3 +1744,11 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "billing": Billing, + "company": Company, + "individual": Individual, + "requirements": Requirements, + "spending_controls": SpendingControls, + } diff --git a/stripe/api_resources/issuing/dispute.py b/stripe/api_resources/issuing/dispute.py index a32c181fa..45c118d54 100644 --- a/stripe/api_resources/issuing/dispute.py +++ b/stripe/api_resources/issuing/dispute.py @@ -23,6 +23,7 @@ if TYPE_CHECKING: from stripe.api_resources.balance_transaction import BalanceTransaction + from stripe.api_resources.file import File from stripe.api_resources.issuing.transaction import Transaction @@ -38,6 +39,213 @@ class Dispute( """ OBJECT_NAME: ClassVar[Literal["issuing.dispute"]] = "issuing.dispute" + + class Evidence(StripeObject): + class Canceled(StripeObject): + additional_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + """ + canceled_at: Optional[int] + """ + Date when order was canceled. + """ + cancellation_policy_provided: Optional[bool] + """ + Whether the cardholder was provided with a cancellation policy. + """ + cancellation_reason: Optional[str] + """ + Reason for canceling the order. + """ + expected_at: Optional[int] + """ + Date when the cardholder expected to receive the product. + """ + explanation: Optional[str] + """ + Explanation of why the cardholder is disputing this transaction. + """ + product_description: Optional[str] + """ + Description of the merchandise or service that was purchased. + """ + product_type: Optional[Literal["merchandise", "service"]] + """ + Whether the product was a merchandise or service. + """ + return_status: Optional[Literal["merchant_rejected", "successful"]] + """ + Result of cardholder's attempt to return the product. + """ + returned_at: Optional[int] + """ + Date when the product was returned or attempted to be returned. + """ + + class Duplicate(StripeObject): + additional_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + """ + card_statement: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the card statement showing that the product had already been paid for. + """ + cash_receipt: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the receipt showing that the product had been paid for in cash. + """ + check_image: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Image of the front and back of the check that was used to pay for the product. + """ + explanation: Optional[str] + """ + Explanation of why the cardholder is disputing this transaction. + """ + original_transaction: Optional[str] + """ + Transaction (e.g., ipi_...) that the disputed transaction is a duplicate of. Of the two or more transactions that are copies of each other, this is original undisputed one. + """ + + class Fraudulent(StripeObject): + additional_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + """ + explanation: Optional[str] + """ + Explanation of why the cardholder is disputing this transaction. + """ + + class MerchandiseNotAsDescribed(StripeObject): + additional_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + """ + explanation: Optional[str] + """ + Explanation of why the cardholder is disputing this transaction. + """ + received_at: Optional[int] + """ + Date when the product was received. + """ + return_description: Optional[str] + """ + Description of the cardholder's attempt to return the product. + """ + return_status: Optional[Literal["merchant_rejected", "successful"]] + """ + Result of cardholder's attempt to return the product. + """ + returned_at: Optional[int] + """ + Date when the product was returned or attempted to be returned. + """ + + class NotReceived(StripeObject): + additional_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + """ + expected_at: Optional[int] + """ + Date when the cardholder expected to receive the product. + """ + explanation: Optional[str] + """ + Explanation of why the cardholder is disputing this transaction. + """ + product_description: Optional[str] + """ + Description of the merchandise or service that was purchased. + """ + product_type: Optional[Literal["merchandise", "service"]] + """ + Whether the product was a merchandise or service. + """ + + class Other(StripeObject): + additional_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + """ + explanation: Optional[str] + """ + Explanation of why the cardholder is disputing this transaction. + """ + product_description: Optional[str] + """ + Description of the merchandise or service that was purchased. + """ + product_type: Optional[Literal["merchandise", "service"]] + """ + Whether the product was a merchandise or service. + """ + + class ServiceNotAsDescribed(StripeObject): + additional_documentation: Optional[ExpandableField["File"]] + """ + (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + """ + canceled_at: Optional[int] + """ + Date when order was canceled. + """ + cancellation_reason: Optional[str] + """ + Reason for canceling the order. + """ + explanation: Optional[str] + """ + Explanation of why the cardholder is disputing this transaction. + """ + received_at: Optional[int] + """ + Date when the product was received. + """ + + canceled: Optional[Canceled] + duplicate: Optional[Duplicate] + fraudulent: Optional[Fraudulent] + merchandise_not_as_described: Optional[MerchandiseNotAsDescribed] + not_received: Optional[NotReceived] + other: Optional[Other] + reason: Literal[ + "canceled", + "duplicate", + "fraudulent", + "merchandise_not_as_described", + "not_received", + "other", + "service_not_as_described", + ] + """ + The reason for filing the dispute. Its value will match the field containing the evidence. + """ + service_not_as_described: Optional[ServiceNotAsDescribed] + _inner_class_types = { + "canceled": Canceled, + "duplicate": Duplicate, + "fraudulent": Fraudulent, + "merchandise_not_as_described": MerchandiseNotAsDescribed, + "not_received": NotReceived, + "other": Other, + "service_not_as_described": ServiceNotAsDescribed, + } + + class Treasury(StripeObject): + debit_reversal: Optional[str] + """ + The Treasury [DebitReversal](https://stripe.com/docs/api/treasury/debit_reversals) representing this Issuing dispute + """ + received_debit: str + """ + The Treasury [ReceivedDebit](https://stripe.com/docs/api/treasury/received_debits) that is being disputed. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -624,7 +832,7 @@ class SubmitParams(RequestOptions): """ The currency the `transaction` was made in. """ - evidence: StripeObject + evidence: Evidence id: str """ Unique identifier for the object. @@ -649,7 +857,7 @@ class SubmitParams(RequestOptions): """ The transaction being disputed. """ - treasury: Optional[StripeObject] + treasury: Optional[Treasury] """ [Treasury](https://stripe.com/docs/api/treasury) details related to this dispute if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts """ @@ -779,3 +987,5 @@ def submit( # pyright: ignore[reportGeneralTypeIssues] params=params, ), ) + + _inner_class_types = {"evidence": Evidence, "treasury": Treasury} diff --git a/stripe/api_resources/issuing/token.py b/stripe/api_resources/issuing/token.py index fab12cf53..c1d5875a9 100644 --- a/stripe/api_resources/issuing/token.py +++ b/stripe/api_resources/issuing/token.py @@ -28,6 +28,172 @@ class Token(ListableAPIResource["Token"], UpdateableAPIResource["Token"]): """ OBJECT_NAME: ClassVar[Literal["issuing.token"]] = "issuing.token" + + class NetworkData(StripeObject): + class Device(StripeObject): + device_fingerprint: Optional[str] + """ + An obfuscated ID derived from the device ID. + """ + ip_address: Optional[str] + """ + The IP address of the device at provisioning time. + """ + location: Optional[str] + """ + The geographic latitude/longitude coordinates of the device at provisioning time. The format is [+-]decimal/[+-]decimal. + """ + name: Optional[str] + """ + The name of the device used for tokenization. + """ + phone_number: Optional[str] + """ + The phone number of the device used for tokenization. + """ + type: Optional[Literal["other", "phone", "watch"]] + """ + The type of device used for tokenization. + """ + + class Mastercard(StripeObject): + card_reference_id: Optional[str] + """ + A unique reference ID from MasterCard to represent the card account number. + """ + token_reference_id: str + """ + The network-unique identifier for the token. + """ + token_requestor_id: str + """ + The ID of the entity requesting tokenization, specific to MasterCard. + """ + token_requestor_name: Optional[str] + """ + The name of the entity requesting tokenization, if known. This is directly provided from MasterCard. + """ + + class Visa(StripeObject): + card_reference_id: str + """ + A unique reference ID from Visa to represent the card account number. + """ + token_reference_id: str + """ + The network-unique identifier for the token. + """ + token_requestor_id: str + """ + The ID of the entity requesting tokenization, specific to Visa. + """ + token_risk_score: Optional[str] + """ + Degree of risk associated with the token between `01` and `99`, with higher number indicating higher risk. A `00` value indicates the token was not scored by Visa. + """ + + class WalletProvider(StripeObject): + class CardholderAddress(StripeObject): + line1: str + """ + The street address of the cardholder tokenizing the card. + """ + postal_code: str + """ + The postal code of the cardholder tokenizing the card. + """ + + account_id: Optional[str] + """ + The wallet provider-given account ID of the digital wallet the token belongs to. + """ + account_trust_score: Optional[int] + """ + An evaluation on the trustworthiness of the wallet account between 1 and 5. A higher score indicates more trustworthy. + """ + card_number_source: Optional[ + Literal["app", "manual", "on_file", "other"] + ] + """ + The method used for tokenizing a card. + """ + cardholder_address: Optional[CardholderAddress] + cardholder_name: Optional[str] + """ + The name of the cardholder tokenizing the card. + """ + device_trust_score: Optional[int] + """ + An evaluation on the trustworthiness of the device. A higher score indicates more trustworthy. + """ + hashed_account_email_address: Optional[str] + """ + The hashed email address of the cardholder's account with the wallet provider. + """ + reason_codes: Optional[ + List[ + Literal[ + "account_card_too_new", + "account_recently_changed", + "account_too_new", + "account_too_new_since_launch", + "additional_device", + "data_expired", + "defer_id_v_decision", + "device_recently_lost", + "good_activity_history", + "has_suspended_tokens", + "high_risk", + "inactive_account", + "long_account_tenure", + "low_account_score", + "low_device_score", + "low_phone_number_score", + "network_service_error", + "outside_home_territory", + "provisioning_cardholder_mismatch", + "provisioning_device_and_cardholder_mismatch", + "provisioning_device_mismatch", + "same_device_no_prior_authentication", + "same_device_successful_prior_authentication", + "software_update", + "suspicious_activity", + "too_many_different_cardholders", + "too_many_recent_attempts", + "too_many_recent_tokens", + ] + ] + ] + """ + The reasons for suggested tokenization given by the card network. + """ + suggested_decision: Optional[ + Literal["approve", "decline", "require_auth"] + ] + """ + The recommendation on responding to the tokenization request. + """ + suggested_decision_version: Optional[str] + """ + The version of the standard for mapping reason codes followed by the wallet provider. + """ + _inner_class_types = {"cardholder_address": CardholderAddress} + + device: Optional[Device] + mastercard: Optional[Mastercard] + type: Literal["mastercard", "visa"] + """ + The network that the token is associated with. An additional hash is included with a name matching this value, containing tokenization data specific to the card network. + """ + visa: Optional[Visa] + wallet_provider: Optional[WalletProvider] + _inner_class_types = { + "device": Device, + "mastercard": Mastercard, + "visa": Visa, + "wallet_provider": WalletProvider, + } + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -124,7 +290,7 @@ class RetrieveParams(RequestOptions): """ The token service provider / card network associated with the token. """ - network_data: Optional[StripeObject] + network_data: Optional[NetworkData] network_updated_at: int """ Time at which the token was last updated by the card network. Measured in seconds since the Unix epoch. @@ -186,3 +352,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"network_data": NetworkData} diff --git a/stripe/api_resources/issuing/transaction.py b/stripe/api_resources/issuing/transaction.py index b833ecf74..04ecbb913 100644 --- a/stripe/api_resources/issuing/transaction.py +++ b/stripe/api_resources/issuing/transaction.py @@ -46,6 +46,188 @@ class Transaction( OBJECT_NAME: ClassVar[ Literal["issuing.transaction"] ] = "issuing.transaction" + + class AmountDetails(StripeObject): + atm_fee: Optional[int] + """ + The fee charged by the ATM for the cash withdrawal. + """ + cashback_amount: Optional[int] + """ + The amount of cash requested by the cardholder. + """ + + class MerchantData(StripeObject): + category: str + """ + A categorization of the seller's type of business. See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. + """ + category_code: str + """ + The merchant category code for the seller's business + """ + city: Optional[str] + """ + City where the seller is located + """ + country: Optional[str] + """ + Country where the seller is located + """ + name: Optional[str] + """ + Name of the seller + """ + network_id: str + """ + Identifier assigned to the seller by the card network. Different card networks may assign different network_id fields to the same merchant. + """ + postal_code: Optional[str] + """ + Postal code where the seller is located + """ + state: Optional[str] + """ + State where the seller is located + """ + terminal_id: Optional[str] + """ + An ID assigned by the seller to the location of the sale. + """ + + class PurchaseDetails(StripeObject): + class Flight(StripeObject): + class Segment(StripeObject): + arrival_airport_code: Optional[str] + """ + The three-letter IATA airport code of the flight's destination. + """ + carrier: Optional[str] + """ + The airline carrier code. + """ + departure_airport_code: Optional[str] + """ + The three-letter IATA airport code that the flight departed from. + """ + flight_number: Optional[str] + """ + The flight number. + """ + service_class: Optional[str] + """ + The flight's service class. + """ + stopover_allowed: Optional[bool] + """ + Whether a stopover is allowed on this flight. + """ + + departure_at: Optional[int] + """ + The time that the flight departed. + """ + passenger_name: Optional[str] + """ + The name of the passenger. + """ + refundable: Optional[bool] + """ + Whether the ticket is refundable. + """ + segments: Optional[List[Segment]] + """ + The legs of the trip. + """ + travel_agency: Optional[str] + """ + The travel agency that issued the ticket. + """ + _inner_class_types = {"segments": Segment} + + class Fuel(StripeObject): + type: str + """ + The type of fuel that was purchased. One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. + """ + unit: str + """ + The units for `volume_decimal`. One of `us_gallon` or `liter`. + """ + unit_cost_decimal: str + """ + The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. + """ + volume_decimal: Optional[str] + """ + The volume of the fuel that was pumped, represented as a decimal string with at most 12 decimal places. + """ + + class Lodging(StripeObject): + check_in_at: Optional[int] + """ + The time of checking into the lodging. + """ + nights: Optional[int] + """ + The number of nights stayed at the lodging. + """ + + class Receipt(StripeObject): + description: Optional[str] + """ + The description of the item. The maximum length of this field is 26 characters. + """ + quantity: Optional[float] + """ + The quantity of the item. + """ + total: Optional[int] + """ + The total for this line item in cents. + """ + unit_cost: Optional[int] + """ + The unit cost of the item in cents. + """ + + flight: Optional[Flight] + """ + Information about the flight that was purchased with this transaction. + """ + fuel: Optional[Fuel] + """ + Information about fuel that was purchased with this transaction. + """ + lodging: Optional[Lodging] + """ + Information about lodging that was purchased with this transaction. + """ + receipt: Optional[List[Receipt]] + """ + The line items in the purchase. + """ + reference: Optional[str] + """ + A merchant-specific order number. + """ + _inner_class_types = { + "flight": Flight, + "fuel": Fuel, + "lodging": Lodging, + "receipt": Receipt, + } + + class Treasury(StripeObject): + received_credit: Optional[str] + """ + The Treasury [ReceivedCredit](https://stripe.com/docs/api/treasury/received_credits) representing this Issuing transaction if it is a refund + """ + received_debit: Optional[str] + """ + The Treasury [ReceivedDebit](https://stripe.com/docs/api/treasury/received_debits) representing this Issuing transaction if it is a capture + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -496,7 +678,7 @@ class RefundParams(RequestOptions): """ The transaction amount, which will be reflected in your balance. This amount is in your currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). """ - amount_details: Optional[StripeObject] + amount_details: Optional[AmountDetails] """ Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). """ @@ -544,7 +726,7 @@ class RefundParams(RequestOptions): """ The currency with which the merchant is taking payment. """ - merchant_data: StripeObject + merchant_data: MerchantData 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. @@ -553,7 +735,7 @@ class RefundParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - purchase_details: Optional[StripeObject] + purchase_details: Optional[PurchaseDetails] """ Additional purchase information that is optionally provided by the merchant. """ @@ -561,7 +743,7 @@ class RefundParams(RequestOptions): """ [Token](https://stripe.com/docs/api/issuing/tokens/object) object used for this transaction. If a network token was not used for this transaction, this field will be null. """ - treasury: Optional[StripeObject] + treasury: Optional[Treasury] """ [Treasury](https://stripe.com/docs/api/treasury) details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts """ @@ -725,5 +907,12 @@ def refund( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "amount_details": AmountDetails, + "merchant_data": MerchantData, + "purchase_details": PurchaseDetails, + "treasury": Treasury, + } + Transaction.TestHelpers._resource_cls = Transaction diff --git a/stripe/api_resources/line_item.py b/stripe/api_resources/line_item.py index 849b8254d..4fd311ce6 100644 --- a/stripe/api_resources/line_item.py +++ b/stripe/api_resources/line_item.py @@ -5,7 +5,9 @@ from typing_extensions import Literal, TYPE_CHECKING if TYPE_CHECKING: + from stripe.api_resources.discount import Discount as DiscountResource from stripe.api_resources.price import Price + from stripe.api_resources.tax_rate import TaxRate class LineItem(StripeObject): @@ -14,6 +16,58 @@ class LineItem(StripeObject): """ OBJECT_NAME: ClassVar[Literal["item"]] = "item" + + class Discount(StripeObject): + amount: int + """ + The amount discounted. + """ + discount: "DiscountResource" + """ + A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). + It contains information about when the discount began, when it will end, and what it is applied to. + + Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) + """ + + class Tax(StripeObject): + amount: int + """ + Amount of tax applied for this rate. + """ + rate: "TaxRate" + """ + Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + + Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + amount_discount: int """ Total discount amount applied. If no discounts were applied, defaults to 0. @@ -38,7 +92,7 @@ class LineItem(StripeObject): """ An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name. """ - discounts: Optional[List[StripeObject]] + discounts: Optional[List[Discount]] """ The discounts applied to the line item. """ @@ -58,7 +112,9 @@ class LineItem(StripeObject): """ The quantity of products being purchased. """ - taxes: Optional[List[StripeObject]] + taxes: Optional[List[Tax]] """ The taxes applied to the line item. """ + + _inner_class_types = {"discounts": Discount, "taxes": Tax} diff --git a/stripe/api_resources/mandate.py b/stripe/api_resources/mandate.py index e842e8516..0b2fcbd1b 100644 --- a/stripe/api_resources/mandate.py +++ b/stripe/api_resources/mandate.py @@ -17,6 +17,144 @@ class Mandate(APIResource["Mandate"]): """ OBJECT_NAME: ClassVar[Literal["mandate"]] = "mandate" + + class CustomerAcceptance(StripeObject): + class Offline(StripeObject): + pass + + class Online(StripeObject): + ip_address: Optional[str] + """ + The customer accepts the mandate from this IP address. + """ + user_agent: Optional[str] + """ + The customer accepts the mandate using the user agent of the browser. + """ + + accepted_at: Optional[int] + """ + The time that the customer accepts the mandate. + """ + offline: Optional[Offline] + online: Optional[Online] + type: Literal["offline", "online"] + """ + The mandate includes the type of customer acceptance information, such as: `online` or `offline`. + """ + _inner_class_types = {"offline": Offline, "online": Online} + + class MultiUse(StripeObject): + pass + + class PaymentMethodDetails(StripeObject): + class AcssDebit(StripeObject): + default_for: Optional[List[Literal["invoice", "subscription"]]] + """ + List of Stripe products where this mandate can be selected automatically. + """ + interval_description: Optional[str] + """ + Description of the interval. Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. + """ + payment_schedule: Literal["combined", "interval", "sporadic"] + """ + Payment schedule for the mandate. + """ + transaction_type: Literal["business", "personal"] + """ + Transaction type of the mandate. + """ + + class AuBecsDebit(StripeObject): + url: str + """ + The URL of the mandate. This URL generally contains sensitive information about the customer and should be shared with them exclusively. + """ + + class BacsDebit(StripeObject): + network_status: Literal[ + "accepted", "pending", "refused", "revoked" + ] + """ + The status of the mandate on the Bacs network. Can be one of `pending`, `revoked`, `refused`, or `accepted`. + """ + reference: str + """ + The unique reference identifying the mandate on the Bacs network. + """ + url: str + """ + The URL that will contain the mandate that the customer has signed. + """ + + class Card(StripeObject): + pass + + class Cashapp(StripeObject): + pass + + class Link(StripeObject): + pass + + class Paypal(StripeObject): + billing_agreement_id: Optional[str] + """ + The PayPal Billing Agreement ID (BAID). This is an ID generated by PayPal which represents the mandate between the merchant and the customer. + """ + payer_id: Optional[str] + """ + PayPal account PayerID. This identifier uniquely identifies the PayPal customer. + """ + + class SepaDebit(StripeObject): + reference: str + """ + The unique reference of the mandate. + """ + url: str + """ + The URL of the mandate. This URL generally contains sensitive information about the customer and should be shared with them exclusively. + """ + + class UsBankAccount(StripeObject): + pass + + acss_debit: Optional[AcssDebit] + au_becs_debit: Optional[AuBecsDebit] + bacs_debit: Optional[BacsDebit] + card: Optional[Card] + cashapp: Optional[Cashapp] + link: Optional[Link] + paypal: Optional[Paypal] + sepa_debit: Optional[SepaDebit] + type: str + """ + This mandate corresponds with a specific payment method type. The `payment_method_details` includes an additional hash with the same name and contains mandate information that's specific to that payment method. + """ + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "acss_debit": AcssDebit, + "au_becs_debit": AuBecsDebit, + "bacs_debit": BacsDebit, + "card": Card, + "cashapp": Cashapp, + "link": Link, + "paypal": Paypal, + "sepa_debit": SepaDebit, + "us_bank_account": UsBankAccount, + } + + class SingleUse(StripeObject): + amount: int + """ + The amount of the payment on a single use mandate. + """ + currency: str + """ + The currency of the payment on a single use mandate. + """ + if TYPE_CHECKING: class RetrieveParams(RequestOptions): @@ -25,7 +163,7 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - customer_acceptance: StripeObject + customer_acceptance: CustomerAcceptance id: str """ Unique identifier for the object. @@ -34,7 +172,7 @@ class RetrieveParams(RequestOptions): """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. """ - multi_use: Optional[StripeObject] + multi_use: Optional[MultiUse] object: Literal["mandate"] """ String representing the object's type. Objects of the same type share the same value. @@ -47,8 +185,8 @@ class RetrieveParams(RequestOptions): """ ID of the payment method associated with this mandate. """ - payment_method_details: StripeObject - single_use: Optional[StripeObject] + payment_method_details: PaymentMethodDetails + single_use: Optional[SingleUse] status: Literal["active", "inactive", "pending"] """ The mandate status indicates whether or not you can use it to initiate a payment. @@ -65,3 +203,10 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "customer_acceptance": CustomerAcceptance, + "multi_use": MultiUse, + "payment_method_details": PaymentMethodDetails, + "single_use": SingleUse, + } diff --git a/stripe/api_resources/payment_intent.py b/stripe/api_resources/payment_intent.py index 079f0f377..651d19d4b 100644 --- a/stripe/api_resources/payment_intent.py +++ b/stripe/api_resources/payment_intent.py @@ -14,6 +14,7 @@ from stripe.stripe_object import StripeObject from stripe.util import class_method_variant from typing import ( + Any, ClassVar, Dict, Iterator, @@ -36,12 +37,13 @@ from stripe.api_resources.account import Account from stripe.api_resources.application import Application from stripe.api_resources.bank_account import BankAccount - from stripe.api_resources.card import Card + from stripe.api_resources.card import Card as CardResource from stripe.api_resources.charge import Charge from stripe.api_resources.customer import Customer from stripe.api_resources.invoice import Invoice from stripe.api_resources.payment_method import PaymentMethod from stripe.api_resources.review import Review + from stripe.api_resources.setup_intent import SetupIntent from stripe.api_resources.source import Source @@ -66,6 +68,1641 @@ class PaymentIntent( """ OBJECT_NAME: ClassVar[Literal["payment_intent"]] = "payment_intent" + + class AmountDetails(StripeObject): + class Tip(StripeObject): + amount: Optional[int] + """ + Portion of the amount that corresponds to a tip. + """ + + tip: Optional[Tip] + _inner_class_types = {"tip": Tip} + + class AutomaticPaymentMethods(StripeObject): + allow_redirects: Optional[Literal["always", "never"]] + """ + Controls whether this PaymentIntent will accept redirect-based payment methods. + + Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps. To [confirm](https://stripe.com/docs/api/payment_intents/confirm) this PaymentIntent, you may be required to provide a `return_url` to redirect customers back to your site after they authenticate or complete the payment. + """ + enabled: bool + """ + Automatically calculates compatible payment methods + """ + + class LastPaymentError(StripeObject): + charge: Optional[str] + """ + For card errors, the ID of the failed charge. + """ + code: Optional[ + Literal[ + "account_closed", + "account_country_invalid_address", + "account_error_country_change_requires_additional_steps", + "account_information_mismatch", + "account_invalid", + "account_number_invalid", + "acss_debit_session_incomplete", + "alipay_upgrade_required", + "amount_too_large", + "amount_too_small", + "api_key_expired", + "application_fees_not_allowed", + "authentication_required", + "balance_insufficient", + "bank_account_bad_routing_numbers", + "bank_account_declined", + "bank_account_exists", + "bank_account_restricted", + "bank_account_unusable", + "bank_account_unverified", + "bank_account_verification_failed", + "billing_invalid_mandate", + "bitcoin_upgrade_required", + "capture_charge_authorization_expired", + "capture_unauthorized_payment", + "card_decline_rate_limit_exceeded", + "card_declined", + "cardholder_phone_number_required", + "charge_already_captured", + "charge_already_refunded", + "charge_disputed", + "charge_exceeds_source_limit", + "charge_expired_for_capture", + "charge_invalid_parameter", + "charge_not_refundable", + "clearing_code_unsupported", + "country_code_invalid", + "country_unsupported", + "coupon_expired", + "customer_max_payment_methods", + "customer_max_subscriptions", + "debit_not_authorized", + "email_invalid", + "expired_card", + "idempotency_key_in_use", + "incorrect_address", + "incorrect_cvc", + "incorrect_number", + "incorrect_zip", + "instant_payouts_config_disabled", + "instant_payouts_currency_disabled", + "instant_payouts_limit_exceeded", + "instant_payouts_unsupported", + "insufficient_funds", + "intent_invalid_state", + "intent_verification_method_missing", + "invalid_card_type", + "invalid_characters", + "invalid_charge_amount", + "invalid_cvc", + "invalid_expiry_month", + "invalid_expiry_year", + "invalid_number", + "invalid_source_usage", + "invalid_tax_location", + "invoice_no_customer_line_items", + "invoice_no_payment_method_types", + "invoice_no_subscription_line_items", + "invoice_not_editable", + "invoice_on_behalf_of_not_editable", + "invoice_payment_intent_requires_action", + "invoice_upcoming_none", + "livemode_mismatch", + "lock_timeout", + "missing", + "no_account", + "not_allowed_on_standard_account", + "out_of_inventory", + "ownership_declaration_not_allowed", + "parameter_invalid_empty", + "parameter_invalid_integer", + "parameter_invalid_string_blank", + "parameter_invalid_string_empty", + "parameter_missing", + "parameter_unknown", + "parameters_exclusive", + "payment_intent_action_required", + "payment_intent_authentication_failure", + "payment_intent_incompatible_payment_method", + "payment_intent_invalid_parameter", + "payment_intent_konbini_rejected_confirmation_number", + "payment_intent_mandate_invalid", + "payment_intent_payment_attempt_expired", + "payment_intent_payment_attempt_failed", + "payment_intent_unexpected_state", + "payment_method_bank_account_already_verified", + "payment_method_bank_account_blocked", + "payment_method_billing_details_address_missing", + "payment_method_configuration_failures", + "payment_method_currency_mismatch", + "payment_method_customer_decline", + "payment_method_invalid_parameter", + "payment_method_invalid_parameter_testmode", + "payment_method_microdeposit_failed", + "payment_method_microdeposit_verification_amounts_invalid", + "payment_method_microdeposit_verification_amounts_mismatch", + "payment_method_microdeposit_verification_attempts_exceeded", + "payment_method_microdeposit_verification_descriptor_code_mismatch", + "payment_method_microdeposit_verification_timeout", + "payment_method_not_available", + "payment_method_provider_decline", + "payment_method_provider_timeout", + "payment_method_unactivated", + "payment_method_unexpected_state", + "payment_method_unsupported_type", + "payout_reconciliation_not_ready", + "payouts_limit_exceeded", + "payouts_not_allowed", + "platform_account_required", + "platform_api_key_expired", + "postal_code_invalid", + "processing_error", + "product_inactive", + "progressive_onboarding_limit_exceeded", + "rate_limit", + "refer_to_customer", + "refund_disputed_payment", + "resource_already_exists", + "resource_missing", + "return_intent_already_processed", + "routing_number_invalid", + "secret_key_required", + "sepa_unsupported_account", + "setup_attempt_failed", + "setup_intent_authentication_failure", + "setup_intent_invalid_parameter", + "setup_intent_mandate_invalid", + "setup_intent_setup_attempt_expired", + "setup_intent_unexpected_state", + "shipping_calculation_failed", + "sku_inactive", + "state_unsupported", + "status_transition_invalid", + "stripe_tax_inactive", + "tax_id_invalid", + "taxes_calculation_failed", + "terminal_location_country_unsupported", + "terminal_reader_busy", + "terminal_reader_offline", + "terminal_reader_timeout", + "testmode_charges_only", + "tls_version_unsupported", + "token_already_used", + "token_in_use", + "transfer_source_balance_parameters_mismatch", + "transfers_not_allowed", + "url_invalid", + ] + ] + """ + For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported. + """ + decline_code: Optional[str] + """ + For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one. + """ + doc_url: Optional[str] + """ + A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported. + """ + message: Optional[str] + """ + A human-readable message providing more details about the error. For card errors, these messages can be shown to your users. + """ + param: Optional[str] + """ + If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. + """ + payment_intent: Optional["PaymentIntent"] + """ + A PaymentIntent guides you through the process of collecting a payment from your customer. + We recommend that you create exactly one PaymentIntent for each order or + customer session in your system. You can reference the PaymentIntent later to + see the history of payment attempts for a particular session. + + A PaymentIntent transitions through + [multiple statuses](https://stripe.com/docs/payments/intents#intent-statuses) + throughout its lifetime as it interfaces with Stripe.js to perform + authentication flows and ultimately creates at most one successful charge. + + Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents) + """ + payment_method: Optional["PaymentMethod"] + """ + PaymentMethod objects represent your customer's payment instruments. + You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to + Customer objects to store instrument details for future payments. + + Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios). + """ + payment_method_type: Optional[str] + """ + If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors. + """ + request_log_url: Optional[str] + """ + A URL to the request log entry in your dashboard. + """ + setup_intent: Optional["SetupIntent"] + """ + A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments. + For example, you can use a SetupIntent to set up and save your customer's card without immediately collecting a payment. + Later, you can use [PaymentIntents](https://stripe.com/docs/api#payment_intents) to drive the payment flow. + + Create a SetupIntent when you're ready to collect your customer's payment credentials. + Don't maintain long-lived, unconfirmed SetupIntents because they might not be valid. + The SetupIntent transitions through multiple [statuses](https://stripe.com/docs/payments/intents#intent-statuses) as it guides + you through the setup process. + + Successful SetupIntents result in payment credentials that are optimized for future payments. + For example, cardholders in [certain regions](https://stripe.com/guides/strong-customer-authentication) might need to be run through + [Strong Customer Authentication](https://stripe.com/docs/strong-customer-authentication) during payment method collection + to streamline later [off-session payments](https://stripe.com/docs/payments/setup-intents). + If you use the SetupIntent with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer), + it automatically attaches the resulting payment method to that Customer after successful setup. + We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on + PaymentIntents to save payment methods to prevent saving invalid or unoptimized payment methods. + + By using SetupIntents, you can reduce friction for your customers, even as regulations change over time. + + Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents) + """ + source: Optional[ + Union["Account", "BankAccount", "CardResource", "Source"] + ] + type: Literal[ + "api_error", + "card_error", + "idempotency_error", + "invalid_request_error", + ] + """ + The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error` + """ + + class NextAction(StripeObject): + class AlipayHandleRedirect(StripeObject): + native_data: Optional[str] + """ + The native data to be used with Alipay SDK you must redirect your customer to in order to authenticate the payment in an Android App. + """ + native_url: Optional[str] + """ + The native URL you must redirect your customer to in order to authenticate the payment in an iOS App. + """ + return_url: Optional[str] + """ + If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. + """ + url: Optional[str] + """ + The URL you must redirect your customer to in order to authenticate the payment. + """ + + class BoletoDisplayDetails(StripeObject): + expires_at: Optional[int] + """ + The timestamp after which the boleto expires. + """ + hosted_voucher_url: Optional[str] + """ + The URL to the hosted boleto voucher page, which allows customers to view the boleto voucher. + """ + number: Optional[str] + """ + The boleto number. + """ + pdf: Optional[str] + """ + The URL to the downloadable boleto voucher PDF. + """ + + class CardAwaitNotification(StripeObject): + charge_attempt_at: Optional[int] + """ + The time that payment will be attempted. If customer approval is required, they need to provide approval before this time. + """ + customer_approval_required: Optional[bool] + """ + For payments greater than INR 15000, the customer must provide explicit approval of the payment with their bank. For payments of lower amount, no customer action is required. + """ + + class CashappHandleRedirectOrDisplayQrCode(StripeObject): + class QrCode(StripeObject): + expires_at: int + """ + The date (unix timestamp) when the QR code expires. + """ + image_url_png: str + """ + The image_url_png string used to render QR code + """ + image_url_svg: str + """ + The image_url_svg string used to render QR code + """ + + hosted_instructions_url: str + """ + The URL to the hosted Cash App Pay instructions page, which allows customers to view the QR code, and supports QR code refreshing on expiration. + """ + mobile_auth_url: str + """ + The url for mobile redirect based auth + """ + qr_code: QrCode + _inner_class_types = {"qr_code": QrCode} + + class DisplayBankTransferInstructions(StripeObject): + class FinancialAddress(StripeObject): + class Iban(StripeObject): + account_holder_name: str + """ + The name of the person or business that owns the bank account + """ + bic: str + """ + The BIC/SWIFT code of the account. + """ + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + iban: str + """ + The IBAN of the account. + """ + + class SortCode(StripeObject): + account_holder_name: str + """ + The name of the person or business that owns the bank account + """ + account_number: str + """ + The account number + """ + sort_code: str + """ + The six-digit sort code + """ + + class Spei(StripeObject): + bank_code: str + """ + The three-digit bank code + """ + bank_name: str + """ + The short banking institution name + """ + clabe: str + """ + The CLABE number + """ + + class Zengin(StripeObject): + account_holder_name: Optional[str] + """ + The account holder name + """ + account_number: Optional[str] + """ + The account number + """ + account_type: Optional[str] + """ + The bank account type. In Japan, this can only be `futsu` or `toza`. + """ + bank_code: Optional[str] + """ + The bank code of the account + """ + bank_name: Optional[str] + """ + The bank name of the account + """ + branch_code: Optional[str] + """ + The branch code of the account + """ + branch_name: Optional[str] + """ + The branch name of the account + """ + + iban: Optional[Iban] + """ + Iban Records contain E.U. bank account details per the SEPA format. + """ + sort_code: Optional[SortCode] + """ + Sort Code Records contain U.K. bank account details per the sort code format. + """ + spei: Optional[Spei] + """ + SPEI Records contain Mexico bank account details per the SPEI format. + """ + supported_networks: Optional[ + List[Literal["bacs", "fps", "sepa", "spei", "zengin"]] + ] + """ + The payment networks supported by this FinancialAddress + """ + type: Literal["iban", "sort_code", "spei", "zengin"] + """ + The type of financial address + """ + zengin: Optional[Zengin] + """ + Zengin Records contain Japan bank account details per the Zengin format. + """ + _inner_class_types = { + "iban": Iban, + "sort_code": SortCode, + "spei": Spei, + "zengin": Zengin, + } + + amount_remaining: Optional[int] + """ + The remaining amount that needs to be transferred to complete the payment. + """ + currency: Optional[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). + """ + financial_addresses: Optional[List[FinancialAddress]] + """ + A list of financial addresses that can be used to fund the customer balance + """ + hosted_instructions_url: Optional[str] + """ + A link to a hosted page that guides your customer through completing the transfer. + """ + reference: Optional[str] + """ + A string identifying this payment. Instruct your customer to include this code in the reference or memo field of their bank transfer. + """ + type: Literal[ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ] + """ + Type of bank transfer + """ + _inner_class_types = {"financial_addresses": FinancialAddress} + + class KonbiniDisplayDetails(StripeObject): + class Stores(StripeObject): + class Familymart(StripeObject): + confirmation_number: Optional[str] + """ + The confirmation number. + """ + payment_code: str + """ + The payment code. + """ + + class Lawson(StripeObject): + confirmation_number: Optional[str] + """ + The confirmation number. + """ + payment_code: str + """ + The payment code. + """ + + class Ministop(StripeObject): + confirmation_number: Optional[str] + """ + The confirmation number. + """ + payment_code: str + """ + The payment code. + """ + + class Seicomart(StripeObject): + confirmation_number: Optional[str] + """ + The confirmation number. + """ + payment_code: str + """ + The payment code. + """ + + familymart: Optional[Familymart] + """ + FamilyMart instruction details. + """ + lawson: Optional[Lawson] + """ + Lawson instruction details. + """ + ministop: Optional[Ministop] + """ + Ministop instruction details. + """ + seicomart: Optional[Seicomart] + """ + Seicomart instruction details. + """ + _inner_class_types = { + "familymart": Familymart, + "lawson": Lawson, + "ministop": Ministop, + "seicomart": Seicomart, + } + + expires_at: int + """ + The timestamp at which the pending Konbini payment expires. + """ + hosted_voucher_url: Optional[str] + """ + The URL for the Konbini payment instructions page, which allows customers to view and print a Konbini voucher. + """ + stores: Stores + _inner_class_types = {"stores": Stores} + + class OxxoDisplayDetails(StripeObject): + expires_after: Optional[int] + """ + The timestamp after which the OXXO voucher expires. + """ + hosted_voucher_url: Optional[str] + """ + The URL for the hosted OXXO voucher page, which allows customers to view and print an OXXO voucher. + """ + number: Optional[str] + """ + OXXO reference number. + """ + + class PaynowDisplayQrCode(StripeObject): + data: str + """ + The raw data string used to generate QR code, it should be used together with QR code library. + """ + hosted_instructions_url: Optional[str] + """ + The URL to the hosted PayNow instructions page, which allows customers to view the PayNow QR code. + """ + image_url_png: str + """ + The image_url_png string used to render QR code + """ + image_url_svg: str + """ + The image_url_svg string used to render QR code + """ + + class PixDisplayQrCode(StripeObject): + data: Optional[str] + """ + The raw data string used to generate QR code, it should be used together with QR code library. + """ + expires_at: Optional[int] + """ + The date (unix timestamp) when the PIX expires. + """ + hosted_instructions_url: Optional[str] + """ + The URL to the hosted pix instructions page, which allows customers to view the pix QR code. + """ + image_url_png: Optional[str] + """ + The image_url_png string used to render png QR code + """ + image_url_svg: Optional[str] + """ + The image_url_svg string used to render svg QR code + """ + + class PromptpayDisplayQrCode(StripeObject): + data: str + """ + The raw data string used to generate QR code, it should be used together with QR code library. + """ + hosted_instructions_url: str + """ + The URL to the hosted PromptPay instructions page, which allows customers to view the PromptPay QR code. + """ + image_url_png: str + """ + The PNG path used to render the QR code, can be used as the source in an HTML img tag + """ + image_url_svg: str + """ + The SVG path used to render the QR code, can be used as the source in an HTML img tag + """ + + class RedirectToUrl(StripeObject): + return_url: Optional[str] + """ + If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. + """ + url: Optional[str] + """ + The URL you must redirect your customer to in order to authenticate the payment. + """ + + class VerifyWithMicrodeposits(StripeObject): + arrival_date: int + """ + The timestamp when the microdeposits are expected to land. + """ + hosted_verification_url: str + """ + The URL for the hosted verification page, which allows customers to verify their bank account. + """ + microdeposit_type: Optional[Literal["amounts", "descriptor_code"]] + """ + The type of the microdeposit sent to the customer. Used to distinguish between different verification methods. + """ + + class WechatPayDisplayQrCode(StripeObject): + data: str + """ + The data being used to generate QR code + """ + hosted_instructions_url: str + """ + The URL to the hosted WeChat Pay instructions page, which allows customers to view the WeChat Pay QR code. + """ + image_data_url: str + """ + The base64 image data for a pre-generated QR code + """ + image_url_png: str + """ + The image_url_png string used to render QR code + """ + image_url_svg: str + """ + The image_url_svg string used to render QR code + """ + + class WechatPayRedirectToAndroidApp(StripeObject): + app_id: str + """ + app_id is the APP ID registered on WeChat open platform + """ + nonce_str: str + """ + nonce_str is a random string + """ + package: str + """ + package is static value + """ + partner_id: str + """ + an unique merchant ID assigned by WeChat Pay + """ + prepay_id: str + """ + an unique trading ID assigned by WeChat Pay + """ + sign: str + """ + A signature + """ + timestamp: str + """ + Specifies the current time in epoch format + """ + + class WechatPayRedirectToIosApp(StripeObject): + native_url: str + """ + An universal link that redirect to WeChat Pay app + """ + + alipay_handle_redirect: Optional[AlipayHandleRedirect] + boleto_display_details: Optional[BoletoDisplayDetails] + card_await_notification: Optional[CardAwaitNotification] + cashapp_handle_redirect_or_display_qr_code: Optional[ + CashappHandleRedirectOrDisplayQrCode + ] + display_bank_transfer_instructions: Optional[ + DisplayBankTransferInstructions + ] + konbini_display_details: Optional[KonbiniDisplayDetails] + oxxo_display_details: Optional[OxxoDisplayDetails] + paynow_display_qr_code: Optional[PaynowDisplayQrCode] + pix_display_qr_code: Optional[PixDisplayQrCode] + promptpay_display_qr_code: Optional[PromptpayDisplayQrCode] + redirect_to_url: Optional[RedirectToUrl] + type: str + """ + Type of the next action to perform, one of `redirect_to_url`, `use_stripe_sdk`, `alipay_handle_redirect`, `oxxo_display_details`, or `verify_with_microdeposits`. + """ + use_stripe_sdk: Optional[Dict[str, Any]] + """ + When confirming a PaymentIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js. + """ + verify_with_microdeposits: Optional[VerifyWithMicrodeposits] + wechat_pay_display_qr_code: Optional[WechatPayDisplayQrCode] + wechat_pay_redirect_to_android_app: Optional[ + WechatPayRedirectToAndroidApp + ] + wechat_pay_redirect_to_ios_app: Optional[WechatPayRedirectToIosApp] + _inner_class_types = { + "alipay_handle_redirect": AlipayHandleRedirect, + "boleto_display_details": BoletoDisplayDetails, + "card_await_notification": CardAwaitNotification, + "cashapp_handle_redirect_or_display_qr_code": CashappHandleRedirectOrDisplayQrCode, + "display_bank_transfer_instructions": DisplayBankTransferInstructions, + "konbini_display_details": KonbiniDisplayDetails, + "oxxo_display_details": OxxoDisplayDetails, + "paynow_display_qr_code": PaynowDisplayQrCode, + "pix_display_qr_code": PixDisplayQrCode, + "promptpay_display_qr_code": PromptpayDisplayQrCode, + "redirect_to_url": RedirectToUrl, + "verify_with_microdeposits": VerifyWithMicrodeposits, + "wechat_pay_display_qr_code": WechatPayDisplayQrCode, + "wechat_pay_redirect_to_android_app": WechatPayRedirectToAndroidApp, + "wechat_pay_redirect_to_ios_app": WechatPayRedirectToIosApp, + } + + class PaymentMethodConfigurationDetails(StripeObject): + id: str + """ + ID of the payment method configuration used. + """ + parent: Optional[str] + """ + ID of the parent payment method configuration used. + """ + + class PaymentMethodOptions(StripeObject): + class AcssDebit(StripeObject): + class MandateOptions(StripeObject): + custom_mandate_url: Optional[str] + """ + A URL for custom mandate text + """ + interval_description: Optional[str] + """ + Description of the interval. Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. + """ + payment_schedule: Optional[ + Literal["combined", "interval", "sporadic"] + ] + """ + Payment schedule for the mandate. + """ + transaction_type: Optional[Literal["business", "personal"]] + """ + Transaction type of the mandate. + """ + + mandate_options: Optional[MandateOptions] + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = {"mandate_options": MandateOptions} + + class Affirm(StripeObject): + capture_method: Optional[Literal["manual"]] + """ + Controls when the funds will be captured from the customer's account. + """ + preferred_locale: Optional[str] + """ + Preferred language of the Affirm authorization page that the customer is redirected to. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class AfterpayClearpay(StripeObject): + capture_method: Optional[Literal["manual"]] + """ + Controls when the funds will be captured from the customer's account. + """ + reference: Optional[str] + """ + An internal identifier or reference that this payment corresponds to. You must limit the identifier to 128 characters, and it can only contain letters, numbers, underscores, backslashes, and dashes. + This field differs from the statement descriptor and item name. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Alipay(StripeObject): + setup_future_usage: Optional[Literal["none", "off_session"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class AuBecsDebit(StripeObject): + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class BacsDebit(StripeObject): + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Bancontact(StripeObject): + preferred_language: Literal["de", "en", "fr", "nl"] + """ + Preferred language of the Bancontact authorization page that the customer is redirected to. + """ + setup_future_usage: Optional[Literal["none", "off_session"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Blik(StripeObject): + pass + + class Boleto(StripeObject): + expires_after_days: int + """ + The number of calendar days before a Boleto voucher expires. For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto voucher will expire on Wednesday at 23:59 America/Sao_Paulo time. + """ + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Card(StripeObject): + class Installments(StripeObject): + class AvailablePlan(StripeObject): + count: Optional[int] + """ + For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + """ + interval: Optional[Literal["month"]] + """ + For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + One of `month`. + """ + type: Literal["fixed_count"] + """ + Type of installment plan, one of `fixed_count`. + """ + + class Plan(StripeObject): + count: Optional[int] + """ + For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + """ + interval: Optional[Literal["month"]] + """ + For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + One of `month`. + """ + type: Literal["fixed_count"] + """ + Type of installment plan, one of `fixed_count`. + """ + + available_plans: Optional[List[AvailablePlan]] + """ + Installment plans that may be selected for this PaymentIntent. + """ + enabled: bool + """ + Whether Installments are enabled for this PaymentIntent. + """ + plan: Optional[Plan] + """ + Installment plan selected for this PaymentIntent. + """ + _inner_class_types = { + "available_plans": AvailablePlan, + "plan": Plan, + } + + class MandateOptions(StripeObject): + amount: int + """ + Amount to be charged for future payments. + """ + amount_type: Literal["fixed", "maximum"] + """ + One of `fixed` or `maximum`. If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. If `maximum`, the amount charged can be up to the value passed for the `amount` param. + """ + description: Optional[str] + """ + A description of the mandate or subscription that is meant to be displayed to the customer. + """ + end_date: Optional[int] + """ + End date of the mandate or subscription. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + interval: Literal["day", "month", "sporadic", "week", "year"] + """ + Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. + """ + interval_count: Optional[int] + """ + The number of intervals between payments. For example, `interval=month` and `interval_count=3` indicates one payment every three months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). This parameter is optional when `interval=sporadic`. + """ + reference: str + """ + Unique identifier for the mandate or subscription. + """ + start_date: int + """ + Start date of the mandate or subscription. Start date should not be lesser than yesterday. + """ + supported_types: Optional[List[Literal["india"]]] + """ + Specifies the type of mandates supported. Possible values are `india`. + """ + + capture_method: Optional[Literal["manual"]] + """ + Controls when the funds will be captured from the customer's account. + """ + installments: Optional[Installments] + """ + Installment details for this payment (Mexico only). + + For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). + """ + mandate_options: Optional[MandateOptions] + """ + Configuration options for setting up an eMandate for cards issued in India. + """ + network: Optional[ + Literal[ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "interac", + "jcb", + "mastercard", + "unionpay", + "unknown", + "visa", + ] + ] + """ + Selected network to process this payment intent on. Depends on the available networks of the card attached to the payment intent. Can be only set confirm-time. + """ + request_extended_authorization: Optional[ + Literal["if_available", "never"] + ] + """ + Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent. + """ + request_incremental_authorization: Optional[ + Literal["if_available", "never"] + ] + """ + Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. + """ + request_multicapture: Optional[Literal["if_available", "never"]] + """ + Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent. + """ + request_overcapture: Optional[Literal["if_available", "never"]] + """ + Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent. + """ + request_three_d_secure: Optional[ + Literal["any", "automatic", "challenge_only"] + ] + """ + We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: `automatic` or `any`. If not provided, defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + """ + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + statement_descriptor_suffix_kana: Optional[str] + """ + Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters. + """ + statement_descriptor_suffix_kanji: Optional[str] + """ + Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. + """ + _inner_class_types = { + "installments": Installments, + "mandate_options": MandateOptions, + } + + class CardPresent(StripeObject): + request_extended_authorization: Optional[bool] + """ + Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity) + """ + request_incremental_authorization_support: Optional[bool] + """ + Request ability to [increment](https://stripe.com/docs/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible. Check [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://stripe.com/docs/api/payment_intents/confirm) response to verify support. + """ + + class Cashapp(StripeObject): + capture_method: Optional[Literal["manual"]] + """ + Controls when the funds will be captured from the customer's account. + """ + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class CustomerBalance(StripeObject): + class BankTransfer(StripeObject): + class EuBankTransfer(StripeObject): + country: Literal["BE", "DE", "ES", "FR", "IE", "NL"] + """ + The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. + """ + + eu_bank_transfer: Optional[EuBankTransfer] + requested_address_types: Optional[ + List[ + Literal[ + "aba", + "iban", + "sepa", + "sort_code", + "spei", + "swift", + "zengin", + ] + ] + ] + """ + List of address types that should be returned in the financial_addresses response. If not specified, all valid types will be returned. + + Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. + """ + type: Optional[ + Literal[ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ] + ] + """ + The bank transfer type that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. + """ + _inner_class_types = {"eu_bank_transfer": EuBankTransfer} + + bank_transfer: Optional[BankTransfer] + funding_type: Optional[Literal["bank_transfer"]] + """ + The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + _inner_class_types = {"bank_transfer": BankTransfer} + + class Eps(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Fpx(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Giropay(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Grabpay(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Ideal(StripeObject): + setup_future_usage: Optional[Literal["none", "off_session"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class InteracPresent(StripeObject): + pass + + class Klarna(StripeObject): + capture_method: Optional[Literal["manual"]] + """ + Controls when the funds will be captured from the customer's account. + """ + preferred_locale: Optional[str] + """ + Preferred locale of the Klarna checkout page that the customer is redirected to. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Konbini(StripeObject): + confirmation_number: Optional[str] + """ + An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores. + """ + expires_after_days: Optional[int] + """ + The number of calendar days (between 1 and 60) after which Konbini payment instructions will expire. For example, if a PaymentIntent is confirmed with Konbini and `expires_after_days` set to 2 on Monday JST, the instructions will expire on Wednesday 23:59:59 JST. + """ + expires_at: Optional[int] + """ + The timestamp at which the Konbini payment instructions will expire. Only one of `expires_after_days` or `expires_at` may be set. + """ + product_description: Optional[str] + """ + A product descriptor of up to 22 characters, which will appear to customers at the convenience store. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Link(StripeObject): + capture_method: Optional[Literal["manual"]] + """ + Controls when the funds will be captured from the customer's account. + """ + persistent_token: Optional[str] + """ + [Deprecated] This is a legacy parameter that no longer has any function. + """ + setup_future_usage: Optional[Literal["none", "off_session"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Oxxo(StripeObject): + expires_after_days: int + """ + The number of calendar days before an OXXO invoice expires. For example, if you create an OXXO invoice on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class P24(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Paynow(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Paypal(StripeObject): + capture_method: Optional[Literal["manual"]] + """ + Controls when the funds will be captured from the customer's account. + """ + preferred_locale: Optional[str] + """ + Preferred locale of the PayPal checkout page that the customer is redirected to. + """ + reference: Optional[str] + """ + A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID. This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID. + """ + setup_future_usage: Optional[Literal["none", "off_session"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Pix(StripeObject): + expires_after_seconds: Optional[int] + """ + The number of seconds (between 10 and 1209600) after which Pix payment will expire. + """ + expires_at: Optional[int] + """ + The timestamp at which the Pix expires. + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Promptpay(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class SepaDebit(StripeObject): + class MandateOptions(StripeObject): + pass + + mandate_options: Optional[MandateOptions] + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + _inner_class_types = {"mandate_options": MandateOptions} + + class Sofort(StripeObject): + preferred_language: Optional[ + Literal["de", "en", "es", "fr", "it", "nl", "pl"] + ] + """ + Preferred language of the SOFORT authorization page that the customer is redirected to. + """ + setup_future_usage: Optional[Literal["none", "off_session"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class UsBankAccount(StripeObject): + class FinancialConnections(StripeObject): + permissions: Optional[ + List[ + Literal[ + "balances", + "ownership", + "payment_method", + "transactions", + ] + ] + ] + """ + The list of permissions to request. The `payment_method` permission must be included. + """ + prefetch: Optional[List[Literal["balances"]]] + """ + Data features requested to be retrieved upon account creation. + """ + return_url: Optional[str] + """ + For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. + """ + + financial_connections: Optional[FinancialConnections] + preferred_settlement_speed: Optional[ + Literal["fastest", "standard"] + ] + """ + Preferred transaction settlement speed + """ + setup_future_usage: Optional[ + Literal["none", "off_session", "on_session"] + ] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = { + "financial_connections": FinancialConnections + } + + class WechatPay(StripeObject): + app_id: Optional[str] + """ + The app ID registered with WeChat Pay. Only required when client is ios or android. + """ + client: Optional[Literal["android", "ios", "web"]] + """ + The client type that the end customer will pay from + """ + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + class Zip(StripeObject): + setup_future_usage: Optional[Literal["none"]] + """ + Indicates that you intend to make future payments with this PaymentIntent's payment method. + + Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + + When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + """ + + acss_debit: Optional[AcssDebit] + affirm: Optional[Affirm] + afterpay_clearpay: Optional[AfterpayClearpay] + alipay: Optional[Alipay] + au_becs_debit: Optional[AuBecsDebit] + bacs_debit: Optional[BacsDebit] + bancontact: Optional[Bancontact] + blik: Optional[Blik] + boleto: Optional[Boleto] + card: Optional[Card] + card_present: Optional[CardPresent] + cashapp: Optional[Cashapp] + customer_balance: Optional[CustomerBalance] + eps: Optional[Eps] + fpx: Optional[Fpx] + giropay: Optional[Giropay] + grabpay: Optional[Grabpay] + ideal: Optional[Ideal] + interac_present: Optional[InteracPresent] + klarna: Optional[Klarna] + konbini: Optional[Konbini] + link: Optional[Link] + oxxo: Optional[Oxxo] + p24: Optional[P24] + paynow: Optional[Paynow] + paypal: Optional[Paypal] + pix: Optional[Pix] + promptpay: Optional[Promptpay] + sepa_debit: Optional[SepaDebit] + sofort: Optional[Sofort] + us_bank_account: Optional[UsBankAccount] + wechat_pay: Optional[WechatPay] + zip: Optional[Zip] + _inner_class_types = { + "acss_debit": AcssDebit, + "affirm": Affirm, + "afterpay_clearpay": AfterpayClearpay, + "alipay": Alipay, + "au_becs_debit": AuBecsDebit, + "bacs_debit": BacsDebit, + "bancontact": Bancontact, + "blik": Blik, + "boleto": Boleto, + "card": Card, + "card_present": CardPresent, + "cashapp": Cashapp, + "customer_balance": CustomerBalance, + "eps": Eps, + "fpx": Fpx, + "giropay": Giropay, + "grabpay": Grabpay, + "ideal": Ideal, + "interac_present": InteracPresent, + "klarna": Klarna, + "konbini": Konbini, + "link": Link, + "oxxo": Oxxo, + "p24": P24, + "paynow": Paynow, + "paypal": Paypal, + "pix": Pix, + "promptpay": Promptpay, + "sepa_debit": SepaDebit, + "sofort": Sofort, + "us_bank_account": UsBankAccount, + "wechat_pay": WechatPay, + "zip": Zip, + } + + class Processing(StripeObject): + class Card(StripeObject): + class CustomerNotification(StripeObject): + approval_requested: Optional[bool] + """ + Whether customer approval has been requested for this payment. For payments greater than INR 15000 or mandate amount, the customer must provide explicit approval of the payment with their bank. + """ + completes_at: Optional[int] + """ + If customer approval is required, they need to provide approval before this time. + """ + + customer_notification: Optional[CustomerNotification] + _inner_class_types = { + "customer_notification": CustomerNotification + } + + card: Optional[Card] + type: Literal["card"] + """ + Type of the payment method for which payment is in `processing` state, one of `card`. + """ + _inner_class_types = {"card": Card} + + class Shipping(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + carrier: Optional[str] + """ + The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + """ + name: Optional[str] + """ + Recipient name. + """ + phone: Optional[str] + """ + Recipient phone (including extension). + """ + tracking_number: Optional[str] + """ + The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + """ + _inner_class_types = {"address": Address} + + class TransferData(StripeObject): + amount: Optional[int] + """ + Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + """ + destination: ExpandableField["Account"] + """ + The account (if any) that the payment is attributed to for tax + reporting, and where funds from the payment are transferred to after + payment success. + """ + if TYPE_CHECKING: class ApplyCustomerBalanceParams(RequestOptions): @@ -5576,7 +7213,7 @@ class SearchParams(RequestOptions): """ Amount that can be captured from this PaymentIntent. """ - amount_details: Optional[StripeObject] + amount_details: Optional[AmountDetails] amount_received: int """ Amount that this PaymentIntent collects. @@ -5589,7 +7226,7 @@ class SearchParams(RequestOptions): """ The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). """ - automatic_payment_methods: Optional[StripeObject] + automatic_payment_methods: Optional[AutomaticPaymentMethods] """ Settings to configure compatible payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods) """ @@ -5652,7 +7289,7 @@ class SearchParams(RequestOptions): """ ID of the invoice that created this PaymentIntent, if it exists. """ - last_payment_error: Optional[StripeObject] + last_payment_error: Optional[LastPaymentError] """ The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason. """ @@ -5668,7 +7305,7 @@ class SearchParams(RequestOptions): """ 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. Learn more about [storing information in metadata](https://stripe.com/docs/payments/payment-intents/creating-payment-intents#storing-information-in-metadata). """ - next_action: Optional[StripeObject] + next_action: Optional[NextAction] """ If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source. """ @@ -5684,11 +7321,13 @@ class SearchParams(RequestOptions): """ ID of the payment method used in this PaymentIntent. """ - payment_method_configuration_details: Optional[StripeObject] + payment_method_configuration_details: Optional[ + PaymentMethodConfigurationDetails + ] """ Information about the payment method configuration used for this PaymentIntent. """ - payment_method_options: Optional[StripeObject] + payment_method_options: Optional[PaymentMethodOptions] """ Payment-method-specific configuration for this PaymentIntent. """ @@ -5696,7 +7335,7 @@ class SearchParams(RequestOptions): """ The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. """ - processing: Optional[StripeObject] + processing: Optional[Processing] """ If present, this property tells you about the processing state of the payment. """ @@ -5716,12 +7355,14 @@ class SearchParams(RequestOptions): When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). """ - shipping: Optional[StripeObject] + shipping: Optional[Shipping] """ Shipping information for this PaymentIntent. """ source: Optional[ - ExpandableField[Union["Account", "BankAccount", "Card", "Source"]] + ExpandableField[ + Union["Account", "BankAccount", "CardResource", "Source"] + ] ] """ This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied. @@ -5746,7 +7387,7 @@ class SearchParams(RequestOptions): """ Status of this PaymentIntent, one of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `requires_capture`, `canceled`, or `succeeded`. Read more about each PaymentIntent [status](https://stripe.com/docs/payments/intents#intent-statuses). """ - transfer_data: Optional[StripeObject] + transfer_data: Optional[TransferData] """ The data that automatically creates a Transfer after the payment finalizes. Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). """ @@ -6199,3 +7840,15 @@ def search_auto_paging_iter( cls, *args, **kwargs: Unpack["PaymentIntent.SearchParams"] ) -> Iterator["PaymentIntent"]: return cls.search(*args, **kwargs).auto_paging_iter() + + _inner_class_types = { + "amount_details": AmountDetails, + "automatic_payment_methods": AutomaticPaymentMethods, + "last_payment_error": LastPaymentError, + "next_action": NextAction, + "payment_method_configuration_details": PaymentMethodConfigurationDetails, + "payment_method_options": PaymentMethodOptions, + "processing": Processing, + "shipping": Shipping, + "transfer_data": TransferData, + } diff --git a/stripe/api_resources/payment_link.py b/stripe/api_resources/payment_link.py index 840f6c84d..9c876b92d 100644 --- a/stripe/api_resources/payment_link.py +++ b/stripe/api_resources/payment_link.py @@ -25,6 +25,8 @@ from stripe.api_resources.account import Account from stripe.api_resources.application import Application from stripe.api_resources.line_item import LineItem + from stripe.api_resources.shipping_rate import ShippingRate + from stripe.api_resources.tax_id import TaxId class PaymentLink( @@ -41,6 +43,528 @@ class PaymentLink( """ OBJECT_NAME: ClassVar[Literal["payment_link"]] = "payment_link" + + class AfterCompletion(StripeObject): + class HostedConfirmation(StripeObject): + custom_message: Optional[str] + """ + The custom message that is displayed to the customer after the purchase is complete. + """ + + class Redirect(StripeObject): + url: str + """ + The URL the customer will be redirected to after the purchase is complete. + """ + + hosted_confirmation: Optional[HostedConfirmation] + redirect: Optional[Redirect] + type: Literal["hosted_confirmation", "redirect"] + """ + The specified behavior after the purchase is complete. + """ + _inner_class_types = { + "hosted_confirmation": HostedConfirmation, + "redirect": Redirect, + } + + class AutomaticTax(StripeObject): + enabled: bool + """ + If `true`, tax will be calculated automatically using the customer's location. + """ + + class ConsentCollection(StripeObject): + promotions: Optional[Literal["auto", "none"]] + """ + If set to `auto`, enables the collection of customer consent for promotional communications. + """ + terms_of_service: Optional[Literal["none", "required"]] + """ + If set to `required`, it requires cutomers to accept the terms of service before being able to pay. If set to `none`, customers won't be shown a checkbox to accept the terms of service. + """ + + class CustomField(StripeObject): + class Dropdown(StripeObject): + class Option(StripeObject): + label: str + """ + The label for the option, displayed to the customer. Up to 100 characters. + """ + value: str + """ + The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters. + """ + + options: List[Option] + """ + The options available for the customer to select. Up to 200 options allowed. + """ + _inner_class_types = {"options": Option} + + class Label(StripeObject): + custom: Optional[str] + """ + Custom text for the label, displayed to the customer. Up to 50 characters. + """ + type: Literal["custom"] + """ + The type of the label. + """ + + class Numeric(StripeObject): + maximum_length: Optional[int] + """ + The maximum character length constraint for the customer's input. + """ + minimum_length: Optional[int] + """ + The minimum character length requirement for the customer's input. + """ + + class Text(StripeObject): + maximum_length: Optional[int] + """ + The maximum character length constraint for the customer's input. + """ + minimum_length: Optional[int] + """ + The minimum character length requirement for the customer's input. + """ + + dropdown: Optional[Dropdown] + key: str + """ + String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters. + """ + label: Label + numeric: Optional[Numeric] + optional: bool + """ + Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`. + """ + text: Optional[Text] + type: Literal["dropdown", "numeric", "text"] + """ + The type of the field. + """ + _inner_class_types = { + "dropdown": Dropdown, + "label": Label, + "numeric": Numeric, + "text": Text, + } + + class CustomText(StripeObject): + class ShippingAddress(StripeObject): + message: str + """ + Text may be up to 1200 characters in length. + """ + + class Submit(StripeObject): + message: str + """ + Text may be up to 1200 characters in length. + """ + + class TermsOfServiceAcceptance(StripeObject): + message: str + """ + Text may be up to 1200 characters in length. + """ + + shipping_address: Optional[ShippingAddress] + """ + Custom text that should be displayed alongside shipping address collection. + """ + submit: Optional[Submit] + """ + Custom text that should be displayed alongside the payment confirmation button. + """ + terms_of_service_acceptance: Optional[TermsOfServiceAcceptance] + """ + Custom text that should be displayed in place of the default terms of service agreement text. + """ + _inner_class_types = { + "shipping_address": ShippingAddress, + "submit": Submit, + "terms_of_service_acceptance": TermsOfServiceAcceptance, + } + + class InvoiceCreation(StripeObject): + class InvoiceData(StripeObject): + class CustomField(StripeObject): + name: str + """ + The name of the custom field. + """ + value: str + """ + The value of the custom field. + """ + + class RenderingOptions(StripeObject): + amount_tax_display: Optional[str] + """ + How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + """ + + account_tax_ids: Optional[List[ExpandableField["TaxId"]]] + """ + The account tax IDs associated with the invoice. + """ + custom_fields: Optional[List[CustomField]] + """ + A list of up to 4 custom fields to be displayed on the invoice. + """ + description: Optional[str] + """ + An arbitrary string attached to the object. Often useful for displaying to users. + """ + footer: Optional[str] + """ + Footer to be displayed on the invoice. + """ + metadata: Optional[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. + """ + rendering_options: Optional[RenderingOptions] + """ + Options for invoice PDF rendering. + """ + _inner_class_types = { + "custom_fields": CustomField, + "rendering_options": RenderingOptions, + } + + enabled: bool + """ + Enable creating an invoice on successful payment. + """ + invoice_data: Optional[InvoiceData] + """ + Configuration for the invoice. Default invoice values will be used if unspecified. + """ + _inner_class_types = {"invoice_data": InvoiceData} + + class PaymentIntentData(StripeObject): + capture_method: Optional[ + Literal["automatic", "automatic_async", "manual"] + ] + """ + Indicates when the funds will be captured from the customer's account. + """ + metadata: Dict[str, str] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on [Payment Intents](https://stripe.com/docs/api/payment_intents) generated from this payment link. + """ + setup_future_usage: Optional[Literal["off_session", "on_session"]] + """ + Indicates that you intend to make future payments with the payment method collected during checkout. + """ + statement_descriptor: Optional[str] + """ + Extra information about the payment. This will appear on your customer's statement when this payment succeeds in creating a charge. + """ + statement_descriptor_suffix: Optional[str] + """ + Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + """ + + class PhoneNumberCollection(StripeObject): + enabled: bool + """ + If `true`, a phone number will be collected during checkout. + """ + + class ShippingAddressCollection(StripeObject): + allowed_countries: List[ + Literal[ + "AC", + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MK", + "ML", + "MM", + "MN", + "MO", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TA", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + "ZZ", + ] + ] + """ + An array of two-letter ISO country codes representing which countries Checkout should provide as options for shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. + """ + + class ShippingOption(StripeObject): + shipping_amount: int + """ + A non-negative integer in cents representing how much to charge. + """ + shipping_rate: ExpandableField["ShippingRate"] + """ + The ID of the Shipping Rate to use for this shipping option. + """ + + class SubscriptionData(StripeObject): + description: Optional[str] + """ + The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription. + """ + metadata: Dict[str, str] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on [Subscriptions](https://stripe.com/docs/api/subscriptions) generated from this payment link. + """ + trial_period_days: Optional[int] + """ + Integer representing the number of trial period days before the customer is charged for the first time. + """ + + class TaxIdCollection(StripeObject): + enabled: bool + """ + Indicates whether tax ID collection is enabled for the session. + """ + + class TransferData(StripeObject): + amount: Optional[int] + """ + The amount in cents (or local equivalent) that will be transferred to the destination account. By default, the entire amount is transferred to the destination. + """ + destination: ExpandableField["Account"] + """ + The connected account receiving the transfer. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -1437,7 +1961,7 @@ class RetrieveParams(RequestOptions): """ Whether the payment link's `url` is active. If `false`, customers visiting the URL will be shown a page saying that the link has been deactivated. """ - after_completion: StripeObject + after_completion: AfterCompletion allow_promotion_codes: bool """ Whether user redeemable promotion codes are enabled. @@ -1454,12 +1978,12 @@ class RetrieveParams(RequestOptions): """ This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. """ - automatic_tax: StripeObject + automatic_tax: AutomaticTax billing_address_collection: Literal["auto", "required"] """ Configuration for collecting the customer's billing address. """ - consent_collection: Optional[StripeObject] + consent_collection: Optional[ConsentCollection] """ When set, provides configuration to gather active consent from customers. """ @@ -1467,11 +1991,11 @@ class RetrieveParams(RequestOptions): """ 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). """ - custom_fields: List[StripeObject] + custom_fields: List[CustomField] """ Collect additional information from your customer using custom fields. Up to 2 fields are supported. """ - custom_text: StripeObject + custom_text: CustomText customer_creation: Literal["always", "if_required"] """ Configuration for Customer creation during checkout. @@ -1480,7 +2004,7 @@ class RetrieveParams(RequestOptions): """ Unique identifier for the object. """ - invoice_creation: Optional[StripeObject] + invoice_creation: Optional[InvoiceCreation] """ Configuration for creating invoice for payment mode payment links. """ @@ -1504,7 +2028,7 @@ class RetrieveParams(RequestOptions): """ The account on behalf of which to charge. See the [Connect documentation](https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details. """ - payment_intent_data: Optional[StripeObject] + payment_intent_data: Optional[PaymentIntentData] """ Indicates the parameters to be passed to PaymentIntent creation during checkout. """ @@ -1549,12 +2073,12 @@ class RetrieveParams(RequestOptions): """ The list of payment method types that customers can use. When `null`, Stripe will dynamically show relevant payment methods you've enabled in your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). """ - phone_number_collection: StripeObject - shipping_address_collection: Optional[StripeObject] + phone_number_collection: PhoneNumberCollection + shipping_address_collection: Optional[ShippingAddressCollection] """ Configuration for collecting the customer's shipping address. """ - shipping_options: List[StripeObject] + shipping_options: List[ShippingOption] """ The shipping rate options applied to the session. """ @@ -1562,12 +2086,12 @@ class RetrieveParams(RequestOptions): """ Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button. """ - subscription_data: Optional[StripeObject] + subscription_data: Optional[SubscriptionData] """ When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`. """ - tax_id_collection: StripeObject - transfer_data: Optional[StripeObject] + tax_id_collection: TaxIdCollection + transfer_data: Optional[TransferData] """ The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to. """ @@ -1701,3 +2225,19 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "after_completion": AfterCompletion, + "automatic_tax": AutomaticTax, + "consent_collection": ConsentCollection, + "custom_fields": CustomField, + "custom_text": CustomText, + "invoice_creation": InvoiceCreation, + "payment_intent_data": PaymentIntentData, + "phone_number_collection": PhoneNumberCollection, + "shipping_address_collection": ShippingAddressCollection, + "shipping_options": ShippingOption, + "subscription_data": SubscriptionData, + "tax_id_collection": TaxIdCollection, + "transfer_data": TransferData, + } diff --git a/stripe/api_resources/payment_method.py b/stripe/api_resources/payment_method.py index b5c3fee34..35ec7aab1 100644 --- a/stripe/api_resources/payment_method.py +++ b/stripe/api_resources/payment_method.py @@ -22,7 +22,9 @@ from urllib.parse import quote_plus if TYPE_CHECKING: + from stripe.api_resources.charge import Charge from stripe.api_resources.customer import Customer + from stripe.api_resources.setup_attempt import SetupAttempt class PaymentMethod( @@ -39,6 +41,942 @@ class PaymentMethod( """ OBJECT_NAME: ClassVar[Literal["payment_method"]] = "payment_method" + + class AcssDebit(StripeObject): + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + institution_number: Optional[str] + """ + Institution number of the bank account. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + transit_number: Optional[str] + """ + Transit number of the bank account. + """ + + class Affirm(StripeObject): + pass + + class AfterpayClearpay(StripeObject): + pass + + class Alipay(StripeObject): + pass + + class AuBecsDebit(StripeObject): + bsb_number: Optional[str] + """ + Six-digit number identifying bank and branch associated with this bank account. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + + class BacsDebit(StripeObject): + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + sort_code: Optional[str] + """ + Sort code of the bank account. (e.g., `10-20-30`) + """ + + class Bancontact(StripeObject): + pass + + class BillingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + """ + Billing address. + """ + email: Optional[str] + """ + Email address. + """ + name: Optional[str] + """ + Full name. + """ + phone: Optional[str] + """ + Billing phone number (including extension). + """ + _inner_class_types = {"address": Address} + + class Blik(StripeObject): + pass + + class Boleto(StripeObject): + tax_id: str + """ + Uniquely identifies the customer tax id (CNPJ or CPF) + """ + + class Card(StripeObject): + class Checks(StripeObject): + address_line1_check: Optional[str] + """ + If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + address_postal_code_check: Optional[str] + """ + If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + cvc_check: Optional[str] + """ + If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + + class Networks(StripeObject): + available: List[str] + """ + All available networks for the card. + """ + preferred: Optional[str] + """ + The preferred network for the card. + """ + + class ThreeDSecureUsage(StripeObject): + supported: bool + """ + Whether 3D Secure is supported on this card. + """ + + class Wallet(StripeObject): + class AmexExpressCheckout(StripeObject): + pass + + class ApplePay(StripeObject): + pass + + class GooglePay(StripeObject): + pass + + class Link(StripeObject): + pass + + class Masterpass(StripeObject): + class BillingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class ShippingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + billing_address: Optional[BillingAddress] + """ + Owner's verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + email: Optional[str] + """ + Owner's verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + shipping_address: Optional[ShippingAddress] + """ + Owner's verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + _inner_class_types = { + "billing_address": BillingAddress, + "shipping_address": ShippingAddress, + } + + class SamsungPay(StripeObject): + pass + + class VisaCheckout(StripeObject): + class BillingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class ShippingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + billing_address: Optional[BillingAddress] + """ + Owner's verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + email: Optional[str] + """ + Owner's verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + shipping_address: Optional[ShippingAddress] + """ + Owner's verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + _inner_class_types = { + "billing_address": BillingAddress, + "shipping_address": ShippingAddress, + } + + amex_express_checkout: Optional[AmexExpressCheckout] + apple_pay: Optional[ApplePay] + dynamic_last4: Optional[str] + """ + (For tokenized numbers only.) The last four digits of the device account number. + """ + google_pay: Optional[GooglePay] + link: Optional[Link] + masterpass: Optional[Masterpass] + samsung_pay: Optional[SamsungPay] + type: Literal[ + "amex_express_checkout", + "apple_pay", + "google_pay", + "link", + "masterpass", + "samsung_pay", + "visa_checkout", + ] + """ + The type of the card wallet, one of `amex_express_checkout`, `apple_pay`, `google_pay`, `masterpass`, `samsung_pay`, `visa_checkout`, or `link`. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type. + """ + visa_checkout: Optional[VisaCheckout] + _inner_class_types = { + "amex_express_checkout": AmexExpressCheckout, + "apple_pay": ApplePay, + "google_pay": GooglePay, + "link": Link, + "masterpass": Masterpass, + "samsung_pay": SamsungPay, + "visa_checkout": VisaCheckout, + } + + brand: str + """ + Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + checks: Optional[Checks] + """ + Checks on Card address and CVC if provided. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + """ + description: Optional[str] + """ + A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.) + """ + exp_month: int + """ + Two-digit number representing the card's expiration month. + """ + exp_year: int + """ + Four-digit number representing the card's expiration year. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + + *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* + """ + funding: str + """ + Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + """ + iin: Optional[str] + """ + Issuer identification number of the card. (For internal use only and not typically available in standard API requests.) + """ + issuer: Optional[str] + """ + The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.) + """ + last4: str + """ + The last four digits of the card. + """ + networks: Optional[Networks] + """ + Contains information about card networks that can be used to process the payment. + """ + three_d_secure_usage: Optional[ThreeDSecureUsage] + """ + Contains details on how this Card may be used for 3D Secure authentication. + """ + wallet: Optional[Wallet] + """ + If this Card is part of a card wallet, this contains the details of the card wallet. + """ + _inner_class_types = { + "checks": Checks, + "networks": Networks, + "three_d_secure_usage": ThreeDSecureUsage, + "wallet": Wallet, + } + + class CardPresent(StripeObject): + class Networks(StripeObject): + available: List[str] + """ + All available networks for the card. + """ + preferred: Optional[str] + """ + The preferred network for the card. + """ + + brand: Optional[str] + """ + Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + cardholder_name: Optional[str] + """ + The cardholder name as read from the card, in [ISO 7813](https://en.wikipedia.org/wiki/ISO/IEC_7813) format. May include alphanumeric characters, special characters and first/last name separator (`/`). In some cases, the cardholder name may not be available depending on how the issuer has configured the card. Cardholder name is typically not available on swipe or contactless payments, such as those made with Apple Pay and Google Pay. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + """ + description: Optional[str] + """ + A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.) + """ + exp_month: int + """ + Two-digit number representing the card's expiration month. + """ + exp_year: int + """ + Four-digit number representing the card's expiration year. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + + *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* + """ + funding: Optional[str] + """ + Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + """ + iin: Optional[str] + """ + Issuer identification number of the card. (For internal use only and not typically available in standard API requests.) + """ + issuer: Optional[str] + """ + The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.) + """ + last4: Optional[str] + """ + The last four digits of the card. + """ + networks: Optional[Networks] + """ + Contains information about card networks that can be used to process the payment. + """ + read_method: Optional[ + Literal[ + "contact_emv", + "contactless_emv", + "contactless_magstripe_mode", + "magnetic_stripe_fallback", + "magnetic_stripe_track2", + ] + ] + """ + How card details were read in this transaction. + """ + _inner_class_types = {"networks": Networks} + + class Cashapp(StripeObject): + buyer_id: Optional[str] + """ + A unique and immutable identifier assigned by Cash App to every buyer. + """ + cashtag: Optional[str] + """ + A public identifier for buyers using Cash App. + """ + + class CustomerBalance(StripeObject): + pass + + class Eps(StripeObject): + bank: Optional[ + Literal[ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ] + ] + """ + The customer's bank. Should be one of `arzte_und_apotheker_bank`, `austrian_anadi_bank_ag`, `bank_austria`, `bankhaus_carl_spangler`, `bankhaus_schelhammer_und_schattera_ag`, `bawag_psk_ag`, `bks_bank_ag`, `brull_kallmus_bank_ag`, `btv_vier_lander_bank`, `capital_bank_grawe_gruppe_ag`, `deutsche_bank_ag`, `dolomitenbank`, `easybank_ag`, `erste_bank_und_sparkassen`, `hypo_alpeadriabank_international_ag`, `hypo_noe_lb_fur_niederosterreich_u_wien`, `hypo_oberosterreich_salzburg_steiermark`, `hypo_tirol_bank_ag`, `hypo_vorarlberg_bank_ag`, `hypo_bank_burgenland_aktiengesellschaft`, `marchfelder_bank`, `oberbank_ag`, `raiffeisen_bankengruppe_osterreich`, `schoellerbank_ag`, `sparda_bank_wien`, `volksbank_gruppe`, `volkskreditbank_ag`, or `vr_bank_braunau`. + """ + + class Fpx(StripeObject): + account_holder_type: Optional[Literal["company", "individual"]] + """ + Account holder type, if provided. Can be one of `individual` or `company`. + """ + bank: Literal[ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ] + """ + The customer's bank, if provided. Can be one of `affin_bank`, `agrobank`, `alliance_bank`, `ambank`, `bank_islam`, `bank_muamalat`, `bank_rakyat`, `bsn`, `cimb`, `hong_leong_bank`, `hsbc`, `kfh`, `maybank2u`, `ocbc`, `public_bank`, `rhb`, `standard_chartered`, `uob`, `deutsche_bank`, `maybank2e`, `pb_enterprise`, or `bank_of_china`. + """ + + class Giropay(StripeObject): + pass + + class Grabpay(StripeObject): + pass + + class Ideal(StripeObject): + bank: Optional[ + Literal[ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ] + ] + """ + The customer's bank, if provided. Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. + """ + bic: Optional[ + Literal[ + "ABNANL2A", + "ASNBNL21", + "BITSNL2A", + "BUNQNL2A", + "FVLBNL22", + "HANDNL2A", + "INGBNL2A", + "KNABNL2H", + "MOYONL21", + "NTSBDEB1", + "RABONL2U", + "RBRBNL21", + "REVOIE23", + "REVOLT21", + "SNSBNL2A", + "TRIONL2U", + ] + ] + """ + The Bank Identifier Code of the customer's bank, if the bank was provided. + """ + + class InteracPresent(StripeObject): + class Networks(StripeObject): + available: List[str] + """ + All available networks for the card. + """ + preferred: Optional[str] + """ + The preferred network for the card. + """ + + brand: Optional[str] + """ + Card brand. Can be `interac`, `mastercard` or `visa`. + """ + cardholder_name: Optional[str] + """ + The cardholder name as read from the card, in [ISO 7813](https://en.wikipedia.org/wiki/ISO/IEC_7813) format. May include alphanumeric characters, special characters and first/last name separator (`/`). In some cases, the cardholder name may not be available depending on how the issuer has configured the card. Cardholder name is typically not available on swipe or contactless payments, such as those made with Apple Pay and Google Pay. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + """ + description: Optional[str] + """ + A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.) + """ + exp_month: int + """ + Two-digit number representing the card's expiration month. + """ + exp_year: int + """ + Four-digit number representing the card's expiration year. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + + *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* + """ + funding: Optional[str] + """ + Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + """ + iin: Optional[str] + """ + Issuer identification number of the card. (For internal use only and not typically available in standard API requests.) + """ + issuer: Optional[str] + """ + The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.) + """ + last4: Optional[str] + """ + The last four digits of the card. + """ + networks: Optional[Networks] + """ + Contains information about card networks that can be used to process the payment. + """ + preferred_locales: Optional[List[str]] + """ + EMV tag 5F2D. Preferred languages specified by the integrated circuit chip. + """ + read_method: Optional[ + Literal[ + "contact_emv", + "contactless_emv", + "contactless_magstripe_mode", + "magnetic_stripe_fallback", + "magnetic_stripe_track2", + ] + ] + """ + How card details were read in this transaction. + """ + _inner_class_types = {"networks": Networks} + + class Klarna(StripeObject): + class Dob(StripeObject): + day: Optional[int] + """ + The day of birth, between 1 and 31. + """ + month: Optional[int] + """ + The month of birth, between 1 and 12. + """ + year: Optional[int] + """ + The four-digit year of birth. + """ + + dob: Optional[Dob] + """ + The customer's date of birth, if provided. + """ + _inner_class_types = {"dob": Dob} + + class Konbini(StripeObject): + pass + + class Link(StripeObject): + email: Optional[str] + """ + Account owner's email address. + """ + persistent_token: Optional[str] + """ + [Deprecated] This is a legacy parameter that no longer has any function. + """ + + class Oxxo(StripeObject): + pass + + class P24(StripeObject): + bank: Optional[ + Literal[ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "volkswagen_bank", + ] + ] + """ + The customer's bank, if provided. + """ + + class Paynow(StripeObject): + pass + + class Paypal(StripeObject): + payer_email: Optional[str] + """ + Owner's email. Values are provided by PayPal directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + payer_id: Optional[str] + """ + PayPal account PayerID. This identifier uniquely identifies the PayPal customer. + """ + + class Pix(StripeObject): + pass + + class Promptpay(StripeObject): + pass + + class RadarOptions(StripeObject): + session: Optional[str] + """ + A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. + """ + + class SepaDebit(StripeObject): + class GeneratedFrom(StripeObject): + charge: Optional[ExpandableField["Charge"]] + """ + The ID of the Charge that generated this PaymentMethod, if any. + """ + setup_attempt: Optional[ExpandableField["SetupAttempt"]] + """ + The ID of the SetupAttempt that generated this PaymentMethod, if any. + """ + + bank_code: Optional[str] + """ + Bank code of bank associated with the bank account. + """ + branch_code: Optional[str] + """ + Branch code of bank associated with the bank account. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country the bank account is located in. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + generated_from: Optional[GeneratedFrom] + """ + Information about the object that generated this PaymentMethod. + """ + last4: Optional[str] + """ + Last four characters of the IBAN. + """ + _inner_class_types = {"generated_from": GeneratedFrom} + + class Sofort(StripeObject): + country: Optional[str] + """ + Two-letter ISO code representing the country the bank account is located in. + """ + + class UsBankAccount(StripeObject): + class Networks(StripeObject): + preferred: Optional[str] + """ + The preferred network. + """ + supported: List[Literal["ach", "us_domestic_wire"]] + """ + All supported networks. + """ + + class StatusDetails(StripeObject): + class Blocked(StripeObject): + network_code: Optional[ + Literal[ + "R02", + "R03", + "R04", + "R05", + "R07", + "R08", + "R10", + "R11", + "R16", + "R20", + "R29", + "R31", + ] + ] + """ + The ACH network code that resulted in this block. + """ + reason: Optional[ + Literal[ + "bank_account_closed", + "bank_account_frozen", + "bank_account_invalid_details", + "bank_account_restricted", + "bank_account_unusable", + "debit_not_authorized", + ] + ] + """ + The reason why this PaymentMethod's fingerprint has been blocked + """ + + blocked: Optional[Blocked] + _inner_class_types = {"blocked": Blocked} + + account_holder_type: Optional[Literal["company", "individual"]] + """ + Account holder type: individual or company. + """ + account_type: Optional[Literal["checking", "savings"]] + """ + Account type: checkings or savings. Defaults to checking if omitted. + """ + bank_name: Optional[str] + """ + The name of the bank. + """ + financial_connections_account: Optional[str] + """ + The ID of the Financial Connections Account used to create the payment method. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + networks: Optional[Networks] + """ + Contains information about US bank account networks that can be used. + """ + routing_number: Optional[str] + """ + Routing number of the bank account. + """ + status_details: Optional[StatusDetails] + """ + Contains information about the future reusability of this PaymentMethod. + """ + _inner_class_types = { + "networks": Networks, + "status_details": StatusDetails, + } + + class WechatPay(StripeObject): + pass + + class Zip(StripeObject): + pass + if TYPE_CHECKING: class AttachParams(RequestOptions): @@ -654,19 +1592,19 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - acss_debit: Optional[StripeObject] - affirm: Optional[StripeObject] - afterpay_clearpay: Optional[StripeObject] - alipay: Optional[StripeObject] - au_becs_debit: Optional[StripeObject] - bacs_debit: Optional[StripeObject] - bancontact: Optional[StripeObject] - billing_details: StripeObject - blik: Optional[StripeObject] - boleto: Optional[StripeObject] - card: Optional[StripeObject] - card_present: Optional[StripeObject] - cashapp: Optional[StripeObject] + acss_debit: Optional[AcssDebit] + affirm: Optional[Affirm] + afterpay_clearpay: Optional[AfterpayClearpay] + alipay: Optional[Alipay] + au_becs_debit: Optional[AuBecsDebit] + bacs_debit: Optional[BacsDebit] + bancontact: Optional[Bancontact] + billing_details: BillingDetails + blik: Optional[Blik] + boleto: Optional[Boleto] + card: Optional[Card] + card_present: Optional[CardPresent] + cashapp: Optional[Cashapp] created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -675,20 +1613,20 @@ class RetrieveParams(RequestOptions): """ The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer. """ - customer_balance: Optional[StripeObject] - eps: Optional[StripeObject] - fpx: Optional[StripeObject] - giropay: Optional[StripeObject] - grabpay: Optional[StripeObject] + customer_balance: Optional[CustomerBalance] + eps: Optional[Eps] + fpx: Optional[Fpx] + giropay: Optional[Giropay] + grabpay: Optional[Grabpay] id: str """ Unique identifier for the object. """ - ideal: Optional[StripeObject] - interac_present: Optional[StripeObject] - klarna: Optional[StripeObject] - konbini: Optional[StripeObject] - link: Optional[StripeObject] + ideal: Optional[Ideal] + interac_present: Optional[InteracPresent] + klarna: Optional[Klarna] + konbini: Optional[Konbini] + link: Optional[Link] livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -701,18 +1639,18 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - oxxo: Optional[StripeObject] - p24: Optional[StripeObject] - paynow: Optional[StripeObject] - paypal: Optional[StripeObject] - pix: Optional[StripeObject] - promptpay: Optional[StripeObject] - radar_options: Optional[StripeObject] + oxxo: Optional[Oxxo] + p24: Optional[P24] + paynow: Optional[Paynow] + paypal: Optional[Paypal] + pix: Optional[Pix] + promptpay: Optional[Promptpay] + radar_options: Optional[RadarOptions] """ Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. """ - sepa_debit: Optional[StripeObject] - sofort: Optional[StripeObject] + sepa_debit: Optional[SepaDebit] + sofort: Optional[Sofort] type: Literal[ "acss_debit", "affirm", @@ -751,9 +1689,9 @@ class RetrieveParams(RequestOptions): """ The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. """ - us_bank_account: Optional[StripeObject] - wechat_pay: Optional[StripeObject] - zip: Optional[StripeObject] + us_bank_account: Optional[UsBankAccount] + wechat_pay: Optional[WechatPay] + zip: Optional[Zip] @classmethod def _cls_attach( @@ -941,3 +1879,41 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "acss_debit": AcssDebit, + "affirm": Affirm, + "afterpay_clearpay": AfterpayClearpay, + "alipay": Alipay, + "au_becs_debit": AuBecsDebit, + "bacs_debit": BacsDebit, + "bancontact": Bancontact, + "billing_details": BillingDetails, + "blik": Blik, + "boleto": Boleto, + "card": Card, + "card_present": CardPresent, + "cashapp": Cashapp, + "customer_balance": CustomerBalance, + "eps": Eps, + "fpx": Fpx, + "giropay": Giropay, + "grabpay": Grabpay, + "ideal": Ideal, + "interac_present": InteracPresent, + "klarna": Klarna, + "konbini": Konbini, + "link": Link, + "oxxo": Oxxo, + "p24": P24, + "paynow": Paynow, + "paypal": Paypal, + "pix": Pix, + "promptpay": Promptpay, + "radar_options": RadarOptions, + "sepa_debit": SepaDebit, + "sofort": Sofort, + "us_bank_account": UsBankAccount, + "wechat_pay": WechatPay, + "zip": Zip, + } diff --git a/stripe/api_resources/payment_method_configuration.py b/stripe/api_resources/payment_method_configuration.py index 86f2e7512..8063548f7 100644 --- a/stripe/api_resources/payment_method_configuration.py +++ b/stripe/api_resources/payment_method_configuration.py @@ -44,6 +44,821 @@ class PaymentMethodConfiguration( OBJECT_NAME: ClassVar[ Literal["payment_method_configuration"] ] = "payment_method_configuration" + + class AcssDebit(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Affirm(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class AfterpayClearpay(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Alipay(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class ApplePay(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class AuBecsDebit(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class BacsDebit(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Bancontact(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Blik(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Boleto(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Card(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class CartesBancaires(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Cashapp(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Eps(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Fpx(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Giropay(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class GooglePay(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Grabpay(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class IdBankTransfer(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Ideal(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Jcb(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Klarna(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Konbini(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Link(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Multibanco(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Netbanking(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Oxxo(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class P24(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class PayByBank(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Paynow(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Paypal(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Promptpay(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class SepaDebit(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Sofort(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class Upi(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class UsBankAccount(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + + class WechatPay(StripeObject): + class DisplayPreference(StripeObject): + overridable: Optional[bool] + """ + For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + """ + preference: Literal["none", "off", "on"] + """ + The account's display preference. + """ + value: Literal["off", "on"] + """ + The effective display preference value. + """ + + available: bool + """ + Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + """ + display_preference: DisplayPreference + _inner_class_types = {"display_preference": DisplayPreference} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -1394,75 +2209,75 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - acss_debit: Optional[StripeObject] + acss_debit: Optional[AcssDebit] active: bool """ Whether the configuration can be used for new payments. """ - affirm: Optional[StripeObject] - afterpay_clearpay: Optional[StripeObject] - alipay: Optional[StripeObject] - apple_pay: Optional[StripeObject] + affirm: Optional[Affirm] + afterpay_clearpay: Optional[AfterpayClearpay] + alipay: Optional[Alipay] + apple_pay: Optional[ApplePay] application: Optional[str] """ For child configs, the Connect application associated with the configuration. """ - au_becs_debit: Optional[StripeObject] - bacs_debit: Optional[StripeObject] - bancontact: Optional[StripeObject] - blik: Optional[StripeObject] - boleto: Optional[StripeObject] - card: Optional[StripeObject] - cartes_bancaires: Optional[StripeObject] - cashapp: Optional[StripeObject] - eps: Optional[StripeObject] - fpx: Optional[StripeObject] - giropay: Optional[StripeObject] - google_pay: Optional[StripeObject] - grabpay: Optional[StripeObject] + au_becs_debit: Optional[AuBecsDebit] + bacs_debit: Optional[BacsDebit] + bancontact: Optional[Bancontact] + blik: Optional[Blik] + boleto: Optional[Boleto] + card: Optional[Card] + cartes_bancaires: Optional[CartesBancaires] + cashapp: Optional[Cashapp] + eps: Optional[Eps] + fpx: Optional[Fpx] + giropay: Optional[Giropay] + google_pay: Optional[GooglePay] + grabpay: Optional[Grabpay] id: str """ Unique identifier for the object. """ - id_bank_transfer: Optional[StripeObject] - ideal: Optional[StripeObject] + id_bank_transfer: Optional[IdBankTransfer] + ideal: Optional[Ideal] is_default: bool """ The default configuration is used whenever a payment method configuration is not specified. """ - jcb: Optional[StripeObject] - klarna: Optional[StripeObject] - konbini: Optional[StripeObject] - link: Optional[StripeObject] + jcb: Optional[Jcb] + klarna: Optional[Klarna] + konbini: Optional[Konbini] + link: Optional[Link] livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. """ - multibanco: Optional[StripeObject] + multibanco: Optional[Multibanco] name: str """ The configuration's name. """ - netbanking: Optional[StripeObject] + netbanking: Optional[Netbanking] object: Literal["payment_method_configuration"] """ String representing the object's type. Objects of the same type share the same value. """ - oxxo: Optional[StripeObject] - p24: Optional[StripeObject] + oxxo: Optional[Oxxo] + p24: Optional[P24] parent: Optional[str] """ For child configs, the configuration's parent configuration. """ - pay_by_bank: Optional[StripeObject] - paynow: Optional[StripeObject] - paypal: Optional[StripeObject] - promptpay: Optional[StripeObject] - sepa_debit: Optional[StripeObject] - sofort: Optional[StripeObject] - upi: Optional[StripeObject] - us_bank_account: Optional[StripeObject] - wechat_pay: Optional[StripeObject] + pay_by_bank: Optional[PayByBank] + paynow: Optional[Paynow] + paypal: Optional[Paypal] + promptpay: Optional[Promptpay] + sepa_debit: Optional[SepaDebit] + sofort: Optional[Sofort] + upi: Optional[Upi] + us_bank_account: Optional[UsBankAccount] + wechat_pay: Optional[WechatPay] @classmethod def create( @@ -1532,3 +2347,43 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "acss_debit": AcssDebit, + "affirm": Affirm, + "afterpay_clearpay": AfterpayClearpay, + "alipay": Alipay, + "apple_pay": ApplePay, + "au_becs_debit": AuBecsDebit, + "bacs_debit": BacsDebit, + "bancontact": Bancontact, + "blik": Blik, + "boleto": Boleto, + "card": Card, + "cartes_bancaires": CartesBancaires, + "cashapp": Cashapp, + "eps": Eps, + "fpx": Fpx, + "giropay": Giropay, + "google_pay": GooglePay, + "grabpay": Grabpay, + "id_bank_transfer": IdBankTransfer, + "ideal": Ideal, + "jcb": Jcb, + "klarna": Klarna, + "konbini": Konbini, + "link": Link, + "multibanco": Multibanco, + "netbanking": Netbanking, + "oxxo": Oxxo, + "p24": P24, + "pay_by_bank": PayByBank, + "paynow": Paynow, + "paypal": Paypal, + "promptpay": Promptpay, + "sepa_debit": SepaDebit, + "sofort": Sofort, + "upi": Upi, + "us_bank_account": UsBankAccount, + "wechat_pay": WechatPay, + } diff --git a/stripe/api_resources/payment_method_domain.py b/stripe/api_resources/payment_method_domain.py index 44b6c3b1d..80d77b7d4 100644 --- a/stripe/api_resources/payment_method_domain.py +++ b/stripe/api_resources/payment_method_domain.py @@ -30,6 +30,75 @@ class PaymentMethodDomain( OBJECT_NAME: ClassVar[ Literal["payment_method_domain"] ] = "payment_method_domain" + + class ApplePay(StripeObject): + class StatusDetails(StripeObject): + error_message: str + """ + The error message associated with the status of the payment method on the domain. + """ + + status: Literal["active", "inactive"] + """ + The status of the payment method on the domain. + """ + status_details: Optional[StatusDetails] + """ + Contains additional details about the status of a payment method for a specific payment method domain. + """ + _inner_class_types = {"status_details": StatusDetails} + + class GooglePay(StripeObject): + class StatusDetails(StripeObject): + error_message: str + """ + The error message associated with the status of the payment method on the domain. + """ + + status: Literal["active", "inactive"] + """ + The status of the payment method on the domain. + """ + status_details: Optional[StatusDetails] + """ + Contains additional details about the status of a payment method for a specific payment method domain. + """ + _inner_class_types = {"status_details": StatusDetails} + + class Link(StripeObject): + class StatusDetails(StripeObject): + error_message: str + """ + The error message associated with the status of the payment method on the domain. + """ + + status: Literal["active", "inactive"] + """ + The status of the payment method on the domain. + """ + status_details: Optional[StatusDetails] + """ + Contains additional details about the status of a payment method for a specific payment method domain. + """ + _inner_class_types = {"status_details": StatusDetails} + + class Paypal(StripeObject): + class StatusDetails(StripeObject): + error_message: str + """ + The error message associated with the status of the payment method on the domain. + """ + + status: Literal["active", "inactive"] + """ + The status of the payment method on the domain. + """ + status_details: Optional[StatusDetails] + """ + Contains additional details about the status of a payment method for a specific payment method domain. + """ + _inner_class_types = {"status_details": StatusDetails} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -94,7 +163,7 @@ class ValidateParams(RequestOptions): Specifies which fields in the response should be expanded. """ - apple_pay: StripeObject + apple_pay: ApplePay """ Indicates the status of a specific payment method on a payment method domain. """ @@ -110,7 +179,7 @@ class ValidateParams(RequestOptions): """ Whether this payment method domain is enabled. If the domain is not enabled, payment methods that require a payment method domain will not appear in Elements. """ - google_pay: StripeObject + google_pay: GooglePay """ Indicates the status of a specific payment method on a payment method domain. """ @@ -118,7 +187,7 @@ class ValidateParams(RequestOptions): """ Unique identifier for the object. """ - link: StripeObject + link: Link """ Indicates the status of a specific payment method on a payment method domain. """ @@ -130,7 +199,7 @@ class ValidateParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - paypal: StripeObject + paypal: Paypal """ Indicates the status of a specific payment method on a payment method domain. """ @@ -262,3 +331,10 @@ def validate( # pyright: ignore[reportGeneralTypeIssues] params=params, ), ) + + _inner_class_types = { + "apple_pay": ApplePay, + "google_pay": GooglePay, + "link": Link, + "paypal": Paypal, + } diff --git a/stripe/api_resources/person.py b/stripe/api_resources/person.py index ab3d9dd2a..d200f0f0a 100644 --- a/stripe/api_resources/person.py +++ b/stripe/api_resources/person.py @@ -1,12 +1,16 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe.api_resources.abstract import UpdateableAPIResource -from stripe.api_resources.account import Account +from stripe.api_resources.account import Account as AccountResource +from stripe.api_resources.expandable_field import ExpandableField from stripe.stripe_object import StripeObject from typing import ClassVar, Dict, List, Optional -from typing_extensions import Literal +from typing_extensions import Literal, TYPE_CHECKING from urllib.parse import quote_plus +if TYPE_CHECKING: + from stripe.api_resources.file import File + class Person(UpdateableAPIResource["Person"]): """ @@ -19,17 +23,527 @@ class Person(UpdateableAPIResource["Person"]): """ OBJECT_NAME: ClassVar[Literal["person"]] = "person" + + class AdditionalTosAcceptances(StripeObject): + class Account(StripeObject): + date: Optional[int] + """ + The Unix timestamp marking when the legal guardian accepted the service agreement. + """ + ip: Optional[str] + """ + The IP address from which the legal guardian accepted the service agreement. + """ + user_agent: Optional[str] + """ + The user agent of the browser from which the legal guardian accepted the service agreement. + """ + + account: Account + _inner_class_types = {"account": Account} + + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class AddressKana(StripeObject): + city: Optional[str] + """ + City/Ward. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Block/Building number. + """ + line2: Optional[str] + """ + Building details. + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + Prefecture. + """ + town: Optional[str] + """ + Town/cho-me. + """ + + class AddressKanji(StripeObject): + city: Optional[str] + """ + City/Ward. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Block/Building number. + """ + line2: Optional[str] + """ + Building details. + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + Prefecture. + """ + town: Optional[str] + """ + Town/cho-me. + """ + + class Dob(StripeObject): + day: Optional[int] + """ + The day of birth, between 1 and 31. + """ + month: Optional[int] + """ + The month of birth, between 1 and 12. + """ + year: Optional[int] + """ + The four-digit year of birth. + """ + + class FutureRequirements(StripeObject): + class Alternative(StripeObject): + alternative_fields_due: List[str] + """ + Fields that can be provided to satisfy all fields in `original_fields_due`. + """ + original_fields_due: List[str] + """ + Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`. + """ + + class Error(StripeObject): + code: Literal[ + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_length", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_requires_additional_memorandum_of_associations", + ] + """ + The code for the type of error. + """ + reason: str + """ + An informative message that indicates the error type and provides additional details about the error. + """ + requirement: str + """ + The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + """ + + alternatives: Optional[List[Alternative]] + """ + Fields that are due and can be satisfied by providing the corresponding alternative fields instead. + """ + currently_due: List[str] + """ + Fields that need to be collected to keep the person's account enabled. If not collected by the account's `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash, and may immediately become `past_due`, but the account may also be given a grace period depending on the account's enablement state prior to transition. + """ + errors: List[Error] + """ + Fields that are `currently_due` and need to be collected again because validation or verification failed. + """ + eventually_due: List[str] + """ + Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and the account's `future_requirements[current_deadline]` becomes set. + """ + past_due: List[str] + """ + Fields that weren't collected by the account's `requirements.current_deadline`. These fields need to be collected to enable the person's account. New fields will never appear here; `future_requirements.past_due` will always be a subset of `requirements.past_due`. + """ + pending_verification: List[str] + """ + Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due` or `currently_due`. + """ + _inner_class_types = {"alternatives": Alternative, "errors": Error} + + class RegisteredAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class Relationship(StripeObject): + director: Optional[bool] + """ + Whether the person is a director of the account's legal entity. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. + """ + executive: Optional[bool] + """ + Whether the person has significant responsibility to control, manage, or direct the organization. + """ + legal_guardian: Optional[bool] + """ + Whether the person is the legal guardian of the account's representative. + """ + owner: Optional[bool] + """ + Whether the person is an owner of the account's legal entity. + """ + percent_ownership: Optional[float] + """ + The percent owned by the person of the account's legal entity. + """ + representative: Optional[bool] + """ + Whether the person is authorized as the primary representative of the account. This is the person nominated by the business to provide information about themselves, and general information about the account. There can only be one representative at any given time. At the time the account is created, this person should be set to the person responsible for opening the account. + """ + title: Optional[str] + """ + The person's title (e.g., CEO, Support Engineer). + """ + + class Requirements(StripeObject): + class Alternative(StripeObject): + alternative_fields_due: List[str] + """ + Fields that can be provided to satisfy all fields in `original_fields_due`. + """ + original_fields_due: List[str] + """ + Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`. + """ + + class Error(StripeObject): + code: Literal[ + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_length", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_requires_additional_memorandum_of_associations", + ] + """ + The code for the type of error. + """ + reason: str + """ + An informative message that indicates the error type and provides additional details about the error. + """ + requirement: str + """ + The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + """ + + alternatives: Optional[List[Alternative]] + """ + Fields that are due and can be satisfied by providing the corresponding alternative fields instead. + """ + currently_due: List[str] + """ + Fields that need to be collected to keep the person's account enabled. If not collected by the account's `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + """ + errors: List[Error] + """ + Fields that are `currently_due` and need to be collected again because validation or verification failed. + """ + eventually_due: List[str] + """ + Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and the account's `current_deadline` becomes set. + """ + past_due: List[str] + """ + Fields that weren't collected by the account's `current_deadline`. These fields need to be collected to enable the person's account. + """ + pending_verification: List[str] + """ + Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. + """ + _inner_class_types = {"alternatives": Alternative, "errors": Error} + + class Verification(StripeObject): + class AdditionalDocument(StripeObject): + back: Optional[ExpandableField["File"]] + """ + The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + """ + details: Optional[str] + """ + A user-displayable string describing the verification state of this document. For example, if a document is uploaded and the picture is too fuzzy, this may say "Identity document is too unclear to read". + """ + details_code: Optional[str] + """ + One of `document_corrupt`, `document_country_not_supported`, `document_expired`, `document_failed_copy`, `document_failed_other`, `document_failed_test_mode`, `document_fraudulent`, `document_failed_greyscale`, `document_incomplete`, `document_invalid`, `document_manipulated`, `document_missing_back`, `document_missing_front`, `document_not_readable`, `document_not_uploaded`, `document_photo_mismatch`, `document_too_large`, or `document_type_not_supported`. A machine-readable code specifying the verification state for this document. + """ + front: Optional[ExpandableField["File"]] + """ + The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + """ + + class Document(StripeObject): + back: Optional[ExpandableField["File"]] + """ + The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + """ + details: Optional[str] + """ + A user-displayable string describing the verification state of this document. For example, if a document is uploaded and the picture is too fuzzy, this may say "Identity document is too unclear to read". + """ + details_code: Optional[str] + """ + One of `document_corrupt`, `document_country_not_supported`, `document_expired`, `document_failed_copy`, `document_failed_other`, `document_failed_test_mode`, `document_fraudulent`, `document_failed_greyscale`, `document_incomplete`, `document_invalid`, `document_manipulated`, `document_missing_back`, `document_missing_front`, `document_not_readable`, `document_not_uploaded`, `document_photo_mismatch`, `document_too_large`, or `document_type_not_supported`. A machine-readable code specifying the verification state for this document. + """ + front: Optional[ExpandableField["File"]] + """ + The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + """ + + additional_document: Optional[AdditionalDocument] + """ + A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + """ + details: Optional[str] + """ + A user-displayable string describing the verification state for the person. For example, this may say "Provided identity information could not be verified". + """ + details_code: Optional[str] + """ + One of `document_address_mismatch`, `document_dob_mismatch`, `document_duplicate_type`, `document_id_number_mismatch`, `document_name_mismatch`, `document_nationality_mismatch`, `failed_keyed_identity`, or `failed_other`. A machine-readable code specifying the verification state for the person. + """ + document: Optional[Document] + status: str + """ + The state of verification for the person. Possible values are `unverified`, `pending`, or `verified`. + """ + _inner_class_types = { + "additional_document": AdditionalDocument, + "document": Document, + } + account: Optional[str] """ The account the person is associated with. """ - additional_tos_acceptances: Optional[StripeObject] - address: Optional[StripeObject] - address_kana: Optional[StripeObject] + additional_tos_acceptances: Optional[AdditionalTosAcceptances] + address: Optional[Address] + address_kana: Optional[AddressKana] """ The Kana variation of the person's address (Japan only). """ - address_kanji: Optional[StripeObject] + address_kanji: Optional[AddressKanji] """ The Kanji variation of the person's address (Japan only). """ @@ -37,7 +551,7 @@ class Person(UpdateableAPIResource["Person"]): """ Time at which the object was created. Measured in seconds since the Unix epoch. """ - dob: Optional[StripeObject] + dob: Optional[Dob] email: Optional[str] """ The person's email address. @@ -58,7 +572,7 @@ class Person(UpdateableAPIResource["Person"]): """ A list of alternate names or aliases that the person is known by. """ - future_requirements: Optional[StripeObject] + future_requirements: Optional[FutureRequirements] """ Information about the [upcoming new requirements for this person](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when. """ @@ -114,9 +628,9 @@ class Person(UpdateableAPIResource["Person"]): """ Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. """ - registered_address: Optional[StripeObject] - relationship: Optional[StripeObject] - requirements: Optional[StripeObject] + registered_address: Optional[RegisteredAddress] + relationship: Optional[Relationship] + requirements: Optional[Requirements] """ Information about the requirements for this person, including what information needs to be collected, and by when. """ @@ -124,7 +638,7 @@ class Person(UpdateableAPIResource["Person"]): """ Whether the last four digits of the person's Social Security number have been provided (U.S. only). """ - verification: Optional[StripeObject] + verification: Optional[Verification] deleted: Optional[Literal[True]] """ Always true for a deleted object @@ -133,7 +647,7 @@ class Person(UpdateableAPIResource["Person"]): def instance_url(self): token = self.id account = self.account - base = Account.class_url() + base = AccountResource.class_url() assert account is not None acct_extn = quote_plus(account) extn = quote_plus(token) @@ -154,3 +668,16 @@ def retrieve(cls, id, api_key=None, **params): "Use stripe.Account.retrieve_person('account_id', 'person_id') " "(see https://stripe.com/docs/api/persons/retrieve)." ) + + _inner_class_types = { + "additional_tos_acceptances": AdditionalTosAcceptances, + "address": Address, + "address_kana": AddressKana, + "address_kanji": AddressKanji, + "dob": Dob, + "future_requirements": FutureRequirements, + "registered_address": RegisteredAddress, + "relationship": Relationship, + "requirements": Requirements, + "verification": Verification, + } diff --git a/stripe/api_resources/plan.py b/stripe/api_resources/plan.py index 915fb6a5a..a0f0c6d1b 100644 --- a/stripe/api_resources/plan.py +++ b/stripe/api_resources/plan.py @@ -43,6 +43,39 @@ class Plan( """ OBJECT_NAME: ClassVar[Literal["plan"]] = "plan" + + class Tier(StripeObject): + flat_amount: Optional[int] + """ + Price for the entire tier. + """ + flat_amount_decimal: Optional[str] + """ + Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. + """ + unit_amount: Optional[int] + """ + Per unit price for units relevant to the tier. + """ + unit_amount_decimal: Optional[str] + """ + Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. + """ + up_to: Optional[int] + """ + Up to and including to this quantity will be contained in the tier. + """ + + class TransformUsage(StripeObject): + divide_by: int + """ + Divide usage by this number. + """ + round: Literal["down", "up"] + """ + After division, either round the result `up` or `down`. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -329,7 +362,7 @@ class RetrieveParams(RequestOptions): """ The product whose pricing this plan determines. """ - tiers: Optional[List[StripeObject]] + tiers: Optional[List[Tier]] """ Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. """ @@ -337,7 +370,7 @@ class RetrieveParams(RequestOptions): """ Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows. """ - transform_usage: Optional[StripeObject] + transform_usage: Optional[TransformUsage] """ Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`. """ @@ -445,3 +478,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"tiers": Tier, "transform_usage": TransformUsage} diff --git a/stripe/api_resources/price.py b/stripe/api_resources/price.py index 56b87e58a..f75b3eac4 100644 --- a/stripe/api_resources/price.py +++ b/stripe/api_resources/price.py @@ -41,6 +41,141 @@ class Price( """ OBJECT_NAME: ClassVar[Literal["price"]] = "price" + + class CurrencyOptions(StripeObject): + class CustomUnitAmount(StripeObject): + maximum: Optional[int] + """ + The maximum unit amount the customer can specify for this item. + """ + minimum: Optional[int] + """ + The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. + """ + preset: Optional[int] + """ + The starting unit amount which can be updated by the customer. + """ + + class Tier(StripeObject): + flat_amount: Optional[int] + """ + Price for the entire tier. + """ + flat_amount_decimal: Optional[str] + """ + Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. + """ + unit_amount: Optional[int] + """ + Per unit price for units relevant to the tier. + """ + unit_amount_decimal: Optional[str] + """ + Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. + """ + up_to: Optional[int] + """ + Up to and including to this quantity will be contained in the tier. + """ + + custom_unit_amount: Optional[CustomUnitAmount] + """ + When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. + """ + tax_behavior: Optional[ + Literal["exclusive", "inclusive", "unspecified"] + ] + """ + Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. + """ + tiers: Optional[List[Tier]] + """ + Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. + """ + unit_amount: Optional[int] + """ + The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. + """ + unit_amount_decimal: Optional[str] + """ + The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. + """ + _inner_class_types = { + "custom_unit_amount": CustomUnitAmount, + "tiers": Tier, + } + + class CustomUnitAmount(StripeObject): + maximum: Optional[int] + """ + The maximum unit amount the customer can specify for this item. + """ + minimum: Optional[int] + """ + The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. + """ + preset: Optional[int] + """ + The starting unit amount which can be updated by the customer. + """ + + class Recurring(StripeObject): + aggregate_usage: Optional[ + Literal["last_during_period", "last_ever", "max", "sum"] + ] + """ + Specifies a usage aggregation strategy for prices of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. Defaults to `sum`. + """ + interval: Literal["day", "month", "week", "year"] + """ + The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. + """ + interval_count: int + """ + The number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. + """ + trial_period_days: Optional[int] + """ + Default number of trial days when subscribing a customer to this price using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan). + """ + usage_type: Literal["licensed", "metered"] + """ + Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`. + """ + + class Tier(StripeObject): + flat_amount: Optional[int] + """ + Price for the entire tier. + """ + flat_amount_decimal: Optional[str] + """ + Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. + """ + unit_amount: Optional[int] + """ + Per unit price for units relevant to the tier. + """ + unit_amount_decimal: Optional[str] + """ + Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. + """ + up_to: Optional[int] + """ + Up to and including to this quantity will be contained in the tier. + """ + + class TransformQuantity(StripeObject): + divide_by: int + """ + Divide usage by this number. + """ + round: Literal["down", "up"] + """ + After division, either round the result `up` or `down`. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -525,11 +660,11 @@ class SearchParams(RequestOptions): """ 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). """ - currency_options: Optional[Dict[str, StripeObject]] + currency_options: Optional[Dict[str, CurrencyOptions]] """ Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). """ - custom_unit_amount: Optional[StripeObject] + custom_unit_amount: Optional[CustomUnitAmount] """ When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. """ @@ -561,7 +696,7 @@ class SearchParams(RequestOptions): """ The ID of the product this price is associated with. """ - recurring: Optional[StripeObject] + recurring: Optional[Recurring] """ The recurring components of a price such as `interval` and `usage_type`. """ @@ -569,7 +704,7 @@ class SearchParams(RequestOptions): """ Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. """ - tiers: Optional[List[StripeObject]] + tiers: Optional[List[Tier]] """ Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. """ @@ -577,7 +712,7 @@ class SearchParams(RequestOptions): """ Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows. """ - transform_quantity: Optional[StripeObject] + transform_quantity: Optional[TransformQuantity] """ Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`. """ @@ -674,3 +809,11 @@ def search_auto_paging_iter( cls, *args, **kwargs: Unpack["Price.SearchParams"] ) -> Iterator["Price"]: return cls.search(*args, **kwargs).auto_paging_iter() + + _inner_class_types = { + "currency_options": CurrencyOptions, + "custom_unit_amount": CustomUnitAmount, + "recurring": Recurring, + "tiers": Tier, + "transform_quantity": TransformQuantity, + } diff --git a/stripe/api_resources/product.py b/stripe/api_resources/product.py index f1a1288a8..ac2c7e9ae 100644 --- a/stripe/api_resources/product.py +++ b/stripe/api_resources/product.py @@ -56,6 +56,31 @@ class Product( """ OBJECT_NAME: ClassVar[Literal["product"]] = "product" + + class Feature(StripeObject): + name: str + """ + The feature's name. Up to 80 characters long. + """ + + class PackageDimensions(StripeObject): + height: float + """ + Height, in inches. + """ + length: float + """ + Length, in inches. + """ + weight: float + """ + Weight, in ounces. + """ + width: float + """ + Width, in inches. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -459,7 +484,7 @@ class SearchParams(RequestOptions): """ The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. """ - features: List[StripeObject] + features: List[Feature] """ A list of up to 15 features for this product. These are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table). """ @@ -487,7 +512,7 @@ class SearchParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - package_dimensions: Optional[StripeObject] + package_dimensions: Optional[PackageDimensions] """ The dimensions of this product for shipping purposes. """ @@ -631,3 +656,8 @@ def search_auto_paging_iter( cls, *args, **kwargs: Unpack["Product.SearchParams"] ) -> Iterator["Product"]: return cls.search(*args, **kwargs).auto_paging_iter() + + _inner_class_types = { + "features": Feature, + "package_dimensions": PackageDimensions, + } diff --git a/stripe/api_resources/promotion_code.py b/stripe/api_resources/promotion_code.py index 075c11a1d..2cf273d9b 100644 --- a/stripe/api_resources/promotion_code.py +++ b/stripe/api_resources/promotion_code.py @@ -35,6 +35,33 @@ class PromotionCode( """ OBJECT_NAME: ClassVar[Literal["promotion_code"]] = "promotion_code" + + class Restrictions(StripeObject): + class CurrencyOptions(StripeObject): + minimum_amount: int + """ + Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). + """ + + currency_options: Optional[Dict[str, CurrencyOptions]] + """ + Promotion code restrictions defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + """ + first_time_transaction: bool + """ + A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices + """ + minimum_amount: Optional[int] + """ + Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). + """ + minimum_amount_currency: Optional[str] + """ + Three-letter [ISO code](https://stripe.com/docs/currencies) for minimum_amount + """ + _inner_class_types = {"currency_options": CurrencyOptions} + _inner_class_dicts = ["currency_options"] + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -245,7 +272,7 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - restrictions: StripeObject + restrictions: Restrictions times_redeemed: int """ Number of times this promotion code has been used. @@ -315,3 +342,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"restrictions": Restrictions} diff --git a/stripe/api_resources/quote.py b/stripe/api_resources/quote.py index a377ffd18..2d30ef829 100644 --- a/stripe/api_resources/quote.py +++ b/stripe/api_resources/quote.py @@ -26,7 +26,7 @@ from stripe.api_resources.account import Account from stripe.api_resources.application import Application from stripe.api_resources.customer import Customer - from stripe.api_resources.discount import Discount + from stripe.api_resources.discount import Discount as DiscountResource from stripe.api_resources.invoice import Invoice from stripe.api_resources.line_item import LineItem from stripe.api_resources.subscription import Subscription @@ -46,6 +46,355 @@ class Quote( """ OBJECT_NAME: ClassVar[Literal["quote"]] = "quote" + + class AutomaticTax(StripeObject): + enabled: bool + """ + Automatically calculate taxes + """ + status: Optional[ + Literal["complete", "failed", "requires_location_inputs"] + ] + """ + The status of the most recent automated tax calculation for this quote. + """ + + class Computed(StripeObject): + class Recurring(StripeObject): + class TotalDetails(StripeObject): + class Breakdown(StripeObject): + class Discount(StripeObject): + amount: int + """ + The amount discounted. + """ + discount: "DiscountResource" + """ + A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). + It contains information about when the discount began, when it will end, and what it is applied to. + + Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) + """ + + class Tax(StripeObject): + amount: int + """ + Amount of tax applied for this rate. + """ + rate: "TaxRate" + """ + Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + + Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + + discounts: List[Discount] + """ + The aggregated discounts. + """ + taxes: List[Tax] + """ + The aggregated tax amounts by rate. + """ + _inner_class_types = {"discounts": Discount, "taxes": Tax} + + amount_discount: int + """ + This is the sum of all the discounts. + """ + amount_shipping: Optional[int] + """ + This is the sum of all the shipping amounts. + """ + amount_tax: int + """ + This is the sum of all the tax amounts. + """ + breakdown: Optional[Breakdown] + _inner_class_types = {"breakdown": Breakdown} + + amount_subtotal: int + """ + Total before any discounts or taxes are applied. + """ + amount_total: int + """ + Total after discounts and taxes are applied. + """ + interval: Literal["day", "month", "week", "year"] + """ + The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. + """ + interval_count: int + """ + The number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. + """ + total_details: TotalDetails + _inner_class_types = {"total_details": TotalDetails} + + class Upfront(StripeObject): + class TotalDetails(StripeObject): + class Breakdown(StripeObject): + class Discount(StripeObject): + amount: int + """ + The amount discounted. + """ + discount: "DiscountResource" + """ + A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). + It contains information about when the discount began, when it will end, and what it is applied to. + + Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) + """ + + class Tax(StripeObject): + amount: int + """ + Amount of tax applied for this rate. + """ + rate: "TaxRate" + """ + Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + + Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + + discounts: List[Discount] + """ + The aggregated discounts. + """ + taxes: List[Tax] + """ + The aggregated tax amounts by rate. + """ + _inner_class_types = {"discounts": Discount, "taxes": Tax} + + amount_discount: int + """ + This is the sum of all the discounts. + """ + amount_shipping: Optional[int] + """ + This is the sum of all the shipping amounts. + """ + amount_tax: int + """ + This is the sum of all the tax amounts. + """ + breakdown: Optional[Breakdown] + _inner_class_types = {"breakdown": Breakdown} + + amount_subtotal: int + """ + Total before any discounts or taxes are applied. + """ + amount_total: int + """ + Total after discounts and taxes are applied. + """ + line_items: Optional[ListObject["LineItem"]] + """ + The line items that will appear on the next invoice after this quote is accepted. This does not include pending invoice items that exist on the customer but may still be included in the next invoice. + """ + total_details: TotalDetails + _inner_class_types = {"total_details": TotalDetails} + + recurring: Optional[Recurring] + """ + The definitive totals and line items the customer will be charged on a recurring basis. Takes into account the line items with recurring prices and discounts with `duration=forever` coupons only. Defaults to `null` if no inputted line items with recurring prices. + """ + upfront: Upfront + _inner_class_types = {"recurring": Recurring, "upfront": Upfront} + + class FromQuote(StripeObject): + is_revision: bool + """ + Whether this quote is a revision of a different quote. + """ + quote: ExpandableField["Quote"] + """ + The quote that was cloned. + """ + + class InvoiceSettings(StripeObject): + days_until_due: Optional[int] + """ + Number of days within which a customer must pay invoices generated by this quote. This value will be `null` for quotes where `collection_method=charge_automatically`. + """ + + class StatusTransitions(StripeObject): + accepted_at: Optional[int] + """ + The time that the quote was accepted. Measured in seconds since Unix epoch. + """ + canceled_at: Optional[int] + """ + The time that the quote was canceled. Measured in seconds since Unix epoch. + """ + finalized_at: Optional[int] + """ + The time that the quote was finalized. Measured in seconds since Unix epoch. + """ + + class SubscriptionData(StripeObject): + description: Optional[str] + """ + The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription. + """ + effective_date: Optional[int] + """ + When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. This date is ignored if it is in the past when the quote is accepted. Measured in seconds since the Unix epoch. + """ + trial_period_days: Optional[int] + """ + Integer representing the number of trial period days before the customer is charged for the first time. + """ + + class TotalDetails(StripeObject): + class Breakdown(StripeObject): + class Discount(StripeObject): + amount: int + """ + The amount discounted. + """ + discount: "DiscountResource" + """ + A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). + It contains information about when the discount began, when it will end, and what it is applied to. + + Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) + """ + + class Tax(StripeObject): + amount: int + """ + Amount of tax applied for this rate. + """ + rate: "TaxRate" + """ + Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + + Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) + """ + taxability_reason: Optional[ + Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: Optional[int] + """ + The amount on which tax is calculated, in cents (or local equivalent). + """ + + discounts: List[Discount] + """ + The aggregated discounts. + """ + taxes: List[Tax] + """ + The aggregated tax amounts by rate. + """ + _inner_class_types = {"discounts": Discount, "taxes": Tax} + + amount_discount: int + """ + This is the sum of all the discounts. + """ + amount_shipping: Optional[int] + """ + This is the sum of all the shipping amounts. + """ + amount_tax: int + """ + This is the sum of all the tax amounts. + """ + breakdown: Optional[Breakdown] + _inner_class_types = {"breakdown": Breakdown} + + class TransferData(StripeObject): + amount: Optional[int] + """ + The amount in cents (or local equivalent) that will be transferred to the destination account when the invoice is paid. By default, the entire amount is transferred to the destination. + """ + amount_percent: Optional[float] + """ + A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount will be transferred to the destination. + """ + destination: ExpandableField["Account"] + """ + The account where funds from the payment will be transferred to upon payment success. + """ + if TYPE_CHECKING: class AcceptParams(RequestOptions): @@ -574,12 +923,12 @@ class RetrieveParams(RequestOptions): """ A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote. """ - automatic_tax: StripeObject + automatic_tax: AutomaticTax collection_method: Literal["charge_automatically", "send_invoice"] """ Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically`. """ - computed: StripeObject + computed: Computed created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -600,7 +949,7 @@ class RetrieveParams(RequestOptions): """ A description that will be displayed on the quote PDF. """ - discounts: List[ExpandableField["Discount"]] + discounts: List[ExpandableField["DiscountResource"]] """ The discounts applied to this quote. """ @@ -612,7 +961,7 @@ class RetrieveParams(RequestOptions): """ A footer that will be displayed on the quote PDF. """ - from_quote: Optional[StripeObject] + from_quote: Optional[FromQuote] """ Details of the quote that was cloned. See the [cloning documentation](https://stripe.com/docs/quotes/clone) for more details. """ @@ -628,7 +977,7 @@ class RetrieveParams(RequestOptions): """ The invoice that was created from this quote. """ - invoice_settings: Optional[StripeObject] + invoice_settings: Optional[InvoiceSettings] """ All invoices will be billed using the specified settings. """ @@ -660,12 +1009,12 @@ class RetrieveParams(RequestOptions): """ The status of the quote. """ - status_transitions: StripeObject + status_transitions: StatusTransitions subscription: Optional[ExpandableField["Subscription"]] """ The subscription that was created or updated from this quote. """ - subscription_data: StripeObject + subscription_data: SubscriptionData subscription_schedule: Optional[ExpandableField["SubscriptionSchedule"]] """ The subscription schedule that was created or updated from this quote. @@ -674,8 +1023,8 @@ class RetrieveParams(RequestOptions): """ ID of the test clock this quote belongs to. """ - total_details: StripeObject - transfer_data: Optional[StripeObject] + total_details: TotalDetails + transfer_data: Optional[TransferData] """ The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices. """ @@ -1117,3 +1466,14 @@ def pdf( # type: ignore ) url = self.instance_url() + "/pdf" return requestor.request_stream("get", url, params=params) + + _inner_class_types = { + "automatic_tax": AutomaticTax, + "computed": Computed, + "from_quote": FromQuote, + "invoice_settings": InvoiceSettings, + "status_transitions": StatusTransitions, + "subscription_data": SubscriptionData, + "total_details": TotalDetails, + "transfer_data": TransferData, + } diff --git a/stripe/api_resources/refund.py b/stripe/api_resources/refund.py index 6c2c62234..aa97fa232 100644 --- a/stripe/api_resources/refund.py +++ b/stripe/api_resources/refund.py @@ -37,6 +37,36 @@ class Refund( """ OBJECT_NAME: ClassVar[Literal["refund"]] = "refund" + + class NextAction(StripeObject): + class DisplayDetails(StripeObject): + class EmailSent(StripeObject): + email_sent_at: int + """ + The timestamp when the email was sent. + """ + email_sent_to: str + """ + The recipient's email address. + """ + + email_sent: EmailSent + expires_at: int + """ + The expiry timestamp. + """ + _inner_class_types = {"email_sent": EmailSent} + + display_details: Optional[DisplayDetails] + """ + Contains the refund details. + """ + type: str + """ + Type of the next action to perform. + """ + _inner_class_types = {"display_details": DisplayDetails} + if TYPE_CHECKING: class CancelParams(RequestOptions): @@ -182,7 +212,7 @@ class ExpireParams(RequestOptions): """ 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. """ - next_action: Optional[StripeObject] + next_action: Optional[NextAction] object: Literal["refund"] """ String representing the object's type. Objects of the same type share the same value. @@ -413,5 +443,7 @@ def expire( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = {"next_action": NextAction} + Refund.TestHelpers._resource_cls = Refund diff --git a/stripe/api_resources/reporting/report_run.py b/stripe/api_resources/reporting/report_run.py index fc1507105..bf75a5229 100644 --- a/stripe/api_resources/reporting/report_run.py +++ b/stripe/api_resources/reporting/report_run.py @@ -38,6 +38,41 @@ class ReportRun( OBJECT_NAME: ClassVar[ Literal["reporting.report_run"] ] = "reporting.report_run" + + class Parameters(StripeObject): + columns: Optional[List[str]] + """ + The set of output columns requested for inclusion in the report run. + """ + connected_account: Optional[str] + """ + Connected account ID by which to filter the report run. + """ + currency: Optional[str] + """ + Currency of objects to be included in the report run. + """ + interval_end: Optional[int] + """ + Ending timestamp of data to be included in the report run. Can be any UTC timestamp between 1 second after the user specified `interval_start` and 1 second before this report's last `data_available_end` value. + """ + interval_start: Optional[int] + """ + Starting timestamp of data to be included in the report run. Can be any UTC timestamp between 1 second after this report's `data_available_start` and 1 second before the user specified `interval_end` value. + """ + payout: Optional[str] + """ + Payout ID by which to filter the report run. + """ + reporting_category: Optional[str] + """ + Category of balance transactions to be included in the report run. + """ + timezone: Optional[str] + """ + Defaults to `Etc/UTC`. The output timezone for all timestamps in the report. A list of possible time zone values is maintained at the [IANA Time Zone Database](http://www.iana.org/time-zones). Has no effect on `interval_start` or `interval_end`. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -156,7 +191,7 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - parameters: StripeObject + parameters: Parameters report_type: str """ The ID of the [report type](https://stripe.com/docs/reports/report-types) to run, such as `"balance.summary.1"`. @@ -232,3 +267,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"parameters": Parameters} diff --git a/stripe/api_resources/review.py b/stripe/api_resources/review.py index 8327f2b9c..f74851759 100644 --- a/stripe/api_resources/review.py +++ b/stripe/api_resources/review.py @@ -30,6 +30,47 @@ class Review(ListableAPIResource["Review"]): """ OBJECT_NAME: ClassVar[Literal["review"]] = "review" + + class IpAddressLocation(StripeObject): + city: Optional[str] + """ + The city where the payment originated. + """ + country: Optional[str] + """ + Two-letter ISO code representing the country where the payment originated. + """ + latitude: Optional[float] + """ + The geographic latitude where the payment originated. + """ + longitude: Optional[float] + """ + The geographic longitude where the payment originated. + """ + region: Optional[str] + """ + The state/county/province/region where the payment originated. + """ + + class Session(StripeObject): + browser: Optional[str] + """ + The browser used in this browser session (e.g., `Chrome`). + """ + device: Optional[str] + """ + Information about the device used for the browser session (e.g., `Samsung SM-G930T`). + """ + platform: Optional[str] + """ + The platform for the browser session (e.g., `Macintosh`). + """ + version: Optional[str] + """ + The version for the browser session (e.g., `61.0.3163.100`). + """ + if TYPE_CHECKING: class ApproveParams(RequestOptions): @@ -109,7 +150,7 @@ class RetrieveParams(RequestOptions): """ The IP address where the payment originated. """ - ip_address_location: Optional[StripeObject] + ip_address_location: Optional[IpAddressLocation] """ Information related to the location of the payment. Note that this information is an approximation and attempts to locate the nearest population center - it should not be used to determine a specific address. """ @@ -137,7 +178,7 @@ class RetrieveParams(RequestOptions): """ The reason the review is currently open or closed. One of `rule`, `manual`, `approved`, `refunded`, `refunded_as_fraud`, `disputed`, or `redacted`. """ - session: Optional[StripeObject] + session: Optional[Session] """ Information related to the browsing session of the user who initiated the payment. """ @@ -235,3 +276,8 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "ip_address_location": IpAddressLocation, + "session": Session, + } diff --git a/stripe/api_resources/setup_attempt.py b/stripe/api_resources/setup_attempt.py index bf5773c78..c1a1f71f2 100644 --- a/stripe/api_resources/setup_attempt.py +++ b/stripe/api_resources/setup_attempt.py @@ -5,7 +5,7 @@ from stripe.api_resources.list_object import ListObject from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject -from typing import ClassVar, List, Optional +from typing import ClassVar, List, Optional, Union from typing_extensions import ( Literal, NotRequired, @@ -17,9 +17,14 @@ if TYPE_CHECKING: from stripe.api_resources.account import Account from stripe.api_resources.application import Application + from stripe.api_resources.bank_account import BankAccount + from stripe.api_resources.card import Card as CardResource from stripe.api_resources.customer import Customer + from stripe.api_resources.mandate import Mandate + from stripe.api_resources.payment_intent import PaymentIntent from stripe.api_resources.payment_method import PaymentMethod from stripe.api_resources.setup_intent import SetupIntent + from stripe.api_resources.source import Source class SetupAttempt(ListableAPIResource["SetupAttempt"]): @@ -31,6 +36,607 @@ class SetupAttempt(ListableAPIResource["SetupAttempt"]): """ OBJECT_NAME: ClassVar[Literal["setup_attempt"]] = "setup_attempt" + + class PaymentMethodDetails(StripeObject): + class AcssDebit(StripeObject): + pass + + class AuBecsDebit(StripeObject): + pass + + class BacsDebit(StripeObject): + pass + + class Bancontact(StripeObject): + bank_code: Optional[str] + """ + Bank code of bank associated with the bank account. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + bic: Optional[str] + """ + Bank Identifier Code of the bank associated with the bank account. + """ + generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]] + """ + The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt. + """ + generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]] + """ + The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt. + """ + iban_last4: Optional[str] + """ + Last four characters of the IBAN. + """ + preferred_language: Optional[Literal["de", "en", "fr", "nl"]] + """ + Preferred language of the Bancontact authorization page that the customer is redirected to. + Can be one of `en`, `de`, `fr`, or `nl` + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by Bancontact directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + + class Boleto(StripeObject): + pass + + class Card(StripeObject): + class Checks(StripeObject): + address_line1_check: Optional[str] + """ + If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + address_postal_code_check: Optional[str] + """ + If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + cvc_check: Optional[str] + """ + If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + """ + + class ThreeDSecure(StripeObject): + authentication_flow: Optional[ + Literal["challenge", "frictionless"] + ] + """ + For authenticated transactions: how the customer was authenticated by + the issuing bank. + """ + result: Optional[ + Literal[ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ] + ] + """ + Indicates the outcome of 3D Secure authentication. + """ + result_reason: Optional[ + Literal[ + "abandoned", + "bypassed", + "canceled", + "card_not_enrolled", + "network_not_supported", + "protocol_error", + "rejected", + ] + ] + """ + Additional information about why 3D Secure succeeded or failed based + on the `result`. + """ + version: Optional[Literal["1.0.2", "2.1.0", "2.2.0"]] + """ + The version of 3D Secure that was used. + """ + + class Wallet(StripeObject): + class ApplePay(StripeObject): + pass + + class GooglePay(StripeObject): + pass + + apple_pay: Optional[ApplePay] + google_pay: Optional[GooglePay] + type: Literal["apple_pay", "google_pay", "link"] + """ + The type of the card wallet, one of `apple_pay`, `google_pay`, or `link`. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type. + """ + _inner_class_types = { + "apple_pay": ApplePay, + "google_pay": GooglePay, + } + + brand: Optional[str] + """ + Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + checks: Optional[Checks] + """ + Check results by Card networks on Card address and CVC at the time of authorization + """ + country: Optional[str] + """ + Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + """ + description: Optional[str] + """ + A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.) + """ + exp_month: Optional[int] + """ + Two-digit number representing the card's expiration month. + """ + exp_year: Optional[int] + """ + Four-digit number representing the card's expiration year. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + + *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* + """ + funding: Optional[str] + """ + Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + """ + iin: Optional[str] + """ + Issuer identification number of the card. (For internal use only and not typically available in standard API requests.) + """ + issuer: Optional[str] + """ + The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.) + """ + last4: Optional[str] + """ + The last four digits of the card. + """ + network: Optional[str] + """ + Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + """ + three_d_secure: Optional[ThreeDSecure] + """ + Populated if this authorization used 3D Secure authentication. + """ + wallet: Optional[Wallet] + """ + If this Card is part of a card wallet, this contains the details of the card wallet. + """ + _inner_class_types = { + "checks": Checks, + "three_d_secure": ThreeDSecure, + "wallet": Wallet, + } + + class CardPresent(StripeObject): + generated_card: Optional[ExpandableField["PaymentMethod"]] + """ + The ID of the Card PaymentMethod which was generated by this SetupAttempt. + """ + + class Cashapp(StripeObject): + pass + + class Ideal(StripeObject): + bank: Optional[ + Literal[ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ] + ] + """ + The customer's bank. Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. + """ + bic: Optional[ + Literal[ + "ABNANL2A", + "ASNBNL21", + "BITSNL2A", + "BUNQNL2A", + "FVLBNL22", + "HANDNL2A", + "INGBNL2A", + "KNABNL2H", + "MOYONL21", + "NTSBDEB1", + "RABONL2U", + "RBRBNL21", + "REVOIE23", + "REVOLT21", + "SNSBNL2A", + "TRIONL2U", + ] + ] + """ + The Bank Identifier Code of the customer's bank. + """ + generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]] + """ + The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt. + """ + generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]] + """ + The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt. + """ + iban_last4: Optional[str] + """ + Last four characters of the IBAN. + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by iDEAL directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + + class Klarna(StripeObject): + pass + + class Link(StripeObject): + pass + + class Paypal(StripeObject): + pass + + class SepaDebit(StripeObject): + pass + + class Sofort(StripeObject): + bank_code: Optional[str] + """ + Bank code of bank associated with the bank account. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + bic: Optional[str] + """ + Bank Identifier Code of the bank associated with the bank account. + """ + generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]] + """ + The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt. + """ + generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]] + """ + The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt. + """ + iban_last4: Optional[str] + """ + Last four characters of the IBAN. + """ + preferred_language: Optional[Literal["de", "en", "fr", "nl"]] + """ + Preferred language of the Sofort authorization page that the customer is redirected to. + Can be one of `en`, `de`, `fr`, or `nl` + """ + verified_name: Optional[str] + """ + Owner's verified full name. Values are verified or provided by Sofort directly + (if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + + class UsBankAccount(StripeObject): + pass + + acss_debit: Optional[AcssDebit] + au_becs_debit: Optional[AuBecsDebit] + bacs_debit: Optional[BacsDebit] + bancontact: Optional[Bancontact] + boleto: Optional[Boleto] + card: Optional[Card] + card_present: Optional[CardPresent] + cashapp: Optional[Cashapp] + ideal: Optional[Ideal] + klarna: Optional[Klarna] + link: Optional[Link] + paypal: Optional[Paypal] + sepa_debit: Optional[SepaDebit] + sofort: Optional[Sofort] + type: str + """ + The type of the payment method used in the SetupIntent (e.g., `card`). An additional hash is included on `payment_method_details` with a name matching this value. It contains confirmation-specific information for the payment method. + """ + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "acss_debit": AcssDebit, + "au_becs_debit": AuBecsDebit, + "bacs_debit": BacsDebit, + "bancontact": Bancontact, + "boleto": Boleto, + "card": Card, + "card_present": CardPresent, + "cashapp": Cashapp, + "ideal": Ideal, + "klarna": Klarna, + "link": Link, + "paypal": Paypal, + "sepa_debit": SepaDebit, + "sofort": Sofort, + "us_bank_account": UsBankAccount, + } + + class SetupError(StripeObject): + charge: Optional[str] + """ + For card errors, the ID of the failed charge. + """ + code: Optional[ + Literal[ + "account_closed", + "account_country_invalid_address", + "account_error_country_change_requires_additional_steps", + "account_information_mismatch", + "account_invalid", + "account_number_invalid", + "acss_debit_session_incomplete", + "alipay_upgrade_required", + "amount_too_large", + "amount_too_small", + "api_key_expired", + "application_fees_not_allowed", + "authentication_required", + "balance_insufficient", + "bank_account_bad_routing_numbers", + "bank_account_declined", + "bank_account_exists", + "bank_account_restricted", + "bank_account_unusable", + "bank_account_unverified", + "bank_account_verification_failed", + "billing_invalid_mandate", + "bitcoin_upgrade_required", + "capture_charge_authorization_expired", + "capture_unauthorized_payment", + "card_decline_rate_limit_exceeded", + "card_declined", + "cardholder_phone_number_required", + "charge_already_captured", + "charge_already_refunded", + "charge_disputed", + "charge_exceeds_source_limit", + "charge_expired_for_capture", + "charge_invalid_parameter", + "charge_not_refundable", + "clearing_code_unsupported", + "country_code_invalid", + "country_unsupported", + "coupon_expired", + "customer_max_payment_methods", + "customer_max_subscriptions", + "debit_not_authorized", + "email_invalid", + "expired_card", + "idempotency_key_in_use", + "incorrect_address", + "incorrect_cvc", + "incorrect_number", + "incorrect_zip", + "instant_payouts_config_disabled", + "instant_payouts_currency_disabled", + "instant_payouts_limit_exceeded", + "instant_payouts_unsupported", + "insufficient_funds", + "intent_invalid_state", + "intent_verification_method_missing", + "invalid_card_type", + "invalid_characters", + "invalid_charge_amount", + "invalid_cvc", + "invalid_expiry_month", + "invalid_expiry_year", + "invalid_number", + "invalid_source_usage", + "invalid_tax_location", + "invoice_no_customer_line_items", + "invoice_no_payment_method_types", + "invoice_no_subscription_line_items", + "invoice_not_editable", + "invoice_on_behalf_of_not_editable", + "invoice_payment_intent_requires_action", + "invoice_upcoming_none", + "livemode_mismatch", + "lock_timeout", + "missing", + "no_account", + "not_allowed_on_standard_account", + "out_of_inventory", + "ownership_declaration_not_allowed", + "parameter_invalid_empty", + "parameter_invalid_integer", + "parameter_invalid_string_blank", + "parameter_invalid_string_empty", + "parameter_missing", + "parameter_unknown", + "parameters_exclusive", + "payment_intent_action_required", + "payment_intent_authentication_failure", + "payment_intent_incompatible_payment_method", + "payment_intent_invalid_parameter", + "payment_intent_konbini_rejected_confirmation_number", + "payment_intent_mandate_invalid", + "payment_intent_payment_attempt_expired", + "payment_intent_payment_attempt_failed", + "payment_intent_unexpected_state", + "payment_method_bank_account_already_verified", + "payment_method_bank_account_blocked", + "payment_method_billing_details_address_missing", + "payment_method_configuration_failures", + "payment_method_currency_mismatch", + "payment_method_customer_decline", + "payment_method_invalid_parameter", + "payment_method_invalid_parameter_testmode", + "payment_method_microdeposit_failed", + "payment_method_microdeposit_verification_amounts_invalid", + "payment_method_microdeposit_verification_amounts_mismatch", + "payment_method_microdeposit_verification_attempts_exceeded", + "payment_method_microdeposit_verification_descriptor_code_mismatch", + "payment_method_microdeposit_verification_timeout", + "payment_method_not_available", + "payment_method_provider_decline", + "payment_method_provider_timeout", + "payment_method_unactivated", + "payment_method_unexpected_state", + "payment_method_unsupported_type", + "payout_reconciliation_not_ready", + "payouts_limit_exceeded", + "payouts_not_allowed", + "platform_account_required", + "platform_api_key_expired", + "postal_code_invalid", + "processing_error", + "product_inactive", + "progressive_onboarding_limit_exceeded", + "rate_limit", + "refer_to_customer", + "refund_disputed_payment", + "resource_already_exists", + "resource_missing", + "return_intent_already_processed", + "routing_number_invalid", + "secret_key_required", + "sepa_unsupported_account", + "setup_attempt_failed", + "setup_intent_authentication_failure", + "setup_intent_invalid_parameter", + "setup_intent_mandate_invalid", + "setup_intent_setup_attempt_expired", + "setup_intent_unexpected_state", + "shipping_calculation_failed", + "sku_inactive", + "state_unsupported", + "status_transition_invalid", + "stripe_tax_inactive", + "tax_id_invalid", + "taxes_calculation_failed", + "terminal_location_country_unsupported", + "terminal_reader_busy", + "terminal_reader_offline", + "terminal_reader_timeout", + "testmode_charges_only", + "tls_version_unsupported", + "token_already_used", + "token_in_use", + "transfer_source_balance_parameters_mismatch", + "transfers_not_allowed", + "url_invalid", + ] + ] + """ + For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported. + """ + decline_code: Optional[str] + """ + For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one. + """ + doc_url: Optional[str] + """ + A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported. + """ + message: Optional[str] + """ + A human-readable message providing more details about the error. For card errors, these messages can be shown to your users. + """ + param: Optional[str] + """ + If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. + """ + payment_intent: Optional["PaymentIntent"] + """ + A PaymentIntent guides you through the process of collecting a payment from your customer. + We recommend that you create exactly one PaymentIntent for each order or + customer session in your system. You can reference the PaymentIntent later to + see the history of payment attempts for a particular session. + + A PaymentIntent transitions through + [multiple statuses](https://stripe.com/docs/payments/intents#intent-statuses) + throughout its lifetime as it interfaces with Stripe.js to perform + authentication flows and ultimately creates at most one successful charge. + + Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents) + """ + payment_method: Optional["PaymentMethod"] + """ + PaymentMethod objects represent your customer's payment instruments. + You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to + Customer objects to store instrument details for future payments. + + Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios). + """ + payment_method_type: Optional[str] + """ + If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors. + """ + request_log_url: Optional[str] + """ + A URL to the request log entry in your dashboard. + """ + setup_intent: Optional["SetupIntent"] + """ + A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments. + For example, you can use a SetupIntent to set up and save your customer's card without immediately collecting a payment. + Later, you can use [PaymentIntents](https://stripe.com/docs/api#payment_intents) to drive the payment flow. + + Create a SetupIntent when you're ready to collect your customer's payment credentials. + Don't maintain long-lived, unconfirmed SetupIntents because they might not be valid. + The SetupIntent transitions through multiple [statuses](https://stripe.com/docs/payments/intents#intent-statuses) as it guides + you through the setup process. + + Successful SetupIntents result in payment credentials that are optimized for future payments. + For example, cardholders in [certain regions](https://stripe.com/guides/strong-customer-authentication) might need to be run through + [Strong Customer Authentication](https://stripe.com/docs/strong-customer-authentication) during payment method collection + to streamline later [off-session payments](https://stripe.com/docs/payments/setup-intents). + If you use the SetupIntent with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer), + it automatically attaches the resulting payment method to that Customer after successful setup. + We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on + PaymentIntents to save payment methods to prevent saving invalid or unoptimized payment methods. + + By using SetupIntents, you can reduce friction for your customers, even as regulations change over time. + + Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents) + """ + source: Optional[ + Union["Account", "BankAccount", "CardResource", "Source"] + ] + type: Literal[ + "api_error", + "card_error", + "idempotency_error", + "invalid_request_error", + ] + """ + The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error` + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -124,8 +730,8 @@ class ListParamsCreated(TypedDict): """ ID of the payment method used with this SetupAttempt. """ - payment_method_details: StripeObject - setup_error: Optional[StripeObject] + payment_method_details: PaymentMethodDetails + setup_error: Optional[SetupError] """ The error encountered during this attempt to confirm the SetupIntent, if any. """ @@ -166,3 +772,8 @@ def list( ) return result + + _inner_class_types = { + "payment_method_details": PaymentMethodDetails, + "setup_error": SetupError, + } diff --git a/stripe/api_resources/setup_intent.py b/stripe/api_resources/setup_intent.py index bdda72bfc..41d816a58 100644 --- a/stripe/api_resources/setup_intent.py +++ b/stripe/api_resources/setup_intent.py @@ -11,7 +11,7 @@ from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject from stripe.util import class_method_variant -from typing import ClassVar, Dict, List, Optional, cast, overload +from typing import Any, ClassVar, Dict, List, Optional, Union, cast, overload from typing_extensions import ( Literal, NotRequired, @@ -24,10 +24,14 @@ if TYPE_CHECKING: from stripe.api_resources.account import Account from stripe.api_resources.application import Application + from stripe.api_resources.bank_account import BankAccount + from stripe.api_resources.card import Card as CardResource from stripe.api_resources.customer import Customer from stripe.api_resources.mandate import Mandate + from stripe.api_resources.payment_intent import PaymentIntent from stripe.api_resources.payment_method import PaymentMethod from stripe.api_resources.setup_attempt import SetupAttempt + from stripe.api_resources.source import Source class SetupIntent( @@ -60,6 +64,532 @@ class SetupIntent( """ OBJECT_NAME: ClassVar[Literal["setup_intent"]] = "setup_intent" + + class AutomaticPaymentMethods(StripeObject): + allow_redirects: Optional[Literal["always", "never"]] + """ + Controls whether this SetupIntent will accept redirect-based payment methods. + + Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps. To [confirm](https://stripe.com/docs/api/setup_intents/confirm) this SetupIntent, you may be required to provide a `return_url` to redirect customers back to your site after they authenticate or complete the setup. + """ + enabled: Optional[bool] + """ + Automatically calculates compatible payment methods + """ + + class LastSetupError(StripeObject): + charge: Optional[str] + """ + For card errors, the ID of the failed charge. + """ + code: Optional[ + Literal[ + "account_closed", + "account_country_invalid_address", + "account_error_country_change_requires_additional_steps", + "account_information_mismatch", + "account_invalid", + "account_number_invalid", + "acss_debit_session_incomplete", + "alipay_upgrade_required", + "amount_too_large", + "amount_too_small", + "api_key_expired", + "application_fees_not_allowed", + "authentication_required", + "balance_insufficient", + "bank_account_bad_routing_numbers", + "bank_account_declined", + "bank_account_exists", + "bank_account_restricted", + "bank_account_unusable", + "bank_account_unverified", + "bank_account_verification_failed", + "billing_invalid_mandate", + "bitcoin_upgrade_required", + "capture_charge_authorization_expired", + "capture_unauthorized_payment", + "card_decline_rate_limit_exceeded", + "card_declined", + "cardholder_phone_number_required", + "charge_already_captured", + "charge_already_refunded", + "charge_disputed", + "charge_exceeds_source_limit", + "charge_expired_for_capture", + "charge_invalid_parameter", + "charge_not_refundable", + "clearing_code_unsupported", + "country_code_invalid", + "country_unsupported", + "coupon_expired", + "customer_max_payment_methods", + "customer_max_subscriptions", + "debit_not_authorized", + "email_invalid", + "expired_card", + "idempotency_key_in_use", + "incorrect_address", + "incorrect_cvc", + "incorrect_number", + "incorrect_zip", + "instant_payouts_config_disabled", + "instant_payouts_currency_disabled", + "instant_payouts_limit_exceeded", + "instant_payouts_unsupported", + "insufficient_funds", + "intent_invalid_state", + "intent_verification_method_missing", + "invalid_card_type", + "invalid_characters", + "invalid_charge_amount", + "invalid_cvc", + "invalid_expiry_month", + "invalid_expiry_year", + "invalid_number", + "invalid_source_usage", + "invalid_tax_location", + "invoice_no_customer_line_items", + "invoice_no_payment_method_types", + "invoice_no_subscription_line_items", + "invoice_not_editable", + "invoice_on_behalf_of_not_editable", + "invoice_payment_intent_requires_action", + "invoice_upcoming_none", + "livemode_mismatch", + "lock_timeout", + "missing", + "no_account", + "not_allowed_on_standard_account", + "out_of_inventory", + "ownership_declaration_not_allowed", + "parameter_invalid_empty", + "parameter_invalid_integer", + "parameter_invalid_string_blank", + "parameter_invalid_string_empty", + "parameter_missing", + "parameter_unknown", + "parameters_exclusive", + "payment_intent_action_required", + "payment_intent_authentication_failure", + "payment_intent_incompatible_payment_method", + "payment_intent_invalid_parameter", + "payment_intent_konbini_rejected_confirmation_number", + "payment_intent_mandate_invalid", + "payment_intent_payment_attempt_expired", + "payment_intent_payment_attempt_failed", + "payment_intent_unexpected_state", + "payment_method_bank_account_already_verified", + "payment_method_bank_account_blocked", + "payment_method_billing_details_address_missing", + "payment_method_configuration_failures", + "payment_method_currency_mismatch", + "payment_method_customer_decline", + "payment_method_invalid_parameter", + "payment_method_invalid_parameter_testmode", + "payment_method_microdeposit_failed", + "payment_method_microdeposit_verification_amounts_invalid", + "payment_method_microdeposit_verification_amounts_mismatch", + "payment_method_microdeposit_verification_attempts_exceeded", + "payment_method_microdeposit_verification_descriptor_code_mismatch", + "payment_method_microdeposit_verification_timeout", + "payment_method_not_available", + "payment_method_provider_decline", + "payment_method_provider_timeout", + "payment_method_unactivated", + "payment_method_unexpected_state", + "payment_method_unsupported_type", + "payout_reconciliation_not_ready", + "payouts_limit_exceeded", + "payouts_not_allowed", + "platform_account_required", + "platform_api_key_expired", + "postal_code_invalid", + "processing_error", + "product_inactive", + "progressive_onboarding_limit_exceeded", + "rate_limit", + "refer_to_customer", + "refund_disputed_payment", + "resource_already_exists", + "resource_missing", + "return_intent_already_processed", + "routing_number_invalid", + "secret_key_required", + "sepa_unsupported_account", + "setup_attempt_failed", + "setup_intent_authentication_failure", + "setup_intent_invalid_parameter", + "setup_intent_mandate_invalid", + "setup_intent_setup_attempt_expired", + "setup_intent_unexpected_state", + "shipping_calculation_failed", + "sku_inactive", + "state_unsupported", + "status_transition_invalid", + "stripe_tax_inactive", + "tax_id_invalid", + "taxes_calculation_failed", + "terminal_location_country_unsupported", + "terminal_reader_busy", + "terminal_reader_offline", + "terminal_reader_timeout", + "testmode_charges_only", + "tls_version_unsupported", + "token_already_used", + "token_in_use", + "transfer_source_balance_parameters_mismatch", + "transfers_not_allowed", + "url_invalid", + ] + ] + """ + For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported. + """ + decline_code: Optional[str] + """ + For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one. + """ + doc_url: Optional[str] + """ + A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported. + """ + message: Optional[str] + """ + A human-readable message providing more details about the error. For card errors, these messages can be shown to your users. + """ + param: Optional[str] + """ + If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. + """ + payment_intent: Optional["PaymentIntent"] + """ + A PaymentIntent guides you through the process of collecting a payment from your customer. + We recommend that you create exactly one PaymentIntent for each order or + customer session in your system. You can reference the PaymentIntent later to + see the history of payment attempts for a particular session. + + A PaymentIntent transitions through + [multiple statuses](https://stripe.com/docs/payments/intents#intent-statuses) + throughout its lifetime as it interfaces with Stripe.js to perform + authentication flows and ultimately creates at most one successful charge. + + Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents) + """ + payment_method: Optional["PaymentMethod"] + """ + PaymentMethod objects represent your customer's payment instruments. + You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to + Customer objects to store instrument details for future payments. + + Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios). + """ + payment_method_type: Optional[str] + """ + If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors. + """ + request_log_url: Optional[str] + """ + A URL to the request log entry in your dashboard. + """ + setup_intent: Optional["SetupIntent"] + """ + A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments. + For example, you can use a SetupIntent to set up and save your customer's card without immediately collecting a payment. + Later, you can use [PaymentIntents](https://stripe.com/docs/api#payment_intents) to drive the payment flow. + + Create a SetupIntent when you're ready to collect your customer's payment credentials. + Don't maintain long-lived, unconfirmed SetupIntents because they might not be valid. + The SetupIntent transitions through multiple [statuses](https://stripe.com/docs/payments/intents#intent-statuses) as it guides + you through the setup process. + + Successful SetupIntents result in payment credentials that are optimized for future payments. + For example, cardholders in [certain regions](https://stripe.com/guides/strong-customer-authentication) might need to be run through + [Strong Customer Authentication](https://stripe.com/docs/strong-customer-authentication) during payment method collection + to streamline later [off-session payments](https://stripe.com/docs/payments/setup-intents). + If you use the SetupIntent with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer), + it automatically attaches the resulting payment method to that Customer after successful setup. + We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on + PaymentIntents to save payment methods to prevent saving invalid or unoptimized payment methods. + + By using SetupIntents, you can reduce friction for your customers, even as regulations change over time. + + Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents) + """ + source: Optional[ + Union["Account", "BankAccount", "CardResource", "Source"] + ] + type: Literal[ + "api_error", + "card_error", + "idempotency_error", + "invalid_request_error", + ] + """ + The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error` + """ + + class NextAction(StripeObject): + class CashappHandleRedirectOrDisplayQrCode(StripeObject): + class QrCode(StripeObject): + expires_at: int + """ + The date (unix timestamp) when the QR code expires. + """ + image_url_png: str + """ + The image_url_png string used to render QR code + """ + image_url_svg: str + """ + The image_url_svg string used to render QR code + """ + + hosted_instructions_url: str + """ + The URL to the hosted Cash App Pay instructions page, which allows customers to view the QR code, and supports QR code refreshing on expiration. + """ + mobile_auth_url: str + """ + The url for mobile redirect based auth + """ + qr_code: QrCode + _inner_class_types = {"qr_code": QrCode} + + class RedirectToUrl(StripeObject): + return_url: Optional[str] + """ + If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. + """ + url: Optional[str] + """ + The URL you must redirect your customer to in order to authenticate. + """ + + class VerifyWithMicrodeposits(StripeObject): + arrival_date: int + """ + The timestamp when the microdeposits are expected to land. + """ + hosted_verification_url: str + """ + The URL for the hosted verification page, which allows customers to verify their bank account. + """ + microdeposit_type: Optional[Literal["amounts", "descriptor_code"]] + """ + The type of the microdeposit sent to the customer. Used to distinguish between different verification methods. + """ + + cashapp_handle_redirect_or_display_qr_code: Optional[ + CashappHandleRedirectOrDisplayQrCode + ] + redirect_to_url: Optional[RedirectToUrl] + type: str + """ + Type of the next action to perform, one of `redirect_to_url`, `use_stripe_sdk`, `alipay_handle_redirect`, `oxxo_display_details`, or `verify_with_microdeposits`. + """ + use_stripe_sdk: Optional[Dict[str, Any]] + """ + When confirming a SetupIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js. + """ + verify_with_microdeposits: Optional[VerifyWithMicrodeposits] + _inner_class_types = { + "cashapp_handle_redirect_or_display_qr_code": CashappHandleRedirectOrDisplayQrCode, + "redirect_to_url": RedirectToUrl, + "verify_with_microdeposits": VerifyWithMicrodeposits, + } + + class PaymentMethodConfigurationDetails(StripeObject): + id: str + """ + ID of the payment method configuration used. + """ + parent: Optional[str] + """ + ID of the parent payment method configuration used. + """ + + class PaymentMethodOptions(StripeObject): + class AcssDebit(StripeObject): + class MandateOptions(StripeObject): + custom_mandate_url: Optional[str] + """ + A URL for custom mandate text + """ + default_for: Optional[List[Literal["invoice", "subscription"]]] + """ + List of Stripe products where this mandate can be selected automatically. + """ + interval_description: Optional[str] + """ + Description of the interval. Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. + """ + payment_schedule: Optional[ + Literal["combined", "interval", "sporadic"] + ] + """ + Payment schedule for the mandate. + """ + transaction_type: Optional[Literal["business", "personal"]] + """ + Transaction type of the mandate. + """ + + currency: Optional[Literal["cad", "usd"]] + """ + Currency supported by the bank account + """ + mandate_options: Optional[MandateOptions] + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = {"mandate_options": MandateOptions} + + class Card(StripeObject): + class MandateOptions(StripeObject): + amount: int + """ + Amount to be charged for future payments. + """ + amount_type: Literal["fixed", "maximum"] + """ + One of `fixed` or `maximum`. If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. If `maximum`, the amount charged can be up to the value passed for the `amount` param. + """ + 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). + """ + description: Optional[str] + """ + A description of the mandate or subscription that is meant to be displayed to the customer. + """ + end_date: Optional[int] + """ + End date of the mandate or subscription. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + interval: Literal["day", "month", "sporadic", "week", "year"] + """ + Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. + """ + interval_count: Optional[int] + """ + The number of intervals between payments. For example, `interval=month` and `interval_count=3` indicates one payment every three months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). This parameter is optional when `interval=sporadic`. + """ + reference: str + """ + Unique identifier for the mandate or subscription. + """ + start_date: int + """ + Start date of the mandate or subscription. Start date should not be lesser than yesterday. + """ + supported_types: Optional[List[Literal["india"]]] + """ + Specifies the type of mandates supported. Possible values are `india`. + """ + + mandate_options: Optional[MandateOptions] + """ + Configuration options for setting up an eMandate for cards issued in India. + """ + network: Optional[ + Literal[ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "interac", + "jcb", + "mastercard", + "unionpay", + "unknown", + "visa", + ] + ] + """ + Selected network to process this SetupIntent on. Depends on the available networks of the card attached to the setup intent. Can be only set confirm-time. + """ + request_three_d_secure: Optional[ + Literal["any", "automatic", "challenge_only"] + ] + """ + We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: `automatic` or `any`. If not provided, defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + """ + _inner_class_types = {"mandate_options": MandateOptions} + + class Link(StripeObject): + persistent_token: Optional[str] + """ + [Deprecated] This is a legacy parameter that no longer has any function. + """ + + class Paypal(StripeObject): + billing_agreement_id: Optional[str] + """ + The PayPal Billing Agreement ID (BAID). This is an ID generated by PayPal which represents the mandate between the merchant and the customer. + """ + + class SepaDebit(StripeObject): + class MandateOptions(StripeObject): + pass + + mandate_options: Optional[MandateOptions] + _inner_class_types = {"mandate_options": MandateOptions} + + class UsBankAccount(StripeObject): + class FinancialConnections(StripeObject): + permissions: Optional[ + List[ + Literal[ + "balances", + "ownership", + "payment_method", + "transactions", + ] + ] + ] + """ + The list of permissions to request. The `payment_method` permission must be included. + """ + prefetch: Optional[List[Literal["balances"]]] + """ + Data features requested to be retrieved upon account creation. + """ + return_url: Optional[str] + """ + For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. + """ + + financial_connections: Optional[FinancialConnections] + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = { + "financial_connections": FinancialConnections + } + + acss_debit: Optional[AcssDebit] + card: Optional[Card] + link: Optional[Link] + paypal: Optional[Paypal] + sepa_debit: Optional[SepaDebit] + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "acss_debit": AcssDebit, + "card": Card, + "link": Link, + "paypal": Paypal, + "sepa_debit": SepaDebit, + "us_bank_account": UsBankAccount, + } + if TYPE_CHECKING: class CancelParams(RequestOptions): @@ -2680,7 +3210,7 @@ class VerifyMicrodepositsParams(RequestOptions): It can only be used for this Stripe Account's own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer. """ - automatic_payment_methods: Optional[StripeObject] + automatic_payment_methods: Optional[AutomaticPaymentMethods] """ Settings for dynamic payment methods compatible with this Setup Intent """ @@ -2720,7 +3250,7 @@ class VerifyMicrodepositsParams(RequestOptions): """ Unique identifier for the object. """ - last_setup_error: Optional[StripeObject] + last_setup_error: Optional[LastSetupError] """ The error encountered in the previous SetupIntent confirmation. """ @@ -2740,7 +3270,7 @@ class VerifyMicrodepositsParams(RequestOptions): """ 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. """ - next_action: Optional[StripeObject] + next_action: Optional[NextAction] """ If present, this property tells you what actions you need to take in order for your customer to continue payment setup. """ @@ -2756,11 +3286,13 @@ class VerifyMicrodepositsParams(RequestOptions): """ ID of the payment method used with this SetupIntent. """ - payment_method_configuration_details: Optional[StripeObject] + payment_method_configuration_details: Optional[ + PaymentMethodConfigurationDetails + ] """ Information about the payment method configuration used for this Setup Intent. """ - payment_method_options: Optional[StripeObject] + payment_method_options: Optional[PaymentMethodOptions] """ Payment method-specific configuration for this SetupIntent. """ @@ -3037,3 +3569,11 @@ def verify_microdeposits( # pyright: ignore[reportGeneralTypeIssues] params=params, ), ) + + _inner_class_types = { + "automatic_payment_methods": AutomaticPaymentMethods, + "last_setup_error": LastSetupError, + "next_action": NextAction, + "payment_method_configuration_details": PaymentMethodConfigurationDetails, + "payment_method_options": PaymentMethodOptions, + } diff --git a/stripe/api_resources/shipping_rate.py b/stripe/api_resources/shipping_rate.py index 42859aecc..44026f3f2 100644 --- a/stripe/api_resources/shipping_rate.py +++ b/stripe/api_resources/shipping_rate.py @@ -34,6 +34,64 @@ class ShippingRate( """ OBJECT_NAME: ClassVar[Literal["shipping_rate"]] = "shipping_rate" + + class DeliveryEstimate(StripeObject): + class Maximum(StripeObject): + unit: Literal["business_day", "day", "hour", "month", "week"] + """ + A unit of time. + """ + value: int + """ + Must be greater than 0. + """ + + class Minimum(StripeObject): + unit: Literal["business_day", "day", "hour", "month", "week"] + """ + A unit of time. + """ + value: int + """ + Must be greater than 0. + """ + + maximum: Optional[Maximum] + """ + The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. + """ + minimum: Optional[Minimum] + """ + The lower bound of the estimated range. If empty, represents no lower bound. + """ + _inner_class_types = {"maximum": Maximum, "minimum": Minimum} + + class FixedAmount(StripeObject): + class CurrencyOptions(StripeObject): + amount: int + """ + A non-negative integer in cents representing how much to charge. + """ + tax_behavior: Literal["exclusive", "inclusive", "unspecified"] + """ + Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. + """ + + amount: int + """ + A non-negative integer in cents representing how much to charge. + """ + 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). + """ + currency_options: Optional[Dict[str, CurrencyOptions]] + """ + Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + """ + _inner_class_types = {"currency_options": CurrencyOptions} + _inner_class_dicts = ["currency_options"] + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -246,7 +304,7 @@ class RetrieveParams(RequestOptions): """ Time at which the object was created. Measured in seconds since the Unix epoch. """ - delivery_estimate: Optional[StripeObject] + delivery_estimate: Optional[DeliveryEstimate] """ The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions. """ @@ -254,7 +312,7 @@ class RetrieveParams(RequestOptions): """ The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. """ - fixed_amount: Optional[StripeObject] + fixed_amount: Optional[FixedAmount] id: str """ Unique identifier for the object. @@ -348,3 +406,8 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "delivery_estimate": DeliveryEstimate, + "fixed_amount": FixedAmount, + } diff --git a/stripe/api_resources/sigma/scheduled_query_run.py b/stripe/api_resources/sigma/scheduled_query_run.py index a1ebac5ca..ecf68721d 100644 --- a/stripe/api_resources/sigma/scheduled_query_run.py +++ b/stripe/api_resources/sigma/scheduled_query_run.py @@ -22,6 +22,13 @@ class ScheduledQueryRun(ListableAPIResource["ScheduledQueryRun"]): OBJECT_NAME: ClassVar[ Literal["scheduled_query_run"] ] = "scheduled_query_run" + + class Error(StripeObject): + message: str + """ + Information about the run failure. + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -56,7 +63,7 @@ class RetrieveParams(RequestOptions): """ When the query was run, Sigma contained a snapshot of your Stripe data at this time. """ - error: Optional[StripeObject] + error: Optional[Error] file: Optional["File"] """ The file object representing the results of the query. @@ -126,3 +133,5 @@ def retrieve( @classmethod def class_url(cls): return "/v1/sigma/scheduled_query_runs" + + _inner_class_types = {"error": Error} diff --git a/stripe/api_resources/source.py b/stripe/api_resources/source.py index 7590f65dc..95d29cab9 100644 --- a/stripe/api_resources/source.py +++ b/stripe/api_resources/source.py @@ -39,6 +39,455 @@ class Source(CreateableAPIResource["Source"], UpdateableAPIResource["Source"]): """ OBJECT_NAME: ClassVar[Literal["source"]] = "source" + + class AchCreditTransfer(StripeObject): + account_number: Optional[str] + bank_name: Optional[str] + fingerprint: Optional[str] + refund_account_holder_name: Optional[str] + refund_account_holder_type: Optional[str] + refund_routing_number: Optional[str] + routing_number: Optional[str] + swift_code: Optional[str] + + class AchDebit(StripeObject): + bank_name: Optional[str] + country: Optional[str] + fingerprint: Optional[str] + last4: Optional[str] + routing_number: Optional[str] + type: Optional[str] + + class AcssDebit(StripeObject): + bank_address_city: Optional[str] + bank_address_line_1: Optional[str] + bank_address_line_2: Optional[str] + bank_address_postal_code: Optional[str] + bank_name: Optional[str] + category: Optional[str] + country: Optional[str] + fingerprint: Optional[str] + last4: Optional[str] + routing_number: Optional[str] + + class Alipay(StripeObject): + data_string: Optional[str] + native_url: Optional[str] + statement_descriptor: Optional[str] + + class AuBecsDebit(StripeObject): + bsb_number: Optional[str] + fingerprint: Optional[str] + last4: Optional[str] + + class Bancontact(StripeObject): + bank_code: Optional[str] + bank_name: Optional[str] + bic: Optional[str] + iban_last4: Optional[str] + preferred_language: Optional[str] + statement_descriptor: Optional[str] + + class Card(StripeObject): + address_line1_check: Optional[str] + address_zip_check: Optional[str] + brand: Optional[str] + country: Optional[str] + cvc_check: Optional[str] + description: Optional[str] + dynamic_last4: Optional[str] + exp_month: Optional[int] + exp_year: Optional[int] + fingerprint: Optional[str] + funding: Optional[str] + iin: Optional[str] + issuer: Optional[str] + last4: Optional[str] + name: Optional[str] + three_d_secure: Optional[str] + tokenization_method: Optional[str] + + class CardPresent(StripeObject): + application_cryptogram: Optional[str] + application_preferred_name: Optional[str] + authorization_code: Optional[str] + authorization_response_code: Optional[str] + brand: Optional[str] + country: Optional[str] + cvm_type: Optional[str] + data_type: Optional[str] + dedicated_file_name: Optional[str] + description: Optional[str] + emv_auth_data: Optional[str] + evidence_customer_signature: Optional[str] + evidence_transaction_certificate: Optional[str] + exp_month: Optional[int] + exp_year: Optional[int] + fingerprint: Optional[str] + funding: Optional[str] + iin: Optional[str] + issuer: Optional[str] + last4: Optional[str] + pos_device_id: Optional[str] + pos_entry_mode: Optional[str] + read_method: Optional[str] + reader: Optional[str] + terminal_verification_results: Optional[str] + transaction_status_information: Optional[str] + + class CodeVerification(StripeObject): + attempts_remaining: int + """ + The number of attempts remaining to authenticate the source object with a verification code. + """ + status: str + """ + The status of the code verification, either `pending` (awaiting verification, `attempts_remaining` should be greater than 0), `succeeded` (successful verification) or `failed` (failed verification, cannot be verified anymore as `attempts_remaining` should be 0). + """ + + class Eps(StripeObject): + reference: Optional[str] + statement_descriptor: Optional[str] + + class Giropay(StripeObject): + bank_code: Optional[str] + bank_name: Optional[str] + bic: Optional[str] + statement_descriptor: Optional[str] + + class Ideal(StripeObject): + bank: Optional[str] + bic: Optional[str] + iban_last4: Optional[str] + statement_descriptor: Optional[str] + + class Klarna(StripeObject): + background_image_url: Optional[str] + client_token: Optional[str] + first_name: Optional[str] + last_name: Optional[str] + locale: Optional[str] + logo_url: Optional[str] + page_title: Optional[str] + pay_later_asset_urls_descriptive: Optional[str] + pay_later_asset_urls_standard: Optional[str] + pay_later_name: Optional[str] + pay_later_redirect_url: Optional[str] + pay_now_asset_urls_descriptive: Optional[str] + pay_now_asset_urls_standard: Optional[str] + pay_now_name: Optional[str] + pay_now_redirect_url: Optional[str] + pay_over_time_asset_urls_descriptive: Optional[str] + pay_over_time_asset_urls_standard: Optional[str] + pay_over_time_name: Optional[str] + pay_over_time_redirect_url: Optional[str] + payment_method_categories: Optional[str] + purchase_country: Optional[str] + purchase_type: Optional[str] + redirect_url: Optional[str] + shipping_delay: Optional[int] + shipping_first_name: Optional[str] + shipping_last_name: Optional[str] + + class Multibanco(StripeObject): + entity: Optional[str] + reference: Optional[str] + refund_account_holder_address_city: Optional[str] + refund_account_holder_address_country: Optional[str] + refund_account_holder_address_line1: Optional[str] + refund_account_holder_address_line2: Optional[str] + refund_account_holder_address_postal_code: Optional[str] + refund_account_holder_address_state: Optional[str] + refund_account_holder_name: Optional[str] + refund_iban: Optional[str] + + class Owner(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + class VerifiedAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + """ + Owner's address. + """ + email: Optional[str] + """ + Owner's email address. + """ + name: Optional[str] + """ + Owner's full name. + """ + phone: Optional[str] + """ + Owner's phone number (including extension). + """ + verified_address: Optional[VerifiedAddress] + """ + Verified owner's address. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + verified_email: Optional[str] + """ + Verified owner's email address. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + verified_name: Optional[str] + """ + Verified owner's full name. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + verified_phone: Optional[str] + """ + Verified owner's phone number (including extension). Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. + """ + _inner_class_types = { + "address": Address, + "verified_address": VerifiedAddress, + } + + class P24(StripeObject): + reference: Optional[str] + + class Receiver(StripeObject): + address: Optional[str] + """ + The address of the receiver source. This is the value that should be communicated to the customer to send their funds to. + """ + amount_charged: int + """ + The total amount that was moved to your balance. This is almost always equal to the amount charged. In rare cases when customers deposit excess funds and we are unable to refund those, those funds get moved to your balance and show up in amount_charged as well. The amount charged is expressed in the source's currency. + """ + amount_received: int + """ + The total amount received by the receiver source. `amount_received = amount_returned + amount_charged` should be true for consumed sources unless customers deposit excess funds. The amount received is expressed in the source's currency. + """ + amount_returned: int + """ + The total amount that was returned to the customer. The amount returned is expressed in the source's currency. + """ + refund_attributes_method: str + """ + Type of refund attribute method, one of `email`, `manual`, or `none`. + """ + refund_attributes_status: str + """ + Type of refund attribute status, one of `missing`, `requested`, or `available`. + """ + + class Redirect(StripeObject): + failure_reason: Optional[str] + """ + The failure reason for the redirect, either `user_abort` (the customer aborted or dropped out of the redirect flow), `declined` (the authentication failed or the transaction was declined), or `processing_error` (the redirect failed due to a technical error). Present only if the redirect status is `failed`. + """ + return_url: str + """ + The URL you provide to redirect the customer to after they authenticated their payment. + """ + status: str + """ + The status of the redirect, either `pending` (ready to be used by your customer to authenticate the transaction), `succeeded` (succesful authentication, cannot be reused) or `not_required` (redirect should not be used) or `failed` (failed authentication, cannot be reused). + """ + url: str + """ + The URL provided to you to redirect a customer to as part of a `redirect` authentication flow. + """ + + class SepaCreditTransfer(StripeObject): + bank_name: Optional[str] + bic: Optional[str] + iban: Optional[str] + refund_account_holder_address_city: Optional[str] + refund_account_holder_address_country: Optional[str] + refund_account_holder_address_line1: Optional[str] + refund_account_holder_address_line2: Optional[str] + refund_account_holder_address_postal_code: Optional[str] + refund_account_holder_address_state: Optional[str] + refund_account_holder_name: Optional[str] + refund_iban: Optional[str] + + class SepaDebit(StripeObject): + bank_code: Optional[str] + branch_code: Optional[str] + country: Optional[str] + fingerprint: Optional[str] + last4: Optional[str] + mandate_reference: Optional[str] + mandate_url: Optional[str] + + class Sofort(StripeObject): + bank_code: Optional[str] + bank_name: Optional[str] + bic: Optional[str] + country: Optional[str] + iban_last4: Optional[str] + preferred_language: Optional[str] + statement_descriptor: Optional[str] + + class SourceOrder(StripeObject): + class Item(StripeObject): + amount: Optional[int] + """ + The amount (price) for this order item. + """ + currency: Optional[str] + """ + This currency of this order item. Required when `amount` is present. + """ + description: Optional[str] + """ + Human-readable description for this order item. + """ + parent: Optional[str] + """ + The ID of the associated object for this line item. Expandable if not null (e.g., expandable to a SKU). + """ + quantity: Optional[int] + """ + The quantity of this order item. When type is `sku`, this is the number of instances of the SKU to be ordered. + """ + type: Optional[str] + """ + The type of this order item. Must be `sku`, `tax`, or `shipping`. + """ + + class Shipping(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Optional[Address] + carrier: Optional[str] + """ + The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + """ + name: Optional[str] + """ + Recipient name. + """ + phone: Optional[str] + """ + Recipient phone (including extension). + """ + tracking_number: Optional[str] + """ + The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + """ + _inner_class_types = {"address": Address} + + amount: int + """ + A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order. + """ + 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). + """ + email: Optional[str] + """ + The email address of the customer placing the order. + """ + items: Optional[List[Item]] + """ + List of items constituting the order. + """ + shipping: Optional[Shipping] + _inner_class_types = {"items": Item, "shipping": Shipping} + + class ThreeDSecure(StripeObject): + address_line1_check: Optional[str] + address_zip_check: Optional[str] + authenticated: Optional[bool] + brand: Optional[str] + card: Optional[str] + country: Optional[str] + customer: Optional[str] + cvc_check: Optional[str] + description: Optional[str] + dynamic_last4: Optional[str] + exp_month: Optional[int] + exp_year: Optional[int] + fingerprint: Optional[str] + funding: Optional[str] + iin: Optional[str] + issuer: Optional[str] + last4: Optional[str] + name: Optional[str] + three_d_secure: Optional[str] + tokenization_method: Optional[str] + + class Wechat(StripeObject): + prepay_id: Optional[str] + qr_code_url: Optional[str] + statement_descriptor: Optional[str] + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -585,23 +1034,23 @@ class VerifyParams(RequestOptions): The values needed to verify the source. """ - ach_credit_transfer: Optional[StripeObject] - ach_debit: Optional[StripeObject] - acss_debit: Optional[StripeObject] - alipay: Optional[StripeObject] + ach_credit_transfer: Optional[AchCreditTransfer] + ach_debit: Optional[AchDebit] + acss_debit: Optional[AcssDebit] + alipay: Optional[Alipay] amount: Optional[int] """ A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for `single_use` sources. """ - au_becs_debit: Optional[StripeObject] - bancontact: Optional[StripeObject] - card: Optional[StripeObject] - card_present: Optional[StripeObject] + au_becs_debit: Optional[AuBecsDebit] + bancontact: Optional[Bancontact] + card: Optional[Card] + card_present: Optional[CardPresent] client_secret: str """ The client secret of the source. Used for client-side retrieval using a publishable key. """ - code_verification: Optional[StripeObject] + code_verification: Optional[CodeVerification] created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -614,18 +1063,18 @@ class VerifyParams(RequestOptions): """ The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer. """ - eps: Optional[StripeObject] + eps: Optional[Eps] flow: str """ The authentication `flow` of the source. `flow` is one of `redirect`, `receiver`, `code_verification`, `none`. """ - giropay: Optional[StripeObject] + giropay: Optional[Giropay] id: str """ Unique identifier for the object. """ - ideal: Optional[StripeObject] - klarna: Optional[StripeObject] + ideal: Optional[Ideal] + klarna: Optional[Klarna] livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -634,22 +1083,22 @@ class VerifyParams(RequestOptions): """ 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. """ - multibanco: Optional[StripeObject] + multibanco: Optional[Multibanco] object: Literal["source"] """ String representing the object's type. Objects of the same type share the same value. """ - owner: Optional[StripeObject] + owner: Optional[Owner] """ Information about the owner of the payment instrument that may be used or required by particular source types. """ - p24: Optional[StripeObject] - receiver: Optional[StripeObject] - redirect: Optional[StripeObject] - sepa_credit_transfer: Optional[StripeObject] - sepa_debit: Optional[StripeObject] - sofort: Optional[StripeObject] - source_order: Optional[StripeObject] + p24: Optional[P24] + receiver: Optional[Receiver] + redirect: Optional[Redirect] + sepa_credit_transfer: Optional[SepaCreditTransfer] + sepa_debit: Optional[SepaDebit] + sofort: Optional[Sofort] + source_order: Optional[SourceOrder] statement_descriptor: Optional[str] """ Extra information about a source. This will appear on your customer's statement every time you charge the source. @@ -658,7 +1107,7 @@ class VerifyParams(RequestOptions): """ The status of the source, one of `canceled`, `chargeable`, `consumed`, `failed`, or `pending`. Only `chargeable` sources can be used to create a charge. """ - three_d_secure: Optional[StripeObject] + three_d_secure: Optional[ThreeDSecure] type: Literal[ "ach_credit_transfer", "ach_debit", @@ -687,7 +1136,7 @@ class VerifyParams(RequestOptions): """ Either `reusable` or `single_use`. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned. """ - wechat: Optional[StripeObject] + wechat: Optional[Wechat] @classmethod def create( @@ -871,3 +1320,30 @@ def detach(self, idempotency_key=None, **params): "to a customer object." % token, "id", ) + + _inner_class_types = { + "ach_credit_transfer": AchCreditTransfer, + "ach_debit": AchDebit, + "acss_debit": AcssDebit, + "alipay": Alipay, + "au_becs_debit": AuBecsDebit, + "bancontact": Bancontact, + "card": Card, + "card_present": CardPresent, + "code_verification": CodeVerification, + "eps": Eps, + "giropay": Giropay, + "ideal": Ideal, + "klarna": Klarna, + "multibanco": Multibanco, + "owner": Owner, + "p24": P24, + "receiver": Receiver, + "redirect": Redirect, + "sepa_credit_transfer": SepaCreditTransfer, + "sepa_debit": SepaDebit, + "sofort": Sofort, + "source_order": SourceOrder, + "three_d_secure": ThreeDSecure, + "wechat": Wechat, + } diff --git a/stripe/api_resources/source_mandate_notification.py b/stripe/api_resources/source_mandate_notification.py index 08185ee7e..2f06c1099 100644 --- a/stripe/api_resources/source_mandate_notification.py +++ b/stripe/api_resources/source_mandate_notification.py @@ -18,12 +18,39 @@ class SourceMandateNotification(StripeObject): OBJECT_NAME: ClassVar[ Literal["source_mandate_notification"] ] = "source_mandate_notification" - acss_debit: Optional[StripeObject] + + class AcssDebit(StripeObject): + statement_descriptor: Optional[str] + """ + The statement descriptor associate with the debit. + """ + + class BacsDebit(StripeObject): + last4: Optional[str] + """ + Last 4 digits of the account number associated with the debit. + """ + + class SepaDebit(StripeObject): + creditor_identifier: Optional[str] + """ + SEPA creditor ID. + """ + last4: Optional[str] + """ + Last 4 digits of the account number associated with the debit. + """ + mandate_reference: Optional[str] + """ + Mandate reference associated with the debit. + """ + + acss_debit: Optional[AcssDebit] amount: Optional[int] """ A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the amount associated with the mandate notification. The amount is expressed in the currency of the underlying source. Required if the notification type is `debit_initiated`. """ - bacs_debit: Optional[StripeObject] + bacs_debit: Optional[BacsDebit] created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -44,7 +71,7 @@ class SourceMandateNotification(StripeObject): """ The reason of the mandate notification. Valid reasons are `mandate_confirmed` or `debit_initiated`. """ - sepa_debit: Optional[StripeObject] + sepa_debit: Optional[SepaDebit] source: "Source" """ `Source` objects allow you to accept a variety of payment methods. They @@ -66,3 +93,9 @@ class SourceMandateNotification(StripeObject): """ The type of source this mandate notification is attached to. Should be the source type identifier code for the payment method, such as `three_d_secure`. """ + + _inner_class_types = { + "acss_debit": AcssDebit, + "bacs_debit": BacsDebit, + "sepa_debit": SepaDebit, + } diff --git a/stripe/api_resources/source_transaction.py b/stripe/api_resources/source_transaction.py index 8be226f36..43e0c21d9 100644 --- a/stripe/api_resources/source_transaction.py +++ b/stripe/api_resources/source_transaction.py @@ -14,12 +14,107 @@ class SourceTransaction(StripeObject): """ OBJECT_NAME: ClassVar[Literal["source_transaction"]] = "source_transaction" - ach_credit_transfer: Optional[StripeObject] + + class AchCreditTransfer(StripeObject): + customer_data: Optional[str] + """ + Customer data associated with the transfer. + """ + fingerprint: Optional[str] + """ + Bank account fingerprint associated with the transfer. + """ + last4: Optional[str] + """ + Last 4 digits of the account number associated with the transfer. + """ + routing_number: Optional[str] + """ + Routing number associated with the transfer. + """ + + class ChfCreditTransfer(StripeObject): + reference: Optional[str] + """ + Reference associated with the transfer. + """ + sender_address_country: Optional[str] + """ + Sender's country address. + """ + sender_address_line1: Optional[str] + """ + Sender's line 1 address. + """ + sender_iban: Optional[str] + """ + Sender's bank account IBAN. + """ + sender_name: Optional[str] + """ + Sender's name. + """ + + class GbpCreditTransfer(StripeObject): + fingerprint: Optional[str] + """ + Bank account fingerprint associated with the Stripe owned bank account receiving the transfer. + """ + funding_method: Optional[str] + """ + The credit transfer rails the sender used to push this transfer. The possible rails are: Faster Payments, BACS, CHAPS, and wire transfers. Currently only Faster Payments is supported. + """ + last4: Optional[str] + """ + Last 4 digits of sender account number associated with the transfer. + """ + reference: Optional[str] + """ + Sender entered arbitrary information about the transfer. + """ + sender_account_number: Optional[str] + """ + Sender account number associated with the transfer. + """ + sender_name: Optional[str] + """ + Sender name associated with the transfer. + """ + sender_sort_code: Optional[str] + """ + Sender sort code associated with the transfer. + """ + + class PaperCheck(StripeObject): + available_at: Optional[str] + """ + Time at which the deposited funds will be available for use. Measured in seconds since the Unix epoch. + """ + invoices: Optional[str] + """ + Comma-separated list of invoice IDs associated with the paper check. + """ + + class SepaCreditTransfer(StripeObject): + reference: Optional[str] + """ + Reference associated with the transfer. + """ + sender_iban: Optional[str] + """ + Sender's bank account IBAN. + """ + sender_name: Optional[str] + """ + Sender's name. + """ + + ach_credit_transfer: Optional[AchCreditTransfer] amount: int """ A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the amount your customer has pushed to the receiver. """ - chf_credit_transfer: Optional[StripeObject] + chf_credit_transfer: Optional[ChfCreditTransfer] created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -28,7 +123,7 @@ class SourceTransaction(StripeObject): """ 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). """ - gbp_credit_transfer: Optional[StripeObject] + gbp_credit_transfer: Optional[GbpCreditTransfer] id: str """ Unique identifier for the object. @@ -41,8 +136,8 @@ class SourceTransaction(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ - paper_check: Optional[StripeObject] - sepa_credit_transfer: Optional[StripeObject] + paper_check: Optional[PaperCheck] + sepa_credit_transfer: Optional[SepaCreditTransfer] source: str """ The ID of the source this transaction is attached to. @@ -72,3 +167,11 @@ class SourceTransaction(StripeObject): """ The type of source this transaction is attached to. """ + + _inner_class_types = { + "ach_credit_transfer": AchCreditTransfer, + "chf_credit_transfer": ChfCreditTransfer, + "gbp_credit_transfer": GbpCreditTransfer, + "paper_check": PaperCheck, + "sepa_credit_transfer": SepaCreditTransfer, + } diff --git a/stripe/api_resources/subscription.py b/stripe/api_resources/subscription.py index 5368de495..21e719367 100644 --- a/stripe/api_resources/subscription.py +++ b/stripe/api_resources/subscription.py @@ -37,7 +37,7 @@ from stripe.api_resources.account import Account from stripe.api_resources.application import Application from stripe.api_resources.bank_account import BankAccount - from stripe.api_resources.card import Card + from stripe.api_resources.card import Card as CardResource from stripe.api_resources.customer import Customer from stripe.api_resources.discount import Discount from stripe.api_resources.invoice import Invoice @@ -64,6 +64,314 @@ class Subscription( """ OBJECT_NAME: ClassVar[Literal["subscription"]] = "subscription" + + class AutomaticTax(StripeObject): + enabled: bool + """ + Whether Stripe automatically computes tax on this subscription. + """ + + class BillingThresholds(StripeObject): + amount_gte: Optional[int] + """ + Monetary threshold that triggers the subscription to create an invoice + """ + reset_billing_cycle_anchor: Optional[bool] + """ + Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`. + """ + + class CancellationDetails(StripeObject): + comment: Optional[str] + """ + Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user. + """ + feedback: Optional[ + Literal[ + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ] + ] + """ + The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user. + """ + reason: Optional[ + Literal[ + "cancellation_requested", "payment_disputed", "payment_failed" + ] + ] + """ + Why this subscription was canceled. + """ + + class PauseCollection(StripeObject): + behavior: Literal["keep_as_draft", "mark_uncollectible", "void"] + """ + The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`. + """ + resumes_at: Optional[int] + """ + The time after which the subscription will resume collecting payments. + """ + + class PaymentSettings(StripeObject): + class PaymentMethodOptions(StripeObject): + class AcssDebit(StripeObject): + class MandateOptions(StripeObject): + transaction_type: Optional[Literal["business", "personal"]] + """ + Transaction type of the mandate. + """ + + mandate_options: Optional[MandateOptions] + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = {"mandate_options": MandateOptions} + + class Bancontact(StripeObject): + preferred_language: Literal["de", "en", "fr", "nl"] + """ + Preferred language of the Bancontact authorization page that the customer is redirected to. + """ + + class Card(StripeObject): + class MandateOptions(StripeObject): + amount: Optional[int] + """ + Amount to be charged for future payments. + """ + amount_type: Optional[Literal["fixed", "maximum"]] + """ + One of `fixed` or `maximum`. If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. If `maximum`, the amount charged can be up to the value passed for the `amount` param. + """ + description: Optional[str] + """ + A description of the mandate or subscription that is meant to be displayed to the customer. + """ + + mandate_options: Optional[MandateOptions] + network: Optional[ + Literal[ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "interac", + "jcb", + "mastercard", + "unionpay", + "unknown", + "visa", + ] + ] + """ + Selected network to process this Subscription on. Depends on the available networks of the card attached to the Subscription. Can be only set confirm-time. + """ + request_three_d_secure: Optional[Literal["any", "automatic"]] + """ + We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + """ + _inner_class_types = {"mandate_options": MandateOptions} + + class CustomerBalance(StripeObject): + class BankTransfer(StripeObject): + class EuBankTransfer(StripeObject): + country: Literal["BE", "DE", "ES", "FR", "IE", "NL"] + """ + The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. + """ + + eu_bank_transfer: Optional[EuBankTransfer] + type: Optional[str] + """ + The bank transfer type that can be used for funding. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. + """ + _inner_class_types = {"eu_bank_transfer": EuBankTransfer} + + bank_transfer: Optional[BankTransfer] + funding_type: Optional[Literal["bank_transfer"]] + """ + The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`. + """ + _inner_class_types = {"bank_transfer": BankTransfer} + + class Konbini(StripeObject): + pass + + class UsBankAccount(StripeObject): + class FinancialConnections(StripeObject): + permissions: Optional[ + List[ + Literal[ + "balances", "payment_method", "transactions" + ] + ] + ] + """ + The list of permissions to request. The `payment_method` permission must be included. + """ + prefetch: Optional[List[Literal["balances"]]] + """ + Data features requested to be retrieved upon account creation. + """ + + financial_connections: Optional[FinancialConnections] + verification_method: Optional[ + Literal["automatic", "instant", "microdeposits"] + ] + """ + Bank account verification method. + """ + _inner_class_types = { + "financial_connections": FinancialConnections, + } + + acss_debit: Optional[AcssDebit] + """ + This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to invoices created by the subscription. + """ + bancontact: Optional[Bancontact] + """ + This sub-hash contains details about the Bancontact payment method options to pass to invoices created by the subscription. + """ + card: Optional[Card] + """ + This sub-hash contains details about the Card payment method options to pass to invoices created by the subscription. + """ + customer_balance: Optional[CustomerBalance] + """ + This sub-hash contains details about the Bank transfer payment method options to pass to invoices created by the subscription. + """ + konbini: Optional[Konbini] + """ + This sub-hash contains details about the Konbini payment method options to pass to invoices created by the subscription. + """ + us_bank_account: Optional[UsBankAccount] + """ + This sub-hash contains details about the ACH direct debit payment method options to pass to invoices created by the subscription. + """ + _inner_class_types = { + "acss_debit": AcssDebit, + "bancontact": Bancontact, + "card": Card, + "customer_balance": CustomerBalance, + "konbini": Konbini, + "us_bank_account": UsBankAccount, + } + + payment_method_options: Optional[PaymentMethodOptions] + """ + Payment-method-specific configuration to provide to invoices created by the subscription. + """ + payment_method_types: Optional[ + List[ + Literal[ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "fpx", + "giropay", + "grabpay", + "ideal", + "konbini", + "link", + "paynow", + "paypal", + "promptpay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "us_bank_account", + "wechat_pay", + ] + ] + ] + """ + The list of payment method types to provide to every invoice created by the subscription. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). + """ + save_default_payment_method: Optional[ + Literal["off", "on_subscription"] + ] + """ + Either `off`, or `on_subscription`. With `on_subscription` Stripe updates `subscription.default_payment_method` when a subscription payment succeeds. + """ + _inner_class_types = {"payment_method_options": PaymentMethodOptions} + + class PendingInvoiceItemInterval(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + Specifies invoicing frequency. Either `day`, `week`, `month` or `year`. + """ + interval_count: int + """ + The number of intervals between invoices. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). + """ + + class PendingUpdate(StripeObject): + billing_cycle_anchor: Optional[int] + """ + If the update is applied, determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format. + """ + expires_at: int + """ + The point after which the changes reflected by this update will be discarded and no longer applied. + """ + subscription_items: Optional[List["SubscriptionItem"]] + """ + List of subscription items, each with an attached plan, that will be set if the update is applied. + """ + trial_end: Optional[int] + """ + Unix timestamp representing the end of the trial period the customer will get before being charged for the first time, if the update is applied. + """ + trial_from_plan: Optional[bool] + """ + Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. + """ + + class TransferData(StripeObject): + amount_percent: Optional[float] + """ + A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination. + """ + destination: ExpandableField["Account"] + """ + The account where funds from the payment will be transferred to upon payment success. + """ + + class TrialSettings(StripeObject): + class EndBehavior(StripeObject): + missing_payment_method: Literal[ + "cancel", "create_invoice", "pause" + ] + """ + Indicates how the subscription should change when the trial ends if the user did not provide a payment method. + """ + + end_behavior: EndBehavior + """ + Defines how a subscription behaves when a free trial ends. + """ + _inner_class_types = {"end_behavior": EndBehavior} + if TYPE_CHECKING: class CancelParams(RequestOptions): @@ -1372,12 +1680,12 @@ class SearchParams(RequestOptions): """ A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. """ - automatic_tax: StripeObject + automatic_tax: AutomaticTax billing_cycle_anchor: int """ Determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format. """ - billing_thresholds: Optional[StripeObject] + billing_thresholds: Optional[BillingThresholds] """ Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period """ @@ -1393,7 +1701,7 @@ class SearchParams(RequestOptions): """ If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state. """ - cancellation_details: Optional[StripeObject] + cancellation_details: Optional[CancellationDetails] """ Details about why this subscription was cancelled """ @@ -1430,7 +1738,9 @@ class SearchParams(RequestOptions): ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over `default_source`. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source). """ default_source: Optional[ - ExpandableField[Union["Account", "BankAccount", "Card", "Source"]] + ExpandableField[ + Union["Account", "BankAccount", "CardResource", "Source"] + ] ] """ ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If `default_payment_method` is also set, `default_payment_method` will take precedence. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source). @@ -1483,15 +1793,15 @@ class SearchParams(RequestOptions): """ The account (if any) the charge was made on behalf of for charges associated with this subscription. See the Connect documentation for details. """ - pause_collection: Optional[StripeObject] + pause_collection: Optional[PauseCollection] """ If specified, payment collection for this subscription will be paused. """ - payment_settings: Optional[StripeObject] + payment_settings: Optional[PaymentSettings] """ Payment settings passed on to invoices created by the subscription. """ - pending_invoice_item_interval: Optional[StripeObject] + pending_invoice_item_interval: Optional[PendingInvoiceItemInterval] """ Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. """ @@ -1499,7 +1809,7 @@ class SearchParams(RequestOptions): """ You can use this [SetupIntent](https://stripe.com/docs/api/setup_intents) to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2). """ - pending_update: Optional[StripeObject] + pending_update: Optional[PendingUpdate] """ If specified, [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid. """ @@ -1536,7 +1846,7 @@ class SearchParams(RequestOptions): """ ID of the test clock this subscription belongs to. """ - transfer_data: Optional[StripeObject] + transfer_data: Optional[TransferData] """ The account (if any) the 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. """ @@ -1544,7 +1854,7 @@ class SearchParams(RequestOptions): """ If the subscription has a trial, the end of that trial. """ - trial_settings: Optional[StripeObject] + trial_settings: Optional[TrialSettings] """ Settings related to subscription trials. """ @@ -1818,3 +2128,15 @@ def search_auto_paging_iter( cls, *args, **kwargs: Unpack["Subscription.SearchParams"] ) -> Iterator["Subscription"]: return cls.search(*args, **kwargs).auto_paging_iter() + + _inner_class_types = { + "automatic_tax": AutomaticTax, + "billing_thresholds": BillingThresholds, + "cancellation_details": CancellationDetails, + "pause_collection": PauseCollection, + "payment_settings": PaymentSettings, + "pending_invoice_item_interval": PendingInvoiceItemInterval, + "pending_update": PendingUpdate, + "transfer_data": TransferData, + "trial_settings": TrialSettings, + } diff --git a/stripe/api_resources/subscription_item.py b/stripe/api_resources/subscription_item.py index f76a40a27..2b2d851a0 100644 --- a/stripe/api_resources/subscription_item.py +++ b/stripe/api_resources/subscription_item.py @@ -44,6 +44,13 @@ class SubscriptionItem( """ OBJECT_NAME: ClassVar[Literal["subscription_item"]] = "subscription_item" + + class BillingThresholds(StripeObject): + usage_gte: Optional[int] + """ + Usage threshold that triggers the subscription to create an invoice + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -342,7 +349,7 @@ class ListUsageRecordSummariesParams(RequestOptions): 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. """ - billing_thresholds: Optional[StripeObject] + billing_thresholds: Optional[BillingThresholds] """ Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period """ @@ -542,3 +549,5 @@ def list_usage_record_summaries( params=params, ), ) + + _inner_class_types = {"billing_thresholds": BillingThresholds} diff --git a/stripe/api_resources/subscription_schedule.py b/stripe/api_resources/subscription_schedule.py index c457acad8..f5bf8354e 100644 --- a/stripe/api_resources/subscription_schedule.py +++ b/stripe/api_resources/subscription_schedule.py @@ -22,9 +22,15 @@ from urllib.parse import quote_plus if TYPE_CHECKING: + from stripe.api_resources.account import Account from stripe.api_resources.application import Application + from stripe.api_resources.coupon import Coupon from stripe.api_resources.customer import Customer + from stripe.api_resources.payment_method import PaymentMethod + from stripe.api_resources.plan import Plan + from stripe.api_resources.price import Price from stripe.api_resources.subscription import Subscription + from stripe.api_resources.tax_rate import TaxRate from stripe.api_resources.test_helpers.test_clock import TestClock @@ -42,6 +48,266 @@ class SubscriptionSchedule( OBJECT_NAME: ClassVar[ Literal["subscription_schedule"] ] = "subscription_schedule" + + class CurrentPhase(StripeObject): + end_date: int + """ + The end of this phase of the subscription schedule. + """ + start_date: int + """ + The start of this phase of the subscription schedule. + """ + + class DefaultSettings(StripeObject): + class AutomaticTax(StripeObject): + enabled: bool + """ + Whether Stripe automatically computes tax on invoices created during this phase. + """ + + class BillingThresholds(StripeObject): + amount_gte: Optional[int] + """ + Monetary threshold that triggers the subscription to create an invoice + """ + reset_billing_cycle_anchor: Optional[bool] + """ + Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`. + """ + + class InvoiceSettings(StripeObject): + days_until_due: Optional[int] + """ + Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. + """ + + class TransferData(StripeObject): + amount_percent: Optional[float] + """ + A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination. + """ + destination: ExpandableField["Account"] + """ + The account where funds from the payment will be transferred to upon payment success. + """ + + application_fee_percent: Optional[float] + """ + A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account during this phase of the schedule. + """ + automatic_tax: Optional[AutomaticTax] + billing_cycle_anchor: Literal["automatic", "phase_start"] + """ + Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). + """ + billing_thresholds: Optional[BillingThresholds] + """ + Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period + """ + collection_method: Optional[ + Literal["charge_automatically", "send_invoice"] + ] + """ + Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. + """ + default_payment_method: Optional[ExpandableField["PaymentMethod"]] + """ + ID of the default payment method for the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. + """ + description: Optional[str] + """ + Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription. + """ + invoice_settings: Optional[InvoiceSettings] + """ + The subscription schedule's default invoice settings. + """ + on_behalf_of: Optional[ExpandableField["Account"]] + """ + 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. + """ + 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. + """ + _inner_class_types = { + "automatic_tax": AutomaticTax, + "billing_thresholds": BillingThresholds, + "invoice_settings": InvoiceSettings, + "transfer_data": TransferData, + } + + class Phase(StripeObject): + class AddInvoiceItem(StripeObject): + price: ExpandableField["Price"] + """ + ID of the price used to generate the invoice item. + """ + quantity: Optional[int] + """ + The quantity of the invoice item. + """ + tax_rates: Optional[List["TaxRate"]] + """ + The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item. + """ + + class AutomaticTax(StripeObject): + enabled: bool + """ + Whether Stripe automatically computes tax on invoices created during this phase. + """ + + class BillingThresholds(StripeObject): + amount_gte: Optional[int] + """ + Monetary threshold that triggers the subscription to create an invoice + """ + reset_billing_cycle_anchor: Optional[bool] + """ + Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`. + """ + + class InvoiceSettings(StripeObject): + days_until_due: Optional[int] + """ + Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. + """ + + class Item(StripeObject): + class BillingThresholds(StripeObject): + usage_gte: Optional[int] + """ + Usage threshold that triggers the subscription to create an invoice + """ + + billing_thresholds: Optional[BillingThresholds] + """ + Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period + """ + metadata: Optional[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an item. Metadata on this item will update the underlying subscription item's `metadata` when the phase is entered. + """ + plan: ExpandableField["Plan"] + """ + ID of the plan to which the customer should be subscribed. + """ + price: ExpandableField["Price"] + """ + ID of the price to which the customer should be subscribed. + """ + quantity: Optional[int] + """ + Quantity of the plan to which the customer should be subscribed. + """ + tax_rates: Optional[List["TaxRate"]] + """ + The tax rates which apply to this `phase_item`. When set, the `default_tax_rates` on the phase do not apply to this `phase_item`. + """ + _inner_class_types = {"billing_thresholds": BillingThresholds} + + class TransferData(StripeObject): + amount_percent: Optional[float] + """ + A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination. + """ + destination: ExpandableField["Account"] + """ + The account where funds from the payment will be transferred to upon payment success. + """ + + add_invoice_items: List[AddInvoiceItem] + """ + A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. + """ + application_fee_percent: Optional[float] + """ + A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account during this phase of the schedule. + """ + automatic_tax: Optional[AutomaticTax] + billing_cycle_anchor: Optional[Literal["automatic", "phase_start"]] + """ + Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). + """ + billing_thresholds: Optional[BillingThresholds] + """ + Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period + """ + collection_method: Optional[ + Literal["charge_automatically", "send_invoice"] + ] + """ + Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. + """ + coupon: Optional[ExpandableField["Coupon"]] + """ + ID of the coupon to use during this phase of the subscription schedule. + """ + 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). + """ + default_payment_method: Optional[ExpandableField["PaymentMethod"]] + """ + ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. + """ + default_tax_rates: Optional[List["TaxRate"]] + """ + The default tax rates to apply to the subscription during this phase of the subscription schedule. + """ + description: Optional[str] + """ + Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription. + """ + end_date: int + """ + The end of this phase of the subscription schedule. + """ + invoice_settings: Optional[InvoiceSettings] + """ + The invoice settings applicable during this phase. + """ + items: List[Item] + """ + Subscription items to configure the subscription to during this phase of the subscription schedule. + """ + metadata: Optional[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered. Updating the underlying subscription's `metadata` directly will not affect the current phase's `metadata`. + """ + on_behalf_of: Optional[ExpandableField["Account"]] + """ + 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. + """ + proration_behavior: Literal[ + "always_invoice", "create_prorations", "none" + ] + """ + If the subscription schedule will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`. + """ + start_date: int + """ + The start of this phase of the subscription schedule. + """ + 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. + """ + trial_end: Optional[int] + """ + When the trial ends within the phase. + """ + _inner_class_types = { + "add_invoice_items": AddInvoiceItem, + "automatic_tax": AutomaticTax, + "billing_thresholds": BillingThresholds, + "invoice_settings": InvoiceSettings, + "items": Item, + "transfer_data": TransferData, + } + if TYPE_CHECKING: class CancelParams(RequestOptions): @@ -974,7 +1240,7 @@ class RetrieveParams(RequestOptions): """ Time at which the object was created. Measured in seconds since the Unix epoch. """ - current_phase: Optional[StripeObject] + current_phase: Optional[CurrentPhase] """ Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`. """ @@ -982,7 +1248,7 @@ class RetrieveParams(RequestOptions): """ ID of the customer who owns the subscription schedule. """ - default_settings: StripeObject + default_settings: DefaultSettings end_behavior: Literal["cancel", "none", "release", "renew"] """ Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. @@ -1003,7 +1269,7 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - phases: List[StripeObject] + phases: List[Phase] """ Configuration for the subscription schedule's phases. """ @@ -1216,3 +1482,9 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "current_phase": CurrentPhase, + "default_settings": DefaultSettings, + "phases": Phase, + } diff --git a/stripe/api_resources/tax/calculation.py b/stripe/api_resources/tax/calculation.py index d61c88d5f..5701b6e11 100644 --- a/stripe/api_resources/tax/calculation.py +++ b/stripe/api_resources/tax/calculation.py @@ -29,6 +29,322 @@ class Calculation(CreateableAPIResource["Calculation"]): """ OBJECT_NAME: ClassVar[Literal["tax.calculation"]] = "tax.calculation" + + class CustomerDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State/province as an [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code, without country prefix. Example: "NY" or "TX". + """ + + class TaxId(StripeObject): + type: Literal[ + "ad_nrt", + "ae_trn", + "ar_cuit", + "au_abn", + "au_arn", + "bg_uic", + "bo_tin", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sv_nit", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "unknown", + "us_ein", + "uy_ruc", + "ve_rif", + "vn_tin", + "za_vat", + ] + """ + The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, or `unknown` + """ + value: str + """ + The value of the tax ID. + """ + + address: Optional[Address] + """ + The customer's postal address (for example, home or business location). + """ + address_source: Optional[Literal["billing", "shipping"]] + """ + The type of customer address provided. + """ + ip_address: Optional[str] + """ + The customer's IP address (IPv4 or IPv6). + """ + tax_ids: List[TaxId] + """ + The customer's tax IDs (for example, EU VAT numbers). + """ + taxability_override: Literal[ + "customer_exempt", "none", "reverse_charge" + ] + """ + The taxability override used for taxation. + """ + _inner_class_types = {"address": Address, "tax_ids": TaxId} + + class ShippingCost(StripeObject): + class TaxBreakdown(StripeObject): + class Jurisdiction(StripeObject): + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + display_name: str + """ + A human-readable name for the jurisdiction imposing the tax. + """ + level: Literal[ + "city", "country", "county", "district", "state" + ] + """ + Indicates the level of the jurisdiction imposing the tax. + """ + state: Optional[str] + """ + [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. For example, "NY" for New York, United States. + """ + + class TaxRateDetails(StripeObject): + display_name: str + """ + A localized display name for tax type, intended to be human-readable. For example, "Local Sales and Use Tax", "Value-added tax (VAT)", or "Umsatzsteuer (USt.)". + """ + percentage_decimal: str + """ + The tax rate percentage as a string. For example, 8.5% is represented as "8.5". + """ + tax_type: Literal[ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "rst", + "sales_tax", + "vat", + ] + """ + The tax type, such as `vat` or `sales_tax`. + """ + + amount: int + """ + The amount of tax, in integer cents. + """ + jurisdiction: Jurisdiction + sourcing: Literal["destination", "origin"] + """ + Indicates whether the jurisdiction was determined by the origin (merchant's address) or destination (customer's address). + """ + tax_rate_details: Optional[TaxRateDetails] + """ + Details regarding the rate for this tax. This field will be `null` when the tax is not imposed, for example if the product is exempt from tax. + """ + taxability_reason: Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: int + """ + The amount on which tax is calculated, in integer cents. + """ + _inner_class_types = { + "jurisdiction": Jurisdiction, + "tax_rate_details": TaxRateDetails, + } + + amount: int + """ + The shipping amount in integer cents. If `tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes were calculated on top of this amount. + """ + amount_tax: int + """ + The amount of tax calculated for shipping, in integer cents. + """ + shipping_rate: Optional[str] + """ + The ID of an existing [ShippingRate](https://stripe.com/docs/api/shipping_rates/object). + """ + tax_behavior: Literal["exclusive", "inclusive"] + """ + Specifies whether the `amount` includes taxes. If `tax_behavior=inclusive`, then the amount includes taxes. + """ + tax_breakdown: Optional[List[TaxBreakdown]] + """ + Detailed account of taxes relevant to shipping cost. + """ + tax_code: str + """ + The [tax code](https://stripe.com/docs/tax/tax-categories) ID used for shipping. + """ + _inner_class_types = {"tax_breakdown": TaxBreakdown} + + class TaxBreakdown(StripeObject): + class TaxRateDetails(StripeObject): + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + percentage_decimal: str + """ + The tax rate percentage as a string. For example, 8.5% is represented as `"8.5"`. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + tax_type: Optional[ + Literal[ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "rst", + "sales_tax", + "vat", + ] + ] + """ + The tax type, such as `vat` or `sales_tax`. + """ + + amount: int + """ + The amount of tax, in integer cents. + """ + inclusive: bool + """ + Specifies whether the tax amount is included in the line item amount. + """ + tax_rate_details: TaxRateDetails + taxability_reason: Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. We might extend the possible values for this field to support new tax rules. + """ + taxable_amount: int + """ + The amount on which tax is calculated, in integer cents. + """ + _inner_class_types = {"tax_rate_details": TaxRateDetails} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -270,7 +586,7 @@ class ListLineItemsParams(RequestOptions): """ The ID of an existing [Customer](https://stripe.com/docs/api/customers/object) used for the resource. """ - customer_details: StripeObject + customer_details: CustomerDetails expires_at: Optional[int] """ Timestamp of date at which the tax calculation will expire. @@ -291,7 +607,7 @@ class ListLineItemsParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - shipping_cost: Optional[StripeObject] + shipping_cost: Optional[ShippingCost] """ The shipping cost details for the calculation. """ @@ -303,7 +619,7 @@ class ListLineItemsParams(RequestOptions): """ The amount of tax already included in the line item prices. """ - tax_breakdown: List[StripeObject] + tax_breakdown: List[TaxBreakdown] """ Breakdown of individual tax amounts that add up to the total. """ @@ -394,3 +710,9 @@ def list_line_items( # pyright: ignore[reportGeneralTypeIssues] params=params, ), ) + + _inner_class_types = { + "customer_details": CustomerDetails, + "shipping_cost": ShippingCost, + "tax_breakdown": TaxBreakdown, + } diff --git a/stripe/api_resources/tax/calculation_line_item.py b/stripe/api_resources/tax/calculation_line_item.py index 29b81b93e..8bfacce75 100644 --- a/stripe/api_resources/tax/calculation_line_item.py +++ b/stripe/api_resources/tax/calculation_line_item.py @@ -9,6 +9,95 @@ class CalculationLineItem(StripeObject): OBJECT_NAME: ClassVar[ Literal["tax.calculation_line_item"] ] = "tax.calculation_line_item" + + class TaxBreakdown(StripeObject): + class Jurisdiction(StripeObject): + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + display_name: str + """ + A human-readable name for the jurisdiction imposing the tax. + """ + level: Literal["city", "country", "county", "district", "state"] + """ + Indicates the level of the jurisdiction imposing the tax. + """ + state: Optional[str] + """ + [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. For example, "NY" for New York, United States. + """ + + class TaxRateDetails(StripeObject): + display_name: str + """ + A localized display name for tax type, intended to be human-readable. For example, "Local Sales and Use Tax", "Value-added tax (VAT)", or "Umsatzsteuer (USt.)". + """ + percentage_decimal: str + """ + The tax rate percentage as a string. For example, 8.5% is represented as "8.5". + """ + tax_type: Literal[ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "rst", + "sales_tax", + "vat", + ] + """ + The tax type, such as `vat` or `sales_tax`. + """ + + amount: int + """ + The amount of tax, in integer cents. + """ + jurisdiction: Jurisdiction + sourcing: Literal["destination", "origin"] + """ + Indicates whether the jurisdiction was determined by the origin (merchant's address) or destination (customer's address). + """ + tax_rate_details: Optional[TaxRateDetails] + """ + Details regarding the rate for this tax. This field will be `null` when the tax is not imposed, for example if the product is exempt from tax. + """ + taxability_reason: Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: int + """ + The amount on which tax is calculated, in integer cents. + """ + _inner_class_types = { + "jurisdiction": Jurisdiction, + "tax_rate_details": TaxRateDetails, + } + amount: int """ The line item amount in integer cents. If `tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes were calculated on top of this amount. @@ -45,7 +134,7 @@ class CalculationLineItem(StripeObject): """ Specifies whether the `amount` includes taxes. If `tax_behavior=inclusive`, then the amount includes taxes. """ - tax_breakdown: Optional[List[StripeObject]] + tax_breakdown: Optional[List[TaxBreakdown]] """ Detailed account of taxes relevant to this line item. """ @@ -53,3 +142,5 @@ class CalculationLineItem(StripeObject): """ The [tax code](https://stripe.com/docs/tax/tax-categories) ID used for this resource. """ + + _inner_class_types = {"tax_breakdown": TaxBreakdown} diff --git a/stripe/api_resources/tax/settings.py b/stripe/api_resources/tax/settings.py index 8c3f1ae28..3d8b9e561 100644 --- a/stripe/api_resources/tax/settings.py +++ b/stripe/api_resources/tax/settings.py @@ -28,6 +28,63 @@ class Settings( """ OBJECT_NAME: ClassVar[Literal["tax.settings"]] = "tax.settings" + + class Defaults(StripeObject): + tax_behavior: Optional[ + Literal["exclusive", "inclusive", "inferred_by_currency"] + ] + """ + Default [tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#tax-behavior) used to specify whether the price is considered inclusive of taxes or exclusive of taxes. If the item's price has a tax behavior set, it will take precedence over the default tax behavior. + """ + tax_code: Optional[str] + """ + Default [tax code](https://stripe.com/docs/tax/tax-categories) used to classify your products and prices. + """ + + class HeadOffice(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Address + _inner_class_types = {"address": Address} + + class StatusDetails(StripeObject): + class Active(StripeObject): + pass + + class Pending(StripeObject): + missing_fields: Optional[List[str]] + """ + The list of missing fields that are required to perform calculations. It includes the entry `head_office` when the status is `pending`. It is recommended to set the optional values even if they aren't listed as required for calculating taxes. Calculations can fail if missing fields aren't explicitly provided on every call. + """ + + active: Optional[Active] + pending: Optional[Pending] + _inner_class_types = {"active": Active, "pending": Pending} + if TYPE_CHECKING: class ModifyParams(RequestOptions): @@ -94,8 +151,8 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - defaults: StripeObject - head_office: Optional[StripeObject] + defaults: Defaults + head_office: Optional[HeadOffice] """ The place where your business is located. """ @@ -111,7 +168,7 @@ class RetrieveParams(RequestOptions): """ The `active` status indicates you have all required settings to calculate tax. A status can transition out of `active` when new required settings are introduced. """ - status_details: StripeObject + status_details: StatusDetails @classmethod def modify( @@ -134,3 +191,9 @@ def retrieve( @classmethod def class_url(cls): return "/v1/tax/settings" + + _inner_class_types = { + "defaults": Defaults, + "head_office": HeadOffice, + "status_details": StatusDetails, + } diff --git a/stripe/api_resources/tax/transaction.py b/stripe/api_resources/tax/transaction.py index 710531520..1028b4113 100644 --- a/stripe/api_resources/tax/transaction.py +++ b/stripe/api_resources/tax/transaction.py @@ -29,6 +29,259 @@ class Transaction(APIResource["Transaction"]): """ OBJECT_NAME: ClassVar[Literal["tax.transaction"]] = "tax.transaction" + + class CustomerDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State/province as an [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code, without country prefix. Example: "NY" or "TX". + """ + + class TaxId(StripeObject): + type: Literal[ + "ad_nrt", + "ae_trn", + "ar_cuit", + "au_abn", + "au_arn", + "bg_uic", + "bo_tin", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sv_nit", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "unknown", + "us_ein", + "uy_ruc", + "ve_rif", + "vn_tin", + "za_vat", + ] + """ + The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, or `unknown` + """ + value: str + """ + The value of the tax ID. + """ + + address: Optional[Address] + """ + The customer's postal address (for example, home or business location). + """ + address_source: Optional[Literal["billing", "shipping"]] + """ + The type of customer address provided. + """ + ip_address: Optional[str] + """ + The customer's IP address (IPv4 or IPv6). + """ + tax_ids: List[TaxId] + """ + The customer's tax IDs (for example, EU VAT numbers). + """ + taxability_override: Literal[ + "customer_exempt", "none", "reverse_charge" + ] + """ + The taxability override used for taxation. + """ + _inner_class_types = {"address": Address, "tax_ids": TaxId} + + class Reversal(StripeObject): + original_transaction: Optional[str] + """ + The `id` of the reversed `Transaction` object. + """ + + class ShippingCost(StripeObject): + class TaxBreakdown(StripeObject): + class Jurisdiction(StripeObject): + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + display_name: str + """ + A human-readable name for the jurisdiction imposing the tax. + """ + level: Literal[ + "city", "country", "county", "district", "state" + ] + """ + Indicates the level of the jurisdiction imposing the tax. + """ + state: Optional[str] + """ + [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. For example, "NY" for New York, United States. + """ + + class TaxRateDetails(StripeObject): + display_name: str + """ + A localized display name for tax type, intended to be human-readable. For example, "Local Sales and Use Tax", "Value-added tax (VAT)", or "Umsatzsteuer (USt.)". + """ + percentage_decimal: str + """ + The tax rate percentage as a string. For example, 8.5% is represented as "8.5". + """ + tax_type: Literal[ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "rst", + "sales_tax", + "vat", + ] + """ + The tax type, such as `vat` or `sales_tax`. + """ + + amount: int + """ + The amount of tax, in integer cents. + """ + jurisdiction: Jurisdiction + sourcing: Literal["destination", "origin"] + """ + Indicates whether the jurisdiction was determined by the origin (merchant's address) or destination (customer's address). + """ + tax_rate_details: Optional[TaxRateDetails] + """ + Details regarding the rate for this tax. This field will be `null` when the tax is not imposed, for example if the product is exempt from tax. + """ + taxability_reason: Literal[ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ] + """ + The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. + """ + taxable_amount: int + """ + The amount on which tax is calculated, in integer cents. + """ + _inner_class_types = { + "jurisdiction": Jurisdiction, + "tax_rate_details": TaxRateDetails, + } + + amount: int + """ + The shipping amount in integer cents. If `tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes were calculated on top of this amount. + """ + amount_tax: int + """ + The amount of tax calculated for shipping, in integer cents. + """ + shipping_rate: Optional[str] + """ + The ID of an existing [ShippingRate](https://stripe.com/docs/api/shipping_rates/object). + """ + tax_behavior: Literal["exclusive", "inclusive"] + """ + Specifies whether the `amount` includes taxes. If `tax_behavior=inclusive`, then the amount includes taxes. + """ + tax_breakdown: Optional[List[TaxBreakdown]] + """ + Detailed account of taxes relevant to shipping cost. (It is not populated for the transaction resource object and will be removed in the next API version.) + """ + tax_code: str + """ + The [tax code](https://stripe.com/docs/tax/tax-categories) ID used for shipping. + """ + _inner_class_types = {"tax_breakdown": TaxBreakdown} + if TYPE_CHECKING: class CreateFromCalculationParams(RequestOptions): @@ -159,7 +412,7 @@ class RetrieveParams(RequestOptions): """ The ID of an existing [Customer](https://stripe.com/docs/api/customers/object) used for the resource. """ - customer_details: StripeObject + customer_details: CustomerDetails id: str """ Unique identifier for the transaction. @@ -184,11 +437,11 @@ class RetrieveParams(RequestOptions): """ A custom unique identifier, such as 'myOrder_123'. """ - reversal: Optional[StripeObject] + reversal: Optional[Reversal] """ If `type=reversal`, contains information about what was reversed. """ - shipping_cost: Optional[StripeObject] + shipping_cost: Optional[ShippingCost] """ The shipping cost details for the transaction. """ @@ -309,3 +562,9 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "customer_details": CustomerDetails, + "reversal": Reversal, + "shipping_cost": ShippingCost, + } diff --git a/stripe/api_resources/tax/transaction_line_item.py b/stripe/api_resources/tax/transaction_line_item.py index 80bb97fc8..eeb2f00c3 100644 --- a/stripe/api_resources/tax/transaction_line_item.py +++ b/stripe/api_resources/tax/transaction_line_item.py @@ -9,6 +9,13 @@ class TransactionLineItem(StripeObject): OBJECT_NAME: ClassVar[ Literal["tax.transaction_line_item"] ] = "tax.transaction_line_item" + + class Reversal(StripeObject): + original_line_item: str + """ + The `id` of the line item to reverse in the original transaction. + """ + amount: int """ The line item amount in integer cents. If `tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes were calculated on top of this amount. @@ -45,7 +52,7 @@ class TransactionLineItem(StripeObject): """ A custom identifier for this line item in the transaction. """ - reversal: Optional[StripeObject] + reversal: Optional[Reversal] """ If `type=reversal`, contains information about what was reversed. """ @@ -61,3 +68,5 @@ class TransactionLineItem(StripeObject): """ If `reversal`, this line item reverses an earlier transaction. """ + + _inner_class_types = {"reversal": Reversal} diff --git a/stripe/api_resources/tax_id.py b/stripe/api_resources/tax_id.py index 9060d471e..b25187540 100644 --- a/stripe/api_resources/tax_id.py +++ b/stripe/api_resources/tax_id.py @@ -18,6 +18,21 @@ class TaxId(APIResource["TaxId"]): """ OBJECT_NAME: ClassVar[Literal["tax_id"]] = "tax_id" + + class Verification(StripeObject): + status: Literal["pending", "unavailable", "unverified", "verified"] + """ + Verification status, one of `pending`, `verified`, `unverified`, or `unavailable`. + """ + verified_address: Optional[str] + """ + Verified address. + """ + verified_name: Optional[str] + """ + Verified name. + """ + country: Optional[str] """ Two-letter ISO code representing the country of the tax ID. @@ -118,7 +133,7 @@ class TaxId(APIResource["TaxId"]): """ Value of the tax ID. """ - verification: Optional[StripeObject] + verification: Optional[Verification] """ Tax ID verification information. """ @@ -143,3 +158,5 @@ def retrieve(cls, id, api_key=None, **params): raise NotImplementedError( "Can't retrieve a tax id without a customer ID. Use customer.retrieve_tax_id('tax_id')" ) + + _inner_class_types = {"verification": Verification} diff --git a/stripe/api_resources/terminal/configuration.py b/stripe/api_resources/terminal/configuration.py index fe55bc698..ae812c36b 100644 --- a/stripe/api_resources/terminal/configuration.py +++ b/stripe/api_resources/terminal/configuration.py @@ -6,6 +6,7 @@ ListableAPIResource, UpdateableAPIResource, ) +from stripe.api_resources.expandable_field import ExpandableField from stripe.api_resources.list_object import ListObject from stripe.request_options import RequestOptions from stripe.stripe_object import StripeObject @@ -20,6 +21,9 @@ ) from urllib.parse import quote_plus +if TYPE_CHECKING: + from stripe.api_resources.file import File + class Configuration( CreateableAPIResource["Configuration"], @@ -34,6 +38,253 @@ class Configuration( OBJECT_NAME: ClassVar[ Literal["terminal.configuration"] ] = "terminal.configuration" + + class BbposWiseposE(StripeObject): + splashscreen: Optional[ExpandableField["File"]] + """ + A File ID representing an image you would like displayed on the reader. + """ + + class Offline(StripeObject): + enabled: Optional[bool] + """ + Determines whether to allow transactions to be collected while reader is offline. Defaults to false. + """ + + class Tipping(StripeObject): + class Aud(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Cad(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Chf(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Czk(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Dkk(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Eur(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Gbp(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Hkd(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Myr(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Nok(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Nzd(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Sek(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Sgd(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + class Usd(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + + aud: Optional[Aud] + cad: Optional[Cad] + chf: Optional[Chf] + czk: Optional[Czk] + dkk: Optional[Dkk] + eur: Optional[Eur] + gbp: Optional[Gbp] + hkd: Optional[Hkd] + myr: Optional[Myr] + nok: Optional[Nok] + nzd: Optional[Nzd] + sek: Optional[Sek] + sgd: Optional[Sgd] + usd: Optional[Usd] + _inner_class_types = { + "aud": Aud, + "cad": Cad, + "chf": Chf, + "czk": Czk, + "dkk": Dkk, + "eur": Eur, + "gbp": Gbp, + "hkd": Hkd, + "myr": Myr, + "nok": Nok, + "nzd": Nzd, + "sek": Sek, + "sgd": Sgd, + "usd": Usd, + } + + class VerifoneP400(StripeObject): + splashscreen: Optional[ExpandableField["File"]] + """ + A File ID representing an image you would like displayed on the reader. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -671,7 +922,7 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - bbpos_wisepos_e: Optional[StripeObject] + bbpos_wisepos_e: Optional[BbposWiseposE] id: str """ Unique identifier for the object. @@ -688,9 +939,9 @@ class RetrieveParams(RequestOptions): """ String representing the object's type. Objects of the same type share the same value. """ - offline: Optional[StripeObject] - tipping: Optional[StripeObject] - verifone_p400: Optional[StripeObject] + offline: Optional[Offline] + tipping: Optional[Tipping] + verifone_p400: Optional[VerifoneP400] deleted: Optional[Literal[True]] """ Always true for a deleted object @@ -793,3 +1044,10 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "bbpos_wisepos_e": BbposWiseposE, + "offline": Offline, + "tipping": Tipping, + "verifone_p400": VerifoneP400, + } diff --git a/stripe/api_resources/terminal/location.py b/stripe/api_resources/terminal/location.py index 1d9439fcc..1da7e4317 100644 --- a/stripe/api_resources/terminal/location.py +++ b/stripe/api_resources/terminal/location.py @@ -34,6 +34,33 @@ class Location( """ OBJECT_NAME: ClassVar[Literal["terminal.location"]] = "terminal.location" + + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -159,7 +186,7 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - address: StripeObject + address: Address configuration_overrides: Optional[str] """ The ID of a configuration that will be used to customize all readers in this location. @@ -284,3 +311,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"address": Address} diff --git a/stripe/api_resources/terminal/reader.py b/stripe/api_resources/terminal/reader.py index bbe4afa7d..873acee4d 100644 --- a/stripe/api_resources/terminal/reader.py +++ b/stripe/api_resources/terminal/reader.py @@ -25,6 +25,10 @@ from urllib.parse import quote_plus if TYPE_CHECKING: + from stripe.api_resources.charge import Charge + from stripe.api_resources.payment_intent import PaymentIntent + from stripe.api_resources.refund import Refund + from stripe.api_resources.setup_intent import SetupIntent from stripe.api_resources.terminal.location import Location @@ -41,6 +45,178 @@ class Reader( """ OBJECT_NAME: ClassVar[Literal["terminal.reader"]] = "terminal.reader" + + class Action(StripeObject): + class ProcessPaymentIntent(StripeObject): + class ProcessConfig(StripeObject): + class Tipping(StripeObject): + amount_eligible: Optional[int] + """ + Amount used to calculate tip suggestions on tipping selection screen for this transaction. Must be a positive integer in the smallest currency unit (e.g., 100 cents to represent $1.00 or 100 to represent ¥100, a zero-decimal currency). + """ + + skip_tipping: Optional[bool] + """ + Override showing a tipping selection screen on this transaction. + """ + tipping: Optional[Tipping] + """ + Represents a per-transaction tipping configuration + """ + _inner_class_types = {"tipping": Tipping} + + payment_intent: ExpandableField["PaymentIntent"] + """ + Most recent PaymentIntent processed by the reader. + """ + process_config: Optional[ProcessConfig] + """ + Represents a per-transaction override of a reader configuration + """ + _inner_class_types = {"process_config": ProcessConfig} + + class ProcessSetupIntent(StripeObject): + class ProcessConfig(StripeObject): + pass + + generated_card: Optional[str] + """ + ID of a card PaymentMethod generated from the card_present PaymentMethod that may be attached to a Customer for future transactions. Only present if it was possible to generate a card PaymentMethod. + """ + process_config: Optional[ProcessConfig] + """ + Represents a per-setup override of a reader configuration + """ + setup_intent: ExpandableField["SetupIntent"] + """ + Most recent SetupIntent processed by the reader. + """ + _inner_class_types = {"process_config": ProcessConfig} + + class RefundPayment(StripeObject): + amount: Optional[int] + """ + The amount being refunded. + """ + charge: Optional[ExpandableField["Charge"]] + """ + Charge that is being refunded. + """ + metadata: Optional[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. + """ + payment_intent: Optional[ExpandableField["PaymentIntent"]] + """ + Payment intent that is being refunded. + """ + reason: Optional[ + Literal["duplicate", "fraudulent", "requested_by_customer"] + ] + """ + The reason for the refund. + """ + refund: Optional[ExpandableField["Refund"]] + """ + Unique identifier for the refund object. + """ + refund_application_fee: Optional[bool] + """ + Boolean indicating whether the application fee should be refunded when refunding this charge. If a full charge refund is given, the full application fee will be refunded. Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. An application fee can be refunded only by the application that created the charge. + """ + reverse_transfer: Optional[bool] + """ + Boolean indicating whether the transfer should be reversed when refunding this charge. The transfer will be reversed proportionally to the amount being refunded (either the entire or partial amount). A transfer can be reversed only by the application that created the charge. + """ + + class SetReaderDisplay(StripeObject): + class Cart(StripeObject): + class LineItem(StripeObject): + amount: int + """ + The amount of the line item. A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + description: str + """ + Description of the line item. + """ + quantity: int + """ + The quantity of the line item. + """ + + 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). + """ + line_items: List[LineItem] + """ + List of line items in the cart. + """ + tax: Optional[int] + """ + Tax amount for the entire cart. A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + total: int + """ + Total amount for the entire cart, including tax. A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + """ + _inner_class_types = {"line_items": LineItem} + + cart: Optional[Cart] + """ + Cart object to be displayed by the reader. + """ + type: Literal["cart"] + """ + Type of information to be displayed by the reader. + """ + _inner_class_types = {"cart": Cart} + + failure_code: Optional[str] + """ + Failure code, only set if status is `failed`. + """ + failure_message: Optional[str] + """ + Detailed failure message, only set if status is `failed`. + """ + process_payment_intent: Optional[ProcessPaymentIntent] + """ + Represents a reader action to process a payment intent + """ + process_setup_intent: Optional[ProcessSetupIntent] + """ + Represents a reader action to process a setup intent + """ + refund_payment: Optional[RefundPayment] + """ + Represents a reader action to refund a payment + """ + set_reader_display: Optional[SetReaderDisplay] + """ + Represents a reader action to set the reader display + """ + status: Literal["failed", "in_progress", "succeeded"] + """ + Status of the action performed by the reader. + """ + type: Literal[ + "process_payment_intent", + "process_setup_intent", + "refund_payment", + "set_reader_display", + ] + """ + Type of action performed by the reader. + """ + _inner_class_types = { + "process_payment_intent": ProcessPaymentIntent, + "process_setup_intent": ProcessSetupIntent, + "refund_payment": RefundPayment, + "set_reader_display": SetReaderDisplay, + } + if TYPE_CHECKING: class CancelActionParams(RequestOptions): @@ -303,7 +479,7 @@ class PresentPaymentMethodParamsCardPresent(TypedDict): The card number, as a string without any separators. """ - action: Optional[StripeObject] + action: Optional[Action] """ The most recent action performed by the reader. """ @@ -832,5 +1008,7 @@ def present_payment_method( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = {"action": Action} + Reader.TestHelpers._resource_cls = Reader diff --git a/stripe/api_resources/treasury/credit_reversal.py b/stripe/api_resources/treasury/credit_reversal.py index cdcd6d9e6..70a850d57 100644 --- a/stripe/api_resources/treasury/credit_reversal.py +++ b/stripe/api_resources/treasury/credit_reversal.py @@ -26,6 +26,13 @@ class CreditReversal( OBJECT_NAME: ClassVar[ Literal["treasury.credit_reversal"] ] = "treasury.credit_reversal" + + class StatusTransitions(StripeObject): + posted_at: Optional[int] + """ + Timestamp describing when the CreditReversal changed status to `posted` + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -128,7 +135,7 @@ class RetrieveParams(RequestOptions): """ Status of the CreditReversal """ - status_transitions: StripeObject + status_transitions: StatusTransitions transaction: Optional[ExpandableField["Transaction"]] """ The Transaction associated with this object. @@ -188,3 +195,5 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = {"status_transitions": StatusTransitions} diff --git a/stripe/api_resources/treasury/debit_reversal.py b/stripe/api_resources/treasury/debit_reversal.py index 8060bf1bf..4e9f50061 100644 --- a/stripe/api_resources/treasury/debit_reversal.py +++ b/stripe/api_resources/treasury/debit_reversal.py @@ -26,6 +26,19 @@ class DebitReversal( OBJECT_NAME: ClassVar[ Literal["treasury.debit_reversal"] ] = "treasury.debit_reversal" + + class LinkedFlows(StripeObject): + issuing_dispute: Optional[str] + """ + Set if there is an Issuing dispute associated with the DebitReversal. + """ + + class StatusTransitions(StripeObject): + completed_at: Optional[int] + """ + Timestamp describing when the DebitReversal changed status to `completed`. + """ + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -108,7 +121,7 @@ class RetrieveParams(RequestOptions): """ Unique identifier for the object. """ - linked_flows: Optional[StripeObject] + linked_flows: Optional[LinkedFlows] """ Other flows linked to a DebitReversal. """ @@ -136,7 +149,7 @@ class RetrieveParams(RequestOptions): """ Status of the DebitReversal """ - status_transitions: StripeObject + status_transitions: StatusTransitions transaction: Optional[ExpandableField["Transaction"]] """ The Transaction associated with this object. @@ -196,3 +209,8 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "linked_flows": LinkedFlows, + "status_transitions": StatusTransitions, + } diff --git a/stripe/api_resources/treasury/financial_account.py b/stripe/api_resources/treasury/financial_account.py index 44e537c23..383920143 100644 --- a/stripe/api_resources/treasury/financial_account.py +++ b/stripe/api_resources/treasury/financial_account.py @@ -39,6 +39,83 @@ class FinancialAccount( OBJECT_NAME: ClassVar[ Literal["treasury.financial_account"] ] = "treasury.financial_account" + + class Balance(StripeObject): + cash: Dict[str, int] + """ + Funds the user can spend right now. + """ + inbound_pending: Dict[str, int] + """ + Funds not spendable yet, but will become available at a later time. + """ + outbound_pending: Dict[str, int] + """ + Funds in the account, but not spendable because they are being held for pending outbound flows. + """ + + class FinancialAddress(StripeObject): + class Aba(StripeObject): + account_holder_name: str + """ + The name of the person or business that owns the bank account. + """ + account_number: Optional[str] + """ + The account number. + """ + account_number_last4: str + """ + The last four characters of the account number. + """ + bank_name: str + """ + Name of the bank. + """ + routing_number: str + """ + Routing number for the account. + """ + + aba: Optional[Aba] + """ + ABA Records contain U.S. bank account details per the ABA format. + """ + supported_networks: Optional[List[Literal["ach", "us_domestic_wire"]]] + """ + The list of networks that the address supports + """ + type: Literal["aba"] + """ + The type of financial address + """ + _inner_class_types = {"aba": Aba} + + class PlatformRestrictions(StripeObject): + inbound_flows: Optional[Literal["restricted", "unrestricted"]] + """ + Restricts all inbound money movement. + """ + outbound_flows: Optional[Literal["restricted", "unrestricted"]] + """ + Restricts all outbound money movement. + """ + + class StatusDetails(StripeObject): + class Closed(StripeObject): + reasons: List[ + Literal["account_rejected", "closed_by_platform", "other"] + ] + """ + The array that contains reasons for a FinancialAccount closure. + """ + + closed: Optional[Closed] + """ + Details related to the closure of this FinancialAccount + """ + _inner_class_types = {"closed": Closed} + if TYPE_CHECKING: class CreateParams(RequestOptions): @@ -611,7 +688,7 @@ class UpdateFeaturesParamsCardIssuing(TypedDict): """ The array of paths to active Features in the Features hash. """ - balance: StripeObject + balance: Balance """ Balance information for the FinancialAccount """ @@ -628,7 +705,7 @@ class UpdateFeaturesParamsCardIssuing(TypedDict): Encodes whether a FinancialAccount has access to a particular Feature, with a `status` enum and associated `status_details`. Stripe or the platform can control Features via the requested field. """ - financial_addresses: List[StripeObject] + financial_addresses: List[FinancialAddress] """ The set of credentials that resolve to a FinancialAccount. """ @@ -667,7 +744,7 @@ class UpdateFeaturesParamsCardIssuing(TypedDict): """ The array of paths to pending Features in the Features hash. """ - platform_restrictions: Optional[StripeObject] + platform_restrictions: Optional[PlatformRestrictions] """ The set of functionalities that the platform can restrict on the FinancialAccount. """ @@ -694,7 +771,7 @@ class UpdateFeaturesParamsCardIssuing(TypedDict): """ The enum specifying what state the account is in. """ - status_details: StripeObject + status_details: StatusDetails supported_currencies: List[str] """ The currencies the FinancialAccount can hold a balance in. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -886,3 +963,10 @@ def update_features( # pyright: ignore[reportGeneralTypeIssues] params=params, ), ) + + _inner_class_types = { + "balance": Balance, + "financial_addresses": FinancialAddress, + "platform_restrictions": PlatformRestrictions, + "status_details": StatusDetails, + } diff --git a/stripe/api_resources/treasury/financial_account_features.py b/stripe/api_resources/treasury/financial_account_features.py index 59e3bc32f..9411f8ad4 100644 --- a/stripe/api_resources/treasury/financial_account_features.py +++ b/stripe/api_resources/treasury/financial_account_features.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe.stripe_object import StripeObject -from typing import ClassVar, Optional +from typing import ClassVar, List, Optional from typing_extensions import Literal @@ -14,23 +14,477 @@ class FinancialAccountFeatures(StripeObject): OBJECT_NAME: ClassVar[ Literal["treasury.financial_account_features"] ] = "treasury.financial_account_features" - card_issuing: Optional[StripeObject] + + class CardIssuing(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[Literal["inbound_flows", "outbound_flows"]] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + class DepositInsurance(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[Literal["inbound_flows", "outbound_flows"]] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + class FinancialAddresses(StripeObject): + class Aba(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[ + Literal["inbound_flows", "outbound_flows"] + ] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + aba: Optional[Aba] + """ + Toggle settings for enabling/disabling the ABA address feature + """ + _inner_class_types = {"aba": Aba} + + class InboundTransfers(StripeObject): + class Ach(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[ + Literal["inbound_flows", "outbound_flows"] + ] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + ach: Optional[Ach] + """ + Toggle settings for enabling/disabling an ACH specific feature + """ + _inner_class_types = {"ach": Ach} + + class IntraStripeFlows(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[Literal["inbound_flows", "outbound_flows"]] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + class OutboundPayments(StripeObject): + class Ach(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[ + Literal["inbound_flows", "outbound_flows"] + ] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + class UsDomesticWire(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[ + Literal["inbound_flows", "outbound_flows"] + ] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + ach: Optional[Ach] + """ + Toggle settings for enabling/disabling an ACH specific feature + """ + us_domestic_wire: Optional[UsDomesticWire] + """ + Toggle settings for enabling/disabling a feature + """ + _inner_class_types = {"ach": Ach, "us_domestic_wire": UsDomesticWire} + + class OutboundTransfers(StripeObject): + class Ach(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[ + Literal["inbound_flows", "outbound_flows"] + ] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + class UsDomesticWire(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ] + """ + Represents the reason why the status is `pending` or `restricted`. + """ + resolution: Optional[ + Literal[ + "contact_stripe", + "provide_information", + "remove_restriction", + ] + ] + """ + Represents what the user should do, if anything, to activate the Feature. + """ + restriction: Optional[ + Literal["inbound_flows", "outbound_flows"] + ] + """ + The `platform_restrictions` that are restricting this Feature. + """ + + requested: bool + """ + Whether the FinancialAccount should have the Feature. + """ + status: Literal["active", "pending", "restricted"] + """ + Whether the Feature is operational. + """ + status_details: List[StatusDetail] + """ + Additional details; includes at least one entry when the status is not `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + ach: Optional[Ach] + """ + Toggle settings for enabling/disabling an ACH specific feature + """ + us_domestic_wire: Optional[UsDomesticWire] + """ + Toggle settings for enabling/disabling a feature + """ + _inner_class_types = {"ach": Ach, "us_domestic_wire": UsDomesticWire} + + card_issuing: Optional[CardIssuing] """ Toggle settings for enabling/disabling a feature """ - deposit_insurance: Optional[StripeObject] + deposit_insurance: Optional[DepositInsurance] """ Toggle settings for enabling/disabling a feature """ - financial_addresses: Optional[StripeObject] + financial_addresses: Optional[FinancialAddresses] """ Settings related to Financial Addresses features on a Financial Account """ - inbound_transfers: Optional[StripeObject] + inbound_transfers: Optional[InboundTransfers] """ InboundTransfers contains inbound transfers features for a FinancialAccount. """ - intra_stripe_flows: Optional[StripeObject] + intra_stripe_flows: Optional[IntraStripeFlows] """ Toggle settings for enabling/disabling a feature """ @@ -38,11 +492,21 @@ class FinancialAccountFeatures(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ - outbound_payments: Optional[StripeObject] + outbound_payments: Optional[OutboundPayments] """ Settings related to Outbound Payments features on a Financial Account """ - outbound_transfers: Optional[StripeObject] + outbound_transfers: Optional[OutboundTransfers] """ OutboundTransfers contains outbound transfers features for a FinancialAccount. """ + + _inner_class_types = { + "card_issuing": CardIssuing, + "deposit_insurance": DepositInsurance, + "financial_addresses": FinancialAddresses, + "inbound_transfers": InboundTransfers, + "intra_stripe_flows": IntraStripeFlows, + "outbound_payments": OutboundPayments, + "outbound_transfers": OutboundTransfers, + } diff --git a/stripe/api_resources/treasury/inbound_transfer.py b/stripe/api_resources/treasury/inbound_transfer.py index 0f8d2c1c0..dd98e4da3 100644 --- a/stripe/api_resources/treasury/inbound_transfer.py +++ b/stripe/api_resources/treasury/inbound_transfer.py @@ -36,6 +36,127 @@ class InboundTransfer( OBJECT_NAME: ClassVar[ Literal["treasury.inbound_transfer"] ] = "treasury.inbound_transfer" + + class FailureDetails(StripeObject): + code: Literal[ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "debit_not_authorized", + "incorrect_account_holder_address", + "incorrect_account_holder_name", + "incorrect_account_holder_tax_id", + "insufficient_funds", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ] + """ + Reason for the failure. + """ + + class LinkedFlows(StripeObject): + received_debit: Optional[str] + """ + If funds for this flow were returned after the flow went to the `succeeded` state, this field contains a reference to the ReceivedDebit return. + """ + + class OriginPaymentMethodDetails(StripeObject): + class BillingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Address + email: Optional[str] + """ + Email address. + """ + name: Optional[str] + """ + Full name. + """ + _inner_class_types = {"address": Address} + + class UsBankAccount(StripeObject): + account_holder_type: Optional[Literal["company", "individual"]] + """ + Account holder type: individual or company. + """ + account_type: Optional[Literal["checking", "savings"]] + """ + Account type: checkings or savings. Defaults to checking if omitted. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + network: Literal["ach"] + """ + The US bank account network used to debit funds. + """ + routing_number: Optional[str] + """ + Routing number of the bank account. + """ + + billing_details: BillingDetails + type: Literal["us_bank_account"] + """ + The type of the payment method used in the InboundTransfer. + """ + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "billing_details": BillingDetails, + "us_bank_account": UsBankAccount, + } + + class StatusTransitions(StripeObject): + canceled_at: Optional[int] + """ + Timestamp describing when an InboundTransfer changed status to `canceled`. + """ + failed_at: Optional[int] + """ + Timestamp describing when an InboundTransfer changed status to `failed`. + """ + succeeded_at: Optional[int] + """ + Timestamp describing when an InboundTransfer changed status to `succeeded`. + """ + if TYPE_CHECKING: class CancelParams(RequestOptions): @@ -164,7 +285,7 @@ class SucceedParams(RequestOptions): """ An arbitrary string attached to the object. Often useful for displaying to users. """ - failure_details: Optional[StripeObject] + failure_details: Optional[FailureDetails] """ Details about this InboundTransfer's failure. Only set when status is `failed`. """ @@ -180,7 +301,7 @@ class SucceedParams(RequestOptions): """ Unique identifier for the object. """ - linked_flows: StripeObject + linked_flows: LinkedFlows livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -197,7 +318,7 @@ class SucceedParams(RequestOptions): """ The origin payment method to be debited for an InboundTransfer. """ - origin_payment_method_details: Optional[StripeObject] + origin_payment_method_details: Optional[OriginPaymentMethodDetails] """ Details about the PaymentMethod for an InboundTransfer. """ @@ -213,7 +334,7 @@ class SucceedParams(RequestOptions): """ Status of the InboundTransfer: `processing`, `succeeded`, `failed`, and `canceled`. An InboundTransfer is `processing` if it is created and pending. The status changes to `succeeded` once the funds have been "confirmed" and a `transaction` is created and posted. The status changes to `failed` if the transfer fails. """ - status_transitions: StripeObject + status_transitions: StatusTransitions transaction: Optional[ExpandableField["Transaction"]] """ The Transaction associated with this object. @@ -525,5 +646,12 @@ def succeed( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "failure_details": FailureDetails, + "linked_flows": LinkedFlows, + "origin_payment_method_details": OriginPaymentMethodDetails, + "status_transitions": StatusTransitions, + } + InboundTransfer.TestHelpers._resource_cls = InboundTransfer diff --git a/stripe/api_resources/treasury/outbound_payment.py b/stripe/api_resources/treasury/outbound_payment.py index 112ad7ebb..8cd65e9c5 100644 --- a/stripe/api_resources/treasury/outbound_payment.py +++ b/stripe/api_resources/treasury/outbound_payment.py @@ -38,6 +38,148 @@ class OutboundPayment( OBJECT_NAME: ClassVar[ Literal["treasury.outbound_payment"] ] = "treasury.outbound_payment" + + class DestinationPaymentMethodDetails(StripeObject): + class BillingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Address + email: Optional[str] + """ + Email address. + """ + name: Optional[str] + """ + Full name. + """ + _inner_class_types = {"address": Address} + + class FinancialAccount(StripeObject): + id: str + """ + Token of the FinancialAccount. + """ + network: Literal["stripe"] + """ + The rails used to send funds. + """ + + class UsBankAccount(StripeObject): + account_holder_type: Optional[Literal["company", "individual"]] + """ + Account holder type: individual or company. + """ + account_type: Optional[Literal["checking", "savings"]] + """ + Account type: checkings or savings. Defaults to checking if omitted. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + network: Literal["ach", "us_domestic_wire"] + """ + The US bank account network used to send funds. + """ + routing_number: Optional[str] + """ + Routing number of the bank account. + """ + + billing_details: BillingDetails + financial_account: Optional[FinancialAccount] + type: Literal["financial_account", "us_bank_account"] + """ + The type of the payment method used in the OutboundPayment. + """ + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "billing_details": BillingDetails, + "financial_account": FinancialAccount, + "us_bank_account": UsBankAccount, + } + + class EndUserDetails(StripeObject): + ip_address: Optional[str] + """ + IP address of the user initiating the OutboundPayment. Set if `present` is set to `true`. IP address collection is required for risk and compliance reasons. This will be used to help determine if the OutboundPayment is authorized or should be blocked. + """ + present: bool + """ + `true` if the OutboundPayment creation request is being made on behalf of an end user by a platform. Otherwise, `false`. + """ + + class ReturnedDetails(StripeObject): + code: Literal[ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "declined", + "incorrect_account_holder_name", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ] + """ + Reason for the return. + """ + transaction: ExpandableField["Transaction"] + """ + The Transaction associated with this object. + """ + + class StatusTransitions(StripeObject): + canceled_at: Optional[int] + """ + Timestamp describing when an OutboundPayment changed status to `canceled`. + """ + failed_at: Optional[int] + """ + Timestamp describing when an OutboundPayment changed status to `failed`. + """ + posted_at: Optional[int] + """ + Timestamp describing when an OutboundPayment changed status to `posted`. + """ + returned_at: Optional[int] + """ + Timestamp describing when an OutboundPayment changed status to `returned`. + """ + if TYPE_CHECKING: class CancelParams(RequestOptions): @@ -326,11 +468,13 @@ class ReturnOutboundPaymentParamsReturnedDetails(TypedDict): """ The PaymentMethod via which an OutboundPayment is sent. This field can be empty if the OutboundPayment was created using `destination_payment_method_data`. """ - destination_payment_method_details: Optional[StripeObject] + destination_payment_method_details: Optional[ + DestinationPaymentMethodDetails + ] """ Details about the PaymentMethod for an OutboundPayment. """ - end_user_details: Optional[StripeObject] + end_user_details: Optional[EndUserDetails] """ Details about the end user. """ @@ -362,7 +506,7 @@ class ReturnOutboundPaymentParamsReturnedDetails(TypedDict): """ String representing the object's type. Objects of the same type share the same value. """ - returned_details: Optional[StripeObject] + returned_details: Optional[ReturnedDetails] """ Details about a returned OutboundPayment. Only set when the status is `returned`. """ @@ -374,7 +518,7 @@ class ReturnOutboundPaymentParamsReturnedDetails(TypedDict): """ Current status of the OutboundPayment: `processing`, `failed`, `posted`, `returned`, `canceled`. An OutboundPayment is `processing` if it has been created and is pending. The status changes to `posted` once the OutboundPayment has been "confirmed" and funds have left the account, or to `failed` or `canceled`. If an OutboundPayment fails to arrive at its destination, its status will change to `returned`. """ - status_transitions: StripeObject + status_transitions: StatusTransitions transaction: ExpandableField["Transaction"] """ The Transaction associated with this object. @@ -686,5 +830,12 @@ def return_outbound_payment( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "destination_payment_method_details": DestinationPaymentMethodDetails, + "end_user_details": EndUserDetails, + "returned_details": ReturnedDetails, + "status_transitions": StatusTransitions, + } + OutboundPayment.TestHelpers._resource_cls = OutboundPayment diff --git a/stripe/api_resources/treasury/outbound_transfer.py b/stripe/api_resources/treasury/outbound_transfer.py index 61b907ea4..1369f8bd8 100644 --- a/stripe/api_resources/treasury/outbound_transfer.py +++ b/stripe/api_resources/treasury/outbound_transfer.py @@ -38,6 +38,126 @@ class OutboundTransfer( OBJECT_NAME: ClassVar[ Literal["treasury.outbound_transfer"] ] = "treasury.outbound_transfer" + + class DestinationPaymentMethodDetails(StripeObject): + class BillingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Address + email: Optional[str] + """ + Email address. + """ + name: Optional[str] + """ + Full name. + """ + _inner_class_types = {"address": Address} + + class UsBankAccount(StripeObject): + account_holder_type: Optional[Literal["company", "individual"]] + """ + Account holder type: individual or company. + """ + account_type: Optional[Literal["checking", "savings"]] + """ + Account type: checkings or savings. Defaults to checking if omitted. + """ + bank_name: Optional[str] + """ + Name of the bank associated with the bank account. + """ + fingerprint: Optional[str] + """ + Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + """ + last4: Optional[str] + """ + Last four digits of the bank account number. + """ + network: Literal["ach", "us_domestic_wire"] + """ + The US bank account network used to send funds. + """ + routing_number: Optional[str] + """ + Routing number of the bank account. + """ + + billing_details: BillingDetails + type: Literal["us_bank_account"] + """ + The type of the payment method used in the OutboundTransfer. + """ + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "billing_details": BillingDetails, + "us_bank_account": UsBankAccount, + } + + class ReturnedDetails(StripeObject): + code: Literal[ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "declined", + "incorrect_account_holder_name", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ] + """ + Reason for the return. + """ + transaction: ExpandableField["Transaction"] + """ + The Transaction associated with this object. + """ + + class StatusTransitions(StripeObject): + canceled_at: Optional[int] + """ + Timestamp describing when an OutboundTransfer changed status to `canceled` + """ + failed_at: Optional[int] + """ + Timestamp describing when an OutboundTransfer changed status to `failed` + """ + posted_at: Optional[int] + """ + Timestamp describing when an OutboundTransfer changed status to `posted` + """ + returned_at: Optional[int] + """ + Timestamp describing when an OutboundTransfer changed status to `returned` + """ + if TYPE_CHECKING: class CancelParams(RequestOptions): @@ -192,7 +312,7 @@ class ReturnOutboundTransferParamsReturnedDetails(TypedDict): """ The PaymentMethod used as the payment instrument for an OutboundTransfer. """ - destination_payment_method_details: StripeObject + destination_payment_method_details: DestinationPaymentMethodDetails expected_arrival_date: int """ The date when funds are expected to arrive in the destination account. @@ -221,7 +341,7 @@ class ReturnOutboundTransferParamsReturnedDetails(TypedDict): """ String representing the object's type. Objects of the same type share the same value. """ - returned_details: Optional[StripeObject] + returned_details: Optional[ReturnedDetails] """ Details about a returned OutboundTransfer. Only set when the status is `returned`. """ @@ -233,7 +353,7 @@ class ReturnOutboundTransferParamsReturnedDetails(TypedDict): """ Current status of the OutboundTransfer: `processing`, `failed`, `canceled`, `posted`, `returned`. An OutboundTransfer is `processing` if it has been created and is pending. The status changes to `posted` once the OutboundTransfer has been "confirmed" and funds have left the account, or to `failed` or `canceled`. If an OutboundTransfer fails to arrive at its destination, its status will change to `returned`. """ - status_transitions: StripeObject + status_transitions: StatusTransitions transaction: ExpandableField["Transaction"] """ The Transaction associated with this object. @@ -551,5 +671,11 @@ def return_outbound_transfer( # pyright: ignore[reportGeneralTypeIssues] def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "destination_payment_method_details": DestinationPaymentMethodDetails, + "returned_details": ReturnedDetails, + "status_transitions": StatusTransitions, + } + OutboundTransfer.TestHelpers._resource_cls = OutboundTransfer diff --git a/stripe/api_resources/treasury/received_credit.py b/stripe/api_resources/treasury/received_credit.py index f0cba9efe..19162c589 100644 --- a/stripe/api_resources/treasury/received_credit.py +++ b/stripe/api_resources/treasury/received_credit.py @@ -19,6 +19,9 @@ ) if TYPE_CHECKING: + from stripe.api_resources.payout import Payout + from stripe.api_resources.treasury.credit_reversal import CreditReversal + from stripe.api_resources.treasury.outbound_payment import OutboundPayment from stripe.api_resources.treasury.transaction import Transaction @@ -30,6 +33,171 @@ class ReceivedCredit(ListableAPIResource["ReceivedCredit"]): OBJECT_NAME: ClassVar[ Literal["treasury.received_credit"] ] = "treasury.received_credit" + + class InitiatingPaymentMethodDetails(StripeObject): + class BillingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Address + email: Optional[str] + """ + Email address. + """ + name: Optional[str] + """ + Full name. + """ + _inner_class_types = {"address": Address} + + class FinancialAccount(StripeObject): + id: str + """ + The FinancialAccount ID. + """ + network: Literal["stripe"] + """ + The rails the ReceivedCredit was sent over. A FinancialAccount can only send funds over `stripe`. + """ + + class UsBankAccount(StripeObject): + bank_name: Optional[str] + """ + Bank name. + """ + last4: Optional[str] + """ + The last four digits of the bank account number. + """ + routing_number: Optional[str] + """ + The routing number for the bank account. + """ + + balance: Optional[Literal["payments"]] + """ + Set when `type` is `balance`. + """ + billing_details: BillingDetails + financial_account: Optional[FinancialAccount] + issuing_card: Optional[str] + """ + Set when `type` is `issuing_card`. This is an [Issuing Card](https://stripe.com/docs/api#issuing_cards) ID. + """ + type: Literal[ + "balance", + "financial_account", + "issuing_card", + "stripe", + "us_bank_account", + ] + """ + Polymorphic type matching the originating money movement's source. This can be an external account, a Stripe balance, or a FinancialAccount. + """ + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "billing_details": BillingDetails, + "financial_account": FinancialAccount, + "us_bank_account": UsBankAccount, + } + + class LinkedFlows(StripeObject): + class SourceFlowDetails(StripeObject): + credit_reversal: Optional["CreditReversal"] + """ + You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal. + """ + outbound_payment: Optional["OutboundPayment"] + """ + Use OutboundPayments to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers). + + Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects. + """ + payout: Optional["Payout"] + """ + A `Payout` object is created when you receive funds from Stripe, or when you + initiate a payout to either a bank account or debit card of a [connected + Stripe account](https://stripe.com/docs/connect/bank-debit-card-payouts). You can retrieve individual payouts, + and list all payouts. Payouts are made on [varying + schedules](https://stripe.com/docs/connect/manage-payout-schedule), depending on your country and + industry. + + Related guide: [Receiving payouts](https://stripe.com/docs/payouts) + """ + type: Literal[ + "credit_reversal", "other", "outbound_payment", "payout" + ] + """ + The type of the source flow that originated the ReceivedCredit. + """ + + credit_reversal: Optional[str] + """ + The CreditReversal created as a result of this ReceivedCredit being reversed. + """ + issuing_authorization: Optional[str] + """ + Set if the ReceivedCredit was created due to an [Issuing Authorization](https://stripe.com/docs/api#issuing_authorizations) object. + """ + issuing_transaction: Optional[str] + """ + Set if the ReceivedCredit is also viewable as an [Issuing transaction](https://stripe.com/docs/api#issuing_transactions) object. + """ + source_flow: Optional[str] + """ + ID of the source flow. Set if `network` is `stripe` and the source flow is visible to the user. Examples of source flows include OutboundPayments, payouts, or CreditReversals. + """ + source_flow_details: Optional[SourceFlowDetails] + """ + The expandable object of the source flow. + """ + source_flow_type: Optional[str] + """ + The type of flow that originated the ReceivedCredit (for example, `outbound_payment`). + """ + _inner_class_types = {"source_flow_details": SourceFlowDetails} + + class ReversalDetails(StripeObject): + deadline: Optional[int] + """ + Time before which a ReceivedCredit can be reversed. + """ + restricted_reason: Optional[ + Literal[ + "already_reversed", + "deadline_passed", + "network_restricted", + "other", + "source_flow_restricted", + ] + ] + """ + Set if a ReceivedCredit cannot be reversed. + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -172,8 +340,8 @@ class CreateParamsInitiatingPaymentMethodDetailsUsBankAccount( """ Unique identifier for the object. """ - initiating_payment_method_details: StripeObject - linked_flows: StripeObject + initiating_payment_method_details: InitiatingPaymentMethodDetails + linked_flows: LinkedFlows livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -186,7 +354,7 @@ class CreateParamsInitiatingPaymentMethodDetailsUsBankAccount( """ String representing the object's type. Objects of the same type share the same value. """ - reversal_details: Optional[StripeObject] + reversal_details: Optional[ReversalDetails] """ Details describing when a ReceivedCredit may be reversed. """ @@ -259,5 +427,11 @@ def create( def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "initiating_payment_method_details": InitiatingPaymentMethodDetails, + "linked_flows": LinkedFlows, + "reversal_details": ReversalDetails, + } + ReceivedCredit.TestHelpers._resource_cls = ReceivedCredit diff --git a/stripe/api_resources/treasury/received_debit.py b/stripe/api_resources/treasury/received_debit.py index 1e419e002..1a93dbe71 100644 --- a/stripe/api_resources/treasury/received_debit.py +++ b/stripe/api_resources/treasury/received_debit.py @@ -30,6 +30,133 @@ class ReceivedDebit(ListableAPIResource["ReceivedDebit"]): OBJECT_NAME: ClassVar[ Literal["treasury.received_debit"] ] = "treasury.received_debit" + + class InitiatingPaymentMethodDetails(StripeObject): + class BillingDetails(StripeObject): + class Address(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + + address: Address + email: Optional[str] + """ + Email address. + """ + name: Optional[str] + """ + Full name. + """ + _inner_class_types = {"address": Address} + + class FinancialAccount(StripeObject): + id: str + """ + The FinancialAccount ID. + """ + network: Literal["stripe"] + """ + The rails the ReceivedCredit was sent over. A FinancialAccount can only send funds over `stripe`. + """ + + class UsBankAccount(StripeObject): + bank_name: Optional[str] + """ + Bank name. + """ + last4: Optional[str] + """ + The last four digits of the bank account number. + """ + routing_number: Optional[str] + """ + The routing number for the bank account. + """ + + balance: Optional[Literal["payments"]] + """ + Set when `type` is `balance`. + """ + billing_details: BillingDetails + financial_account: Optional[FinancialAccount] + issuing_card: Optional[str] + """ + Set when `type` is `issuing_card`. This is an [Issuing Card](https://stripe.com/docs/api#issuing_cards) ID. + """ + type: Literal[ + "balance", + "financial_account", + "issuing_card", + "stripe", + "us_bank_account", + ] + """ + Polymorphic type matching the originating money movement's source. This can be an external account, a Stripe balance, or a FinancialAccount. + """ + us_bank_account: Optional[UsBankAccount] + _inner_class_types = { + "billing_details": BillingDetails, + "financial_account": FinancialAccount, + "us_bank_account": UsBankAccount, + } + + class LinkedFlows(StripeObject): + debit_reversal: Optional[str] + """ + The DebitReversal created as a result of this ReceivedDebit being reversed. + """ + inbound_transfer: Optional[str] + """ + Set if the ReceivedDebit is associated with an InboundTransfer's return of funds. + """ + issuing_authorization: Optional[str] + """ + Set if the ReceivedDebit was created due to an [Issuing Authorization](https://stripe.com/docs/api#issuing_authorizations) object. + """ + issuing_transaction: Optional[str] + """ + Set if the ReceivedDebit is also viewable as an [Issuing Dispute](https://stripe.com/docs/api#issuing_disputes) object. + """ + + class ReversalDetails(StripeObject): + deadline: Optional[int] + """ + Time before which a ReceivedDebit can be reversed. + """ + restricted_reason: Optional[ + Literal[ + "already_reversed", + "deadline_passed", + "network_restricted", + "other", + "source_flow_restricted", + ] + ] + """ + Set if a ReceivedDebit can't be reversed. + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -160,8 +287,8 @@ class CreateParamsInitiatingPaymentMethodDetailsUsBankAccount( """ Unique identifier for the object. """ - initiating_payment_method_details: Optional[StripeObject] - linked_flows: StripeObject + initiating_payment_method_details: Optional[InitiatingPaymentMethodDetails] + linked_flows: LinkedFlows livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -174,7 +301,7 @@ class CreateParamsInitiatingPaymentMethodDetailsUsBankAccount( """ String representing the object's type. Objects of the same type share the same value. """ - reversal_details: Optional[StripeObject] + reversal_details: Optional[ReversalDetails] """ Details describing when a ReceivedDebit might be reversed. """ @@ -247,5 +374,11 @@ def create( def test_helpers(self): return self.TestHelpers(self) + _inner_class_types = { + "initiating_payment_method_details": InitiatingPaymentMethodDetails, + "linked_flows": LinkedFlows, + "reversal_details": ReversalDetails, + } + ReceivedDebit.TestHelpers._resource_cls = ReceivedDebit diff --git a/stripe/api_resources/treasury/transaction.py b/stripe/api_resources/treasury/transaction.py index 2656a1664..47af9b778 100644 --- a/stripe/api_resources/treasury/transaction.py +++ b/stripe/api_resources/treasury/transaction.py @@ -14,6 +14,16 @@ ) if TYPE_CHECKING: + from stripe.api_resources.issuing.authorization import Authorization + from stripe.api_resources.treasury.credit_reversal import CreditReversal + from stripe.api_resources.treasury.debit_reversal import DebitReversal + from stripe.api_resources.treasury.inbound_transfer import InboundTransfer + from stripe.api_resources.treasury.outbound_payment import OutboundPayment + from stripe.api_resources.treasury.outbound_transfer import ( + OutboundTransfer, + ) + from stripe.api_resources.treasury.received_credit import ReceivedCredit + from stripe.api_resources.treasury.received_debit import ReceivedDebit from stripe.api_resources.treasury.transaction_entry import ( TransactionEntry, ) @@ -27,6 +37,87 @@ class Transaction(ListableAPIResource["Transaction"]): OBJECT_NAME: ClassVar[ Literal["treasury.transaction"] ] = "treasury.transaction" + + class BalanceImpact(StripeObject): + cash: int + """ + The change made to funds the user can spend right now. + """ + inbound_pending: int + """ + The change made to funds that are not spendable yet, but will become available at a later time. + """ + outbound_pending: int + """ + The change made to funds in the account, but not spendable because they are being held for pending outbound flows. + """ + + class FlowDetails(StripeObject): + credit_reversal: Optional["CreditReversal"] + """ + You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal. + """ + debit_reversal: Optional["DebitReversal"] + """ + You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal. + """ + inbound_transfer: Optional["InboundTransfer"] + """ + Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. + """ + issuing_authorization: Optional["Authorization"] + """ + When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization` + object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the + purchase to be completed successfully. + + Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations) + """ + outbound_payment: Optional["OutboundPayment"] + """ + Use OutboundPayments to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers). + + Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects. + """ + outbound_transfer: Optional["OutboundTransfer"] + """ + Use OutboundTransfers to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account. + + Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects. + """ + received_credit: Optional["ReceivedCredit"] + """ + ReceivedCredits represent funds sent to a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) (for example, via ACH or wire). These money movements are not initiated from the FinancialAccount. + """ + received_debit: Optional["ReceivedDebit"] + """ + ReceivedDebits represent funds pulled from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts). These are not initiated from the FinancialAccount. + """ + type: Literal[ + "credit_reversal", + "debit_reversal", + "inbound_transfer", + "issuing_authorization", + "other", + "outbound_payment", + "outbound_transfer", + "received_credit", + "received_debit", + ] + """ + Type of the flow that created the Transaction. Set to the same value as `flow_type`. + """ + + class StatusTransitions(StripeObject): + posted_at: Optional[int] + """ + Timestamp describing when the Transaction changed status to `posted`. + """ + void_at: Optional[int] + """ + Timestamp describing when the Transaction changed status to `void`. + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -120,7 +211,7 @@ class RetrieveParams(RequestOptions): """ Amount (in cents) transferred. """ - balance_impact: StripeObject + balance_impact: BalanceImpact """ Change to a FinancialAccount's balance """ @@ -148,7 +239,7 @@ class RetrieveParams(RequestOptions): """ ID of the flow that created the Transaction. """ - flow_details: Optional[StripeObject] + flow_details: Optional[FlowDetails] """ Details of the flow that created the Transaction. """ @@ -182,7 +273,7 @@ class RetrieveParams(RequestOptions): """ Status of the Transaction. """ - status_transitions: StripeObject + status_transitions: StatusTransitions @classmethod def list( @@ -216,3 +307,9 @@ def retrieve( instance = cls(id, **params) instance.refresh() return instance + + _inner_class_types = { + "balance_impact": BalanceImpact, + "flow_details": FlowDetails, + "status_transitions": StatusTransitions, + } diff --git a/stripe/api_resources/treasury/transaction_entry.py b/stripe/api_resources/treasury/transaction_entry.py index 20a859bf9..4b4ebc026 100644 --- a/stripe/api_resources/treasury/transaction_entry.py +++ b/stripe/api_resources/treasury/transaction_entry.py @@ -15,6 +15,16 @@ ) if TYPE_CHECKING: + from stripe.api_resources.issuing.authorization import Authorization + from stripe.api_resources.treasury.credit_reversal import CreditReversal + from stripe.api_resources.treasury.debit_reversal import DebitReversal + from stripe.api_resources.treasury.inbound_transfer import InboundTransfer + from stripe.api_resources.treasury.outbound_payment import OutboundPayment + from stripe.api_resources.treasury.outbound_transfer import ( + OutboundTransfer, + ) + from stripe.api_resources.treasury.received_credit import ReceivedCredit + from stripe.api_resources.treasury.received_debit import ReceivedDebit from stripe.api_resources.treasury.transaction import Transaction @@ -26,6 +36,77 @@ class TransactionEntry(ListableAPIResource["TransactionEntry"]): OBJECT_NAME: ClassVar[ Literal["treasury.transaction_entry"] ] = "treasury.transaction_entry" + + class BalanceImpact(StripeObject): + cash: int + """ + The change made to funds the user can spend right now. + """ + inbound_pending: int + """ + The change made to funds that are not spendable yet, but will become available at a later time. + """ + outbound_pending: int + """ + The change made to funds in the account, but not spendable because they are being held for pending outbound flows. + """ + + class FlowDetails(StripeObject): + credit_reversal: Optional["CreditReversal"] + """ + You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal. + """ + debit_reversal: Optional["DebitReversal"] + """ + You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal. + """ + inbound_transfer: Optional["InboundTransfer"] + """ + Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. + """ + issuing_authorization: Optional["Authorization"] + """ + When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization` + object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the + purchase to be completed successfully. + + Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations) + """ + outbound_payment: Optional["OutboundPayment"] + """ + Use OutboundPayments to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers). + + Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects. + """ + outbound_transfer: Optional["OutboundTransfer"] + """ + Use OutboundTransfers to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account. + + Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects. + """ + received_credit: Optional["ReceivedCredit"] + """ + ReceivedCredits represent funds sent to a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) (for example, via ACH or wire). These money movements are not initiated from the FinancialAccount. + """ + received_debit: Optional["ReceivedDebit"] + """ + ReceivedDebits represent funds pulled from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts). These are not initiated from the FinancialAccount. + """ + type: Literal[ + "credit_reversal", + "debit_reversal", + "inbound_transfer", + "issuing_authorization", + "other", + "outbound_payment", + "outbound_transfer", + "received_credit", + "received_debit", + ] + """ + Type of the flow that created the Transaction. Set to the same value as `flow_type`. + """ + if TYPE_CHECKING: class ListParams(RequestOptions): @@ -104,7 +185,7 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - balance_impact: StripeObject + balance_impact: BalanceImpact """ Change to a FinancialAccount's balance """ @@ -128,7 +209,7 @@ class RetrieveParams(RequestOptions): """ Token of the flow associated with the TransactionEntry. """ - flow_details: Optional[StripeObject] + flow_details: Optional[FlowDetails] """ Details of the flow associated with the TransactionEntry. """ @@ -224,3 +305,8 @@ def retrieve( @classmethod def class_url(cls): return "/v1/treasury/transaction_entries" + + _inner_class_types = { + "balance_impact": BalanceImpact, + "flow_details": FlowDetails, + } diff --git a/stripe/api_resources/usage_record_summary.py b/stripe/api_resources/usage_record_summary.py index 10b654bc5..2e012b987 100644 --- a/stripe/api_resources/usage_record_summary.py +++ b/stripe/api_resources/usage_record_summary.py @@ -9,6 +9,17 @@ class UsageRecordSummary(StripeObject): OBJECT_NAME: ClassVar[ Literal["usage_record_summary"] ] = "usage_record_summary" + + class Period(StripeObject): + end: Optional[int] + """ + The end date of this usage period. All usage up to and including this point in time is included. + """ + start: Optional[int] + """ + The start date of this usage period. All usage after this point in time is included. + """ + id: str """ Unique identifier for the object. @@ -25,7 +36,7 @@ class UsageRecordSummary(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ - period: StripeObject + period: Period subscription_item: str """ The ID of the subscription item this summary is describing. @@ -34,3 +45,5 @@ class UsageRecordSummary(StripeObject): """ The total usage within this usage period. """ + + _inner_class_types = {"period": Period} diff --git a/stripe/stripe_object.py b/stripe/stripe_object.py index b8d18c592..ecc83448f 100644 --- a/stripe/stripe_object.py +++ b/stripe/stripe_object.py @@ -2,7 +2,7 @@ import datetime import json from copy import deepcopy -from typing_extensions import TYPE_CHECKING, Literal, Self +from typing_extensions import TYPE_CHECKING, Type, Literal, Self from typing import ( Any, Dict, @@ -11,6 +11,7 @@ Mapping, Set, Tuple, + ClassVar, Union, cast, overload, @@ -266,12 +267,38 @@ def refresh_from( self._transient_values = self._transient_values - set(values) for k, v in values.items(): - super(StripeObject, self).__setitem__( - k, - util.convert_to_stripe_object( - v, api_key, stripe_version, stripe_account - ), - ) + inner_class = self._get_inner_class_type(k) + is_dict = self._get_inner_class_is_beneath_dict(k) + if is_dict: + obj = { + k: None + if v is None + else cast( + StripeObject, + util.convert_to_stripe_object( + v, + api_key, + stripe_version, + stripe_account, + None, + inner_class, + ), + ) + for k, v in v.items() + } + else: + obj = cast( + Union[StripeObject, List[StripeObject]], + util.convert_to_stripe_object( + v, + api_key, + stripe_version, + stripe_account, + None, + inner_class, + ), + ) + super(StripeObject, self).__setitem__(k, obj) self._previous = values @@ -465,3 +492,14 @@ def __deepcopy__(self, memo: Dict[int, Any]) -> Self: super(StripeObject, copied).__setitem__(k, deepcopy(v, memo)) return copied + + _inner_class_types: ClassVar[Dict[str, Type["StripeObject"]]] = {} + _inner_class_dicts: ClassVar[List[str]] = [] + + def _get_inner_class_type( + self, field_name: str + ) -> Optional[Type["StripeObject"]]: + return self._inner_class_types.get(field_name) + + def _get_inner_class_is_beneath_dict(self, field_name: str): + return field_name in self._inner_class_dicts diff --git a/stripe/util.py b/stripe/util.py index 9f95314cd..f40902421 100644 --- a/stripe/util.py +++ b/stripe/util.py @@ -213,6 +213,7 @@ def convert_to_stripe_object( stripe_version: Optional[str] = None, stripe_account: Optional[str] = None, params: Optional[Dict[str, Any]] = None, + klass_: Optional[Type["StripeObject"]] = None, ) -> "StripeObject": ... @@ -224,6 +225,7 @@ def convert_to_stripe_object( stripe_version: Optional[str] = None, stripe_account: Optional[str] = None, params: Optional[Dict[str, Any]] = None, + klass_: Optional[Type["StripeObject"]] = None, ) -> List["StripeObject"]: ... @@ -234,6 +236,7 @@ def convert_to_stripe_object( stripe_version: Optional[str] = None, stripe_account: Optional[str] = None, params: Optional[Dict[str, Any]] = None, + klass_: Optional[Type["StripeObject"]] = None, ) -> Union["StripeObject", List["StripeObject"]]: # If we get a StripeResponse, we'll want to return a # StripeObject with the last_response field filled out with @@ -251,6 +254,7 @@ def convert_to_stripe_object( api_key, stripe_version, stripe_account, + klass_=klass_, ) for i in resp ] @@ -263,6 +267,8 @@ def convert_to_stripe_object( klass = get_object_classes().get( klass_name, stripe.stripe_object.StripeObject ) + elif klass_ is not None: + klass = klass_ else: klass = stripe.stripe_object.StripeObject