diff --git a/.hark/changes/2026-11-09_stripe-openapi_67eb12fb.change.md b/.hark/changes/2026-11-09_stripe-openapi_67eb12fb.change.md new file mode 100644 index 000000000..6546d09ab --- /dev/null +++ b/.hark/changes/2026-11-09_stripe-openapi_67eb12fb.change.md @@ -0,0 +1,29 @@ +--- +title: Update generated code +pr_url: https://github.com/stripe/stripe-python/pull/1969 +semver_level: major +is_stripe_api_change: true +--- + +* Add support for new resource `v2.money_management.SpendingMandate` +* Add support for `cancel`, `list`, and `retrieve` methods on resource `v2.money_management.SpendingMandate` +* Add support for `cardholder_message` on `Charge.PaymentMethodDetail.CardPresent.Receipt`, `ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetail.CardPresent.Receipt`, `PaymentAttemptRecord.PaymentMethodDetail.CardPresent.Receipt`, `PaymentMethod.Card.GeneratedFrom.PaymentMethodDetail.CardPresent.Receipt`, and `PaymentRecord.PaymentMethodDetail.CardPresent.Receipt` +* Add support for `pricing_token` on `checkout.SessionCreateParams` +* Add support for `marketing_attributions` on `CustomerModifyParams` +* Add support for `fraudulent_selfie` on `Identity.VerificationReport.Signal` +* Add support for `toss_pay` on `Mandate.PaymentMethodDetail`, `PaymentMethodConfigurationCreateParams`, `PaymentMethodConfigurationModifyParams`, `PaymentMethodConfiguration`, and `SetupAttempt.PaymentMethodDetail` +* Add support for `payment_evaluations` on `PaymentAttemptRecordReportAuthenticatedParams` +* Add support for `three_d_secure` on `PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailCard`, `PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailCard`, `PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailCard`, `PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailCard`, and `PaymentRecordReportPaymentParamsPaymentMethodDetailCard` +* Add support for `wechat_pay_redirect_to_mini_program` on `PaymentIntent.NextAction` +* Add support for `customer_presence` and `payment_type` on `Radar.PaymentEvaluation.PaymentDetail.MoneyMovementDetail.SepaDebit` and `radar.PaymentEvaluationCreateParamsPaymentDetailMoneyMovementDetailSepaDebit` +* Add support for `financial_connections` on `SetupIntent.PaymentMethodOption.BacsDebit`, `SetupIntentConfirmParamsPaymentMethodOptionBacsDebit`, `SetupIntentCreateParamsPaymentMethodOptionBacsDebit`, and `SetupIntentModifyParamsPaymentMethodOptionBacsDebit` +* Add support for `referral_fee_details` on `SharedPayment.GrantedToken`, `SharedPayment.IssuedToken`, and `shared_payment.IssuedTokenCreateParams` +* Add support for new values `stripe_s700_devkit`, `stripe_s710_devkit`, `stripe_t600_devkit`, `verifone_ux700_devkit`, and `verifone_v660p_devkit` on enum `terminal.ReaderListParams.device_type` +* Add support for `device_health_details` and `device_health` on `Terminal.Reader` +* Add support for new values `check_attachment_too_large`, `check_expired`, and `check_undeliverable` on enum `V2.MoneyManagement.OutboundPayment.StatusDetail.Failed.reason` +* Add support for `check_send` on `V2.MoneyManagement.OutboundPayment.To.PayoutMethodOption`, `V2.MoneyManagement.OutboundPayment.TrackingDetail`, `V2.MoneyManagement.PayoutIntent.To.PayoutMethodOption`, `V2.MoneyManagement.PayoutMethod`, `v2.money_management.OutboundPaymentCreateParamsToPayoutMethodOption`, `v2.money_management.OutboundSetupIntentCreateParamsPayoutMethodDatum`, `v2.money_management.PayoutIntentCreateParamsToPayoutMethodOption`, and `v2.money_management.PayoutIntentModifyParamsToPayoutMethodOption` +* Add support for new values `check_attachment_too_large`, `check_expired`, and `check_undeliverable` on enum `V2.MoneyManagement.PayoutIntent.NextAction.HandleFailure.failure_reason` +* Add support for new value `check_send` on enums `V2.MoneyManagement.PayoutMethod.type`, `v2.money_management.OutboundSetupIntentCreateParamsPayoutMethodDatum.type`, and `v2.money_management.OutboundSetupIntentModifyParamsPayoutMethodDatum.type` +* Add support for `spending_mandate` on `V2.MoneyManagement.ReceivedDebit.BankTransfer` and `v2.money_management.ReceivedDebitListParams` +* Add support for event notifications `V2MoneyManagementSpendingMandateCanceledEvent`, `V2MoneyManagementSpendingMandateCreatedEvent`, `V2MoneyManagementSpendingMandateExpiredEvent`, `V2MoneyManagementSpendingMandatePendingCancellationEvent`, and `V2MoneyManagementSpendingMandateUpdatedEvent` with related object `v2.money_management.SpendingMandate` +* ⚠️ Add error type `MerchantNotGatedError` on `v2.core.vault.NetworkToken#create_from_credential` diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 4be7b4d4f..6e0b23f57 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -df2bff12c487cb1d6af4f5bd7debe8dea8b01e47 \ No newline at end of file +5b1e713ce463b45ef5e0d44fe81667a61fd28115 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 14c7fa5db..71a784933 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2598 \ No newline at end of file +v2600 \ No newline at end of file diff --git a/README.md b/README.md index f851cec19..c40ed3e96 100644 --- a/README.md +++ b/README.md @@ -471,12 +471,6 @@ just format # or: venv/bin/ruff format . --quiet ``` -Update bundled CA certificates from the [Mozilla cURL release][curl]: - -```sh -just update-certs -``` - [api-keys]: https://dashboard.stripe.com/account/apikeys [ruff]: https://github.com/astral-sh/ruff [connect]: https://stripe.com/connect diff --git a/justfile b/justfile index b156e797c..5e38fb99d 100644 --- a/justfile +++ b/justfile @@ -75,9 +75,6 @@ install group: venv # always log deps in CI, but don't do it locally python -I -m pip install -r deps/{{ group }}-requirements.txt --disable-pip-version-check {{ if env("CI", "") == "true" {""} else if is_dependency() == "true" {"--quiet"} else {""} }} -update-certs: - curl -o stripe/data/ca-certificates.crt https://curl.se/ca/cacert.pem - # create a virtualenv if it doesn't exist; always installs the local package [private] venv: diff --git a/stripe/_api_requestor.py b/stripe/_api_requestor.py index 920b32a36..3cd1fc391 100644 --- a/stripe/_api_requestor.py +++ b/stripe/_api_requestor.py @@ -65,6 +65,7 @@ if TYPE_CHECKING: from stripe._app_info import AppInfo from stripe._stripe_object import StripeObject + from stripe._stripe_context import StripeContext HttpVerb = Literal["get", "post", "delete"] @@ -174,6 +175,24 @@ def _new_requestor_with_options( options=RequestorOptions(**new_options), client=self._client ) + def with_stripe_context( + self, stripe_context: "Optional[Union[str, StripeContext]]" + ) -> "_APIRequestor": + """ + Returns a new _APIRequestor with the same configuration as this one, but + scoped to a different stripe_context. Unlike _new_requestor_with_options, + this always replaces stripe_context (even with None) and clears + stripe_account, since a context is self-contained and a stripe_account + inherited from whatever request produced this requestor should not leak + into requests scoped by it. + """ + new_options = self._options.to_dict() + new_options["stripe_context"] = stripe_context + new_options["stripe_account"] = None + return _APIRequestor( + options=RequestorOptions(**new_options), client=self._client + ) + @property def api_key(self): return self._options.api_key diff --git a/stripe/_balance_transaction.py b/stripe/_balance_transaction.py index 2541db123..8c81eae5f 100644 --- a/stripe/_balance_transaction.py +++ b/stripe/_balance_transaction.py @@ -105,7 +105,7 @@ class FeeDetail(StripeObject): """ exchange_rate: Optional[float] """ - If applicable, this transaction uses an exchange rate. If money converts from currency A to currency B, then the `amount` in currency A, multiplied by the `exchange_rate`, equals the `amount` in currency B. For example, if you charge a customer 10.00 EUR, the PaymentIntent's `amount` is `1000` and `currency` is `eur`. If this converts to 12.34 USD in your Stripe account, the BalanceTransaction's `amount` is `1234`, its `currency` is `usd`, and the `exchange_rate` is `1.234`. + The exchange rate used for this transaction, if applicable. Multiplying the source `amount` by the `exchange_rate` gives the destination `amount`, both in their currencies' smallest units. For example, `1000` EUR cents converts to `1234` USD cents at `1.234`. For a zero-decimal currency such as JPY, `1000` JPY converts to `640` USD cents (6.40 USD) at `0.64`, equivalent to `0.0064` USD per JPY. For JPY to USD, the API multiplier is 100 times the whole-unit rate because JPY amounts use yen and USD amounts use cents. """ fee: int """ diff --git a/stripe/_charge.py b/stripe/_charge.py index 76ef21877..ba4db8167 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -508,11 +508,11 @@ class FrMealVoucher(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`. + If an 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`. + If an address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[str] """ @@ -695,11 +695,11 @@ 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`. + If an 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`. + If an address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[str] """ @@ -1319,6 +1319,25 @@ class Reauthorization(StripeObject): """ class Receipt(StripeObject): + class CardholderMessage(StripeObject): + destinations: List[ + Union[ + Literal[ + "cardholder_receipt", + "merchant_receipt", + "point_of_sale", + ], + str, + ] + ] + """ + Where the message must be printed or displayed. An empty list means the message must not be shown. + """ + value: str + """ + The message from the card issuer, such as the remaining balance. + """ + account_type: Optional[ Union[ Literal["checking", "credit", "prepaid", "unknown"], @@ -1344,6 +1363,10 @@ class Receipt(StripeObject): """ EMV tag 8A. A code returned by the card issuer. """ + cardholder_message: Optional[CardholderMessage] + """ + A message from the card issuer to show to the cardholder, and where it must be shown. + """ cardholder_verification_method: Optional[str] """ Describes the method used by the cardholder to verify ownership of the card. One of the following: `approval`, `failure`, `none`, `offline_pin`, `offline_pin_and_signature`, `online_pin`, or `signature`. @@ -1360,6 +1383,7 @@ class Receipt(StripeObject): """ An indication of which steps were completed during the card read process. Referenced from EMV Tag 9B. """ + _inner_class_types = {"cardholder_message": CardholderMessage} class Wallet(StripeObject): type: Union[ @@ -2119,11 +2143,11 @@ 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`. + If an 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`. + If an address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[str] """ diff --git a/stripe/_confirmation_token.py b/stripe/_confirmation_token.py index 6572ad6fa..d39576721 100644 --- a/stripe/_confirmation_token.py +++ b/stripe/_confirmation_token.py @@ -263,11 +263,11 @@ class Benefits(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`. + If an 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`. + If an address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[str] """ @@ -344,6 +344,25 @@ class Reauthorization(StripeObject): """ class Receipt(StripeObject): + class CardholderMessage(StripeObject): + destinations: List[ + Union[ + Literal[ + "cardholder_receipt", + "merchant_receipt", + "point_of_sale", + ], + str, + ] + ] + """ + Where the message must be printed or displayed. An empty list means the message must not be shown. + """ + value: str + """ + The message from the card issuer, such as the remaining balance. + """ + account_type: Optional[ Union[ Literal[ @@ -374,6 +393,10 @@ class Receipt(StripeObject): """ EMV tag 8A. A code returned by the card issuer. """ + cardholder_message: Optional[CardholderMessage] + """ + A message from the card issuer to show to the cardholder, and where it must be shown. + """ cardholder_verification_method: Optional[str] """ Describes the method used by the cardholder to verify ownership of the card. One of the following: `approval`, `failure`, `none`, `offline_pin`, `offline_pin_and_signature`, `online_pin`, or `signature`. @@ -390,6 +413,9 @@ class Receipt(StripeObject): """ An indication of which steps were completed during the card read process. Referenced from EMV Tag 9B. """ + _inner_class_types = { + "cardholder_message": CardholderMessage, + } class Wallet(StripeObject): type: Union[ diff --git a/stripe/_event_notification_handler.py b/stripe/_event_notification_handler.py index fe6785020..b7f9927d6 100644 --- a/stripe/_event_notification_handler.py +++ b/stripe/_event_notification_handler.py @@ -1578,6 +1578,21 @@ from stripe.events._v2_money_management_reward_program_reward_reversed_event import ( V2MoneyManagementRewardProgramRewardReversedEventNotification, ) + from stripe.events._v2_money_management_spending_mandate_canceled_event import ( + V2MoneyManagementSpendingMandateCanceledEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_created_event import ( + V2MoneyManagementSpendingMandateCreatedEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_expired_event import ( + V2MoneyManagementSpendingMandateExpiredEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_pending_cancellation_event import ( + V2MoneyManagementSpendingMandatePendingCancellationEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_updated_event import ( + V2MoneyManagementSpendingMandateUpdatedEventNotification, + ) from stripe.events._v2_money_management_transaction_created_event import ( V2MoneyManagementTransactionCreatedEventNotification, ) @@ -8491,6 +8506,71 @@ def on_v2_money_management_reward_program_reward_reversed( ) return func + def on_v2_money_management_spending_mandate_canceled( + self, + func: "Callable[[V2MoneyManagementSpendingMandateCanceledEventNotification, StripeClient], CallbackReturn]", + ): + """ + Registers a callback for the `V2MoneyManagementSpendingMandateCanceledEvent` (`v2.money_management.spending_mandate.canceled`) event notification. + """ + self._register( + "v2.money_management.spending_mandate.canceled", + func, + ) + return func + + def on_v2_money_management_spending_mandate_created( + self, + func: "Callable[[V2MoneyManagementSpendingMandateCreatedEventNotification, StripeClient], CallbackReturn]", + ): + """ + Registers a callback for the `V2MoneyManagementSpendingMandateCreatedEvent` (`v2.money_management.spending_mandate.created`) event notification. + """ + self._register( + "v2.money_management.spending_mandate.created", + func, + ) + return func + + def on_v2_money_management_spending_mandate_expired( + self, + func: "Callable[[V2MoneyManagementSpendingMandateExpiredEventNotification, StripeClient], CallbackReturn]", + ): + """ + Registers a callback for the `V2MoneyManagementSpendingMandateExpiredEvent` (`v2.money_management.spending_mandate.expired`) event notification. + """ + self._register( + "v2.money_management.spending_mandate.expired", + func, + ) + return func + + def on_v2_money_management_spending_mandate_pending_cancellation( + self, + func: "Callable[[V2MoneyManagementSpendingMandatePendingCancellationEventNotification, StripeClient], CallbackReturn]", + ): + """ + Registers a callback for the `V2MoneyManagementSpendingMandatePendingCancellationEvent` (`v2.money_management.spending_mandate.pending_cancellation`) event notification. + """ + self._register( + "v2.money_management.spending_mandate.pending_cancellation", + func, + ) + return func + + def on_v2_money_management_spending_mandate_updated( + self, + func: "Callable[[V2MoneyManagementSpendingMandateUpdatedEventNotification, StripeClient], CallbackReturn]", + ): + """ + Registers a callback for the `V2MoneyManagementSpendingMandateUpdatedEvent` (`v2.money_management.spending_mandate.updated`) event notification. + """ + self._register( + "v2.money_management.spending_mandate.updated", + func, + ) + return func + def on_v2_money_management_transaction_created( self, func: "Callable[[V2MoneyManagementTransactionCreatedEventNotification, StripeClient], CallbackReturn]", diff --git a/stripe/_http_client.py b/stripe/_http_client.py index 65c3ed684..6f0815e91 100644 --- a/stripe/_http_client.py +++ b/stripe/_http_client.py @@ -827,6 +827,23 @@ def close(self): pass +def _assert_no_header_injection(headers: Mapping[str, str]) -> None: + """Rejects CR, LF and NUL in a header name or value. + + pycurl's HTTPHEADER option takes raw "name: value" strings, assembled + here by string formatting rather than passed to a validating library + call. A CR or LF in either half would let the remainder be parsed as an + additional header line. + """ + for key, value in headers.items(): + for part in (key, value): + if "\r" in part or "\n" in part or "\0" in part: + raise ValueError( + "Header names and values may not contain CR, LF or " + "NUL characters." + ) + + class PycurlClient(HTTPClient): class _ParsedProxy(TypedDict, total=False): http: Optional["ParseResult"] @@ -957,6 +974,7 @@ def _request_internal( self._curl.setopt(self.pycurl.NOSIGNAL, 1) self._curl.setopt(self.pycurl.CONNECTTIMEOUT, 30) self._curl.setopt(self.pycurl.TIMEOUT, 80) + _assert_no_header_injection(headers) self._curl.setopt( self.pycurl.HTTPHEADER, ["%s: %s" % (k, v) for k, v in dict(headers).items()], diff --git a/stripe/_mandate.py b/stripe/_mandate.py index b534a3d64..abbe75f01 100644 --- a/stripe/_mandate.py +++ b/stripe/_mandate.py @@ -311,6 +311,12 @@ class SepaDebit(StripeObject): The URL of the mandate. This URL generally contains sensitive information about the customer and should be shared with them exclusively. """ + class TossPay(StripeObject): + buyer_id: Optional[str] + """ + The buyer identifier provided by NICE for this Toss Pay account, when available. + """ + class Twint(StripeObject): pass @@ -356,6 +362,7 @@ class UsBankAccount(StripeObject): pix: Optional[Pix] revolut_pay: Optional[RevolutPay] sepa_debit: Optional[SepaDebit] + toss_pay: Optional[TossPay] twint: Optional[Twint] type: str """ @@ -382,6 +389,7 @@ class UsBankAccount(StripeObject): "pix": Pix, "revolut_pay": RevolutPay, "sepa_debit": SepaDebit, + "toss_pay": TossPay, "twint": Twint, "upi": Upi, "us_bank_account": UsBankAccount, diff --git a/stripe/_object_classes.py b/stripe/_object_classes.py index 0a3dc214e..9d313717e 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -844,6 +844,10 @@ "stripe.v2.money_management._reward_program_rule", "RewardProgramRule", ), + "v2.money_management.spending_mandate": ( + "stripe.v2.money_management._spending_mandate", + "SpendingMandate", + ), "v2.money_management.transaction": ( "stripe.v2.money_management._transaction", "Transaction", diff --git a/stripe/_payment_attempt_record.py b/stripe/_payment_attempt_record.py index c30c60f48..7a27eb253 100644 --- a/stripe/_payment_attempt_record.py +++ b/stripe/_payment_attempt_record.py @@ -527,7 +527,7 @@ class Checks(StripeObject): ] ] """ - If you provide a address postal code, the check result is one of `pass`, `fail`, `unavailable`, or `unchecked`. + If you provide an address postal code, the check result is one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[ Union[ @@ -873,6 +873,25 @@ class Reauthorization(StripeObject): """ class Receipt(StripeObject): + class CardholderMessage(StripeObject): + destinations: List[ + Union[ + Literal[ + "cardholder_receipt", + "merchant_receipt", + "point_of_sale", + ], + str, + ] + ] + """ + Where the message must be printed or displayed. An empty list means the message must not be shown. + """ + value: str + """ + The message from the card issuer, such as the remaining balance. + """ + account_type: Optional[ Union[ Literal["checking", "credit", "prepaid", "unknown"], @@ -898,6 +917,10 @@ class Receipt(StripeObject): """ EMV tag 8A. A code returned by the card issuer. """ + cardholder_message: Optional[CardholderMessage] + """ + A message from the card issuer to show to the cardholder, and where it must be shown. + """ cardholder_verification_method: Optional[str] """ Describes the method used by the cardholder to verify ownership of the card. One of the following: `approval`, `failure`, `none`, `offline_pin`, `offline_pin_and_signature`, `online_pin`, or `signature`. @@ -914,6 +937,7 @@ class Receipt(StripeObject): """ An indication of which steps were completed during the card read process. Referenced from EMV Tag 9B. """ + _inner_class_types = {"cardholder_message": CardholderMessage} class Wallet(StripeObject): type: Union[ diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index 4b804e530..ae39b40a8 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -1774,6 +1774,32 @@ class WechatPayRedirectToIosApp(StripeObject): An universal link that redirect to WeChat Pay app """ + class WechatPayRedirectToMiniProgram(StripeObject): + app_id: str + """ + Mini Program ID registered on WeChat Open Platform + """ + nonce_str: str + """ + Random string + """ + prepay_id: str + """ + Unique trading ID assigned by WeChat Pay + """ + sign: str + """ + Signature + """ + sign_type: str + """ + Signature type + """ + timestamp: str + """ + Current time in epoch format + """ + alipay_handle_redirect: Optional[AlipayHandleRedirect] blik_authorize: Optional[BlikAuthorize] boleto_display_details: Optional[BoletoDisplayDetails] @@ -1814,6 +1840,9 @@ class WechatPayRedirectToIosApp(StripeObject): WechatPayRedirectToAndroidApp ] wechat_pay_redirect_to_ios_app: Optional[WechatPayRedirectToIosApp] + wechat_pay_redirect_to_mini_program: Optional[ + WechatPayRedirectToMiniProgram + ] _inner_class_types = { "alipay_handle_redirect": AlipayHandleRedirect, "blik_authorize": BlikAuthorize, @@ -1837,6 +1866,7 @@ class WechatPayRedirectToIosApp(StripeObject): "wechat_pay_handle_app_redirect": WechatPayHandleAppRedirect, "wechat_pay_redirect_to_android_app": WechatPayRedirectToAndroidApp, "wechat_pay_redirect_to_ios_app": WechatPayRedirectToIosApp, + "wechat_pay_redirect_to_mini_program": WechatPayRedirectToMiniProgram, } class PaymentDetails(StripeObject): diff --git a/stripe/_payment_method.py b/stripe/_payment_method.py index 04ec076f3..ee7ebc791 100644 --- a/stripe/_payment_method.py +++ b/stripe/_payment_method.py @@ -216,11 +216,11 @@ class Benefits(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`. + If an 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`. + If an address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[str] """ @@ -295,6 +295,25 @@ class Reauthorization(StripeObject): """ class Receipt(StripeObject): + class CardholderMessage(StripeObject): + destinations: List[ + Union[ + Literal[ + "cardholder_receipt", + "merchant_receipt", + "point_of_sale", + ], + str, + ] + ] + """ + Where the message must be printed or displayed. An empty list means the message must not be shown. + """ + value: str + """ + The message from the card issuer, such as the remaining balance. + """ + account_type: Optional[ Union[ Literal[ @@ -322,6 +341,10 @@ class Receipt(StripeObject): """ EMV tag 8A. A code returned by the card issuer. """ + cardholder_message: Optional[CardholderMessage] + """ + A message from the card issuer to show to the cardholder, and where it must be shown. + """ cardholder_verification_method: Optional[str] """ Describes the method used by the cardholder to verify ownership of the card. One of the following: `approval`, `failure`, `none`, `offline_pin`, `offline_pin_and_signature`, `online_pin`, or `signature`. @@ -338,6 +361,9 @@ class Receipt(StripeObject): """ An indication of which steps were completed during the card read process. Referenced from EMV Tag 9B. """ + _inner_class_types = { + "cardholder_message": CardholderMessage, + } class Wallet(StripeObject): type: Union[ diff --git a/stripe/_payment_method_configuration.py b/stripe/_payment_method_configuration.py index 5a98ec3c5..01680bbc9 100644 --- a/stripe/_payment_method_configuration.py +++ b/stripe/_payment_method_configuration.py @@ -1370,6 +1370,28 @@ class DisplayPreference(StripeObject): display_preference: DisplayPreference _inner_class_types = {"display_preference": DisplayPreference} + class TossPay(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: Union[Literal["none", "off", "on"], str] + """ + The account's display preference. + """ + value: Union[Literal["off", "on"], str] + """ + 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 Twint(StripeObject): class DisplayPreference(StripeObject): overridable: Optional[bool] @@ -1594,6 +1616,7 @@ class DisplayPreference(StripeObject): sofort: Optional[Sofort] sunbit: Optional[Sunbit] swish: Optional[Swish] + toss_pay: Optional[TossPay] twint: Optional[Twint] upi: Optional[Upi] us_bank_account: Optional[UsBankAccount] @@ -1800,6 +1823,7 @@ async def retrieve_async( "sofort": Sofort, "sunbit": Sunbit, "swish": Swish, + "toss_pay": TossPay, "twint": Twint, "upi": Upi, "us_bank_account": UsBankAccount, diff --git a/stripe/_payment_record.py b/stripe/_payment_record.py index 584fed8c8..0213aa2c1 100644 --- a/stripe/_payment_record.py +++ b/stripe/_payment_record.py @@ -542,7 +542,7 @@ class Checks(StripeObject): ] ] """ - If you provide a address postal code, the check result is one of `pass`, `fail`, `unavailable`, or `unchecked`. + If you provide an address postal code, the check result is one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[ Union[ @@ -888,6 +888,25 @@ class Reauthorization(StripeObject): """ class Receipt(StripeObject): + class CardholderMessage(StripeObject): + destinations: List[ + Union[ + Literal[ + "cardholder_receipt", + "merchant_receipt", + "point_of_sale", + ], + str, + ] + ] + """ + Where the message must be printed or displayed. An empty list means the message must not be shown. + """ + value: str + """ + The message from the card issuer, such as the remaining balance. + """ + account_type: Optional[ Union[ Literal["checking", "credit", "prepaid", "unknown"], @@ -913,6 +932,10 @@ class Receipt(StripeObject): """ EMV tag 8A. A code returned by the card issuer. """ + cardholder_message: Optional[CardholderMessage] + """ + A message from the card issuer to show to the cardholder, and where it must be shown. + """ cardholder_verification_method: Optional[str] """ Describes the method used by the cardholder to verify ownership of the card. One of the following: `approval`, `failure`, `none`, `offline_pin`, `offline_pin_and_signature`, `online_pin`, or `signature`. @@ -929,6 +952,7 @@ class Receipt(StripeObject): """ An indication of which steps were completed during the card read process. Referenced from EMV Tag 9B. """ + _inner_class_types = {"cardholder_message": CardholderMessage} class Wallet(StripeObject): type: Union[ diff --git a/stripe/_setup_attempt.py b/stripe/_setup_attempt.py index 819561d4d..42d18c959 100644 --- a/stripe/_setup_attempt.py +++ b/stripe/_setup_attempt.py @@ -96,11 +96,11 @@ 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`. + If an 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`. + If an address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[str] """ @@ -474,6 +474,12 @@ class Sofort(StripeObject): class StripeBalance(StripeObject): pass + class TossPay(StripeObject): + buyer_id: Optional[str] + """ + The buyer identifier provided by NICE for this Toss Pay account, when available. + """ + class Twint(StripeObject): pass @@ -510,6 +516,7 @@ class UsBankAccount(StripeObject): sepa_debit: Optional[SepaDebit] sofort: Optional[Sofort] stripe_balance: Optional[StripeBalance] + toss_pay: Optional[TossPay] twint: Optional[Twint] type: str """ @@ -545,6 +552,7 @@ class UsBankAccount(StripeObject): "sepa_debit": SepaDebit, "sofort": Sofort, "stripe_balance": StripeBalance, + "toss_pay": TossPay, "twint": Twint, "upi": Upi, "us_bank_account": UsBankAccount, diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index fc4e569e4..b8dd21335 100644 --- a/stripe/_setup_intent.py +++ b/stripe/_setup_intent.py @@ -616,12 +616,16 @@ class AmazonPay(StripeObject): pass class BacsDebit(StripeObject): + class FinancialConnections(StripeObject): + return_url: Optional[str] + class MandateOptions(StripeObject): reference_prefix: Optional[str] """ Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. """ + financial_connections: Optional[FinancialConnections] mandate_options: Optional[MandateOptions] verification_method: Optional[ Union[ @@ -629,7 +633,10 @@ class MandateOptions(StripeObject): str, ] ] - _inner_class_types = {"mandate_options": MandateOptions} + _inner_class_types = { + "financial_connections": FinancialConnections, + "mandate_options": MandateOptions, + } class Bizum(StripeObject): pass diff --git a/stripe/_util.py b/stripe/_util.py index e034b209f..995967aa5 100644 --- a/stripe/_util.py +++ b/stripe/_util.py @@ -243,6 +243,7 @@ def _convert_to_stripe_object( elif isinstance(resp, dict): resp = resp.copy() klass_name = resp.get("object") + requestor_uses_response_context = False if isinstance(klass_name, str): if is_v2_deleted_object: # circular import @@ -254,6 +255,7 @@ def _convert_to_stripe_object( event_type = resp.get("type", "") klass = get_v2_event_class(event_type) + requestor_uses_response_context = True else: from stripe._object_classes import get_object_class @@ -279,6 +281,17 @@ def _convert_to_stripe_object( api_mode=api_mode, ) + if requestor_uses_response_context: + # A directly-retrieved object carries the requestor of whatever + # account fetched it (e.g. a platform account), but its `context` + # field is the self-contained auth context for its own account. + # Rescope the requestor the same way EventNotification.__init__ + # scopes its client so fetch_related_object() uses the correct + # headers. + obj._requestor = obj._requestor.with_stripe_context( + getattr(obj, "context", None) + ) + # We only need to update _retrieve_params when special params were # actually passed. Otherwise, leave it as is as the list / search result # constructors will instantiate their own params. diff --git a/stripe/_webhook.py b/stripe/_webhook.py index a9a041454..9c39d59a7 100644 --- a/stripe/_webhook.py +++ b/stripe/_webhook.py @@ -2,8 +2,10 @@ import json import time from collections import OrderedDict +from dataclasses import dataclass from hashlib import sha256 from typing import Any, Dict, Optional, Union +from urllib.parse import quote # Used for global variables import stripe # noqa: IMP101 @@ -19,6 +21,13 @@ """ +@dataclass +class _DebugMetadata: + secret: Optional[str] = None + destination: Optional[str] = None + payload: Optional[str] = None + + def build_v1_event(values: Dict[str, Any], requestor: _APIRequestor) -> Event: """ Internal helper for centralizing v1 event creation @@ -180,8 +189,7 @@ def verify_header( expected_sig = cls._compute_signature(signed_payload, secret) if not any(secure_compare(expected_sig, s) for s in signatures): raise SignatureVerificationError( - "No signatures found matching the expected signature for " - "payload", + cls._signature_error_message(header, str(payload), secret), header, payload, ) @@ -194,3 +202,91 @@ def verify_header( ) return True + + @classmethod + def _signature_error_message( + cls, header: str, payload: str, secret: str + ) -> str: + """Build an HMAC-mismatch message using optional header metadata.""" + metadata = cls._signature_debug_metadata(header) + + # If metadata has an asterisk-masked secret, compare against its length and last four characters + masked_secret = metadata.secret or "" + secret_suffix = secret[-4:] + if "*" in masked_secret and ( + len(secret) != len(masked_secret) + or secret_suffix != masked_secret[-4:] + ): + dashboard_url = "https://dashboard.stripe.com/webhooks" + if metadata.destination is not None: + dashboard_url += "/" + quote(metadata.destination, safe="") + return ( + "Webhook signature verification failed. This request may not " + "have originated from Stripe.\n\n" + f"The signing secret you provided is {len(secret)} characters " + f"long and ends in `{secret_suffix}`. However, the signing " + "secret for this destination is " + f"{len(masked_secret)} characters long and looks like " + f"`{masked_secret}`. Ensure you're using the signing secret " + "for this destination, as shown on the Dashboard: " + f"{dashboard_url}\n\n" + "Learn more: https://docs.stripe.com/webhooks/signature" + ) + + # If metadata includes the truncated payload hash, compare with the payload passed in + expected_hash = (metadata.payload or "").lower() + if len(expected_hash) == 8 and all( + character in "0123456789abcdef" for character in expected_hash + ): + actual_hash = sha256(payload.encode("utf-8")).hexdigest()[-8:] + if expected_hash != actual_hash: + return ( + "Webhook signature verification failed.\n\n" + "The request body you passed to this function differs " + "from the request body sent by Stripe to this webhook " + "destination.\n" + "The SHA-256 hash of the body should end in " + f"`{expected_hash}`. However, the SHA-256 hash of the body " + f"you provided ends in `{actual_hash}`.\n\n" + "Make sure your code does not reformat or otherwise alter " + "the raw HTTP request body before passing it to this " + "function.\n\n" + "Learn more: https://docs.stripe.com/webhooks/signature" + ) + + # Fall back to the generic message if no debug metadata available + return ( + "No signatures found matching the expected signature for payload" + ) + + @classmethod + def _signature_debug_metadata(cls, header: str) -> _DebugMetadata: + """Extract metadata from the stripe-signature header value to help debug verification failures.""" + # For each metadata key, extract the first value found in the header + metadata: Dict[str, Optional[str]] = {} + for item in header.split(","): + key, separator, value = item.lstrip().partition("=") + if ( + key in ("secret", "destination", "payload") + and key not in metadata + ): + metadata[key] = ( + cls._safe_metadata_value(value) if separator else None + ) + return _DebugMetadata( + metadata.get("secret"), + metadata.get("destination"), + metadata.get("payload"), + ) + + @staticmethod + def _safe_metadata_value(value: str) -> Optional[str]: + """Return a bounded UTF-8 metadata value, or None if unusable.""" + # Ignore overly long, potentially attacker-provided metadata values + if len(value) > 100: + return None + try: + value.encode("utf-8") + except UnicodeEncodeError: + return None + return value.strip() or None diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index f4627fd11..b93513e36 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -4131,6 +4131,8 @@ async def approve_async( def create(cls, **params: Unpack["SessionCreateParams"]) -> "Session": """ Creates a Checkout Session object. + + Validate requests on your server and protect your application's Session-creation endpoint with access controls and limits on repeated creation. See [Protect your Session-creation endpoint](https://docs.stripe.com/payments/accept-a-payment?payment-ui=elements&api-integration=checkout#protect-session-creation). """ return cast( "Session", @@ -4147,6 +4149,8 @@ async def create_async( ) -> "Session": """ Creates a Checkout Session object. + + Validate requests on your server and protect your application's Session-creation endpoint with access controls and limits on repeated creation. See [Protect your Session-creation endpoint](https://docs.stripe.com/payments/accept-a-payment?payment-ui=elements&api-integration=checkout#protect-session-creation). """ return cast( "Session", diff --git a/stripe/checkout/_session_service.py b/stripe/checkout/_session_service.py index 6b6e1dc29..3fa497246 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -105,6 +105,8 @@ def create( ) -> "Session": """ Creates a Checkout Session object. + + Validate requests on your server and protect your application's Session-creation endpoint with access controls and limits on repeated creation. See [Protect your Session-creation endpoint](https://docs.stripe.com/payments/accept-a-payment?payment-ui=elements&api-integration=checkout#protect-session-creation). """ return cast( "Session", @@ -124,6 +126,8 @@ async def create_async( ) -> "Session": """ Creates a Checkout Session object. + + Validate requests on your server and protect your application's Session-creation endpoint with access controls and limits on repeated creation. See [Protect your Session-creation endpoint](https://docs.stripe.com/payments/accept-a-payment?payment-ui=elements&api-integration=checkout#protect-session-creation). """ return cast( "Session", diff --git a/stripe/events/__init__.py b/stripe/events/__init__.py index 666323341..b01dd1fca 100644 --- a/stripe/events/__init__.py +++ b/stripe/events/__init__.py @@ -2067,6 +2067,26 @@ V2MoneyManagementRewardProgramRewardReversedEvent as V2MoneyManagementRewardProgramRewardReversedEvent, V2MoneyManagementRewardProgramRewardReversedEventNotification as V2MoneyManagementRewardProgramRewardReversedEventNotification, ) + from stripe.events._v2_money_management_spending_mandate_canceled_event import ( + V2MoneyManagementSpendingMandateCanceledEvent as V2MoneyManagementSpendingMandateCanceledEvent, + V2MoneyManagementSpendingMandateCanceledEventNotification as V2MoneyManagementSpendingMandateCanceledEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_created_event import ( + V2MoneyManagementSpendingMandateCreatedEvent as V2MoneyManagementSpendingMandateCreatedEvent, + V2MoneyManagementSpendingMandateCreatedEventNotification as V2MoneyManagementSpendingMandateCreatedEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_expired_event import ( + V2MoneyManagementSpendingMandateExpiredEvent as V2MoneyManagementSpendingMandateExpiredEvent, + V2MoneyManagementSpendingMandateExpiredEventNotification as V2MoneyManagementSpendingMandateExpiredEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_pending_cancellation_event import ( + V2MoneyManagementSpendingMandatePendingCancellationEvent as V2MoneyManagementSpendingMandatePendingCancellationEvent, + V2MoneyManagementSpendingMandatePendingCancellationEventNotification as V2MoneyManagementSpendingMandatePendingCancellationEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_updated_event import ( + V2MoneyManagementSpendingMandateUpdatedEvent as V2MoneyManagementSpendingMandateUpdatedEvent, + V2MoneyManagementSpendingMandateUpdatedEventNotification as V2MoneyManagementSpendingMandateUpdatedEventNotification, + ) from stripe.events._v2_money_management_transaction_created_event import ( V2MoneyManagementTransactionCreatedEvent as V2MoneyManagementTransactionCreatedEvent, V2MoneyManagementTransactionCreatedEventNotification as V2MoneyManagementTransactionCreatedEventNotification, @@ -6208,6 +6228,46 @@ "stripe.events._v2_money_management_reward_program_reward_reversed_event", False, ), + "V2MoneyManagementSpendingMandateCanceledEvent": ( + "stripe.events._v2_money_management_spending_mandate_canceled_event", + False, + ), + "V2MoneyManagementSpendingMandateCanceledEventNotification": ( + "stripe.events._v2_money_management_spending_mandate_canceled_event", + False, + ), + "V2MoneyManagementSpendingMandateCreatedEvent": ( + "stripe.events._v2_money_management_spending_mandate_created_event", + False, + ), + "V2MoneyManagementSpendingMandateCreatedEventNotification": ( + "stripe.events._v2_money_management_spending_mandate_created_event", + False, + ), + "V2MoneyManagementSpendingMandateExpiredEvent": ( + "stripe.events._v2_money_management_spending_mandate_expired_event", + False, + ), + "V2MoneyManagementSpendingMandateExpiredEventNotification": ( + "stripe.events._v2_money_management_spending_mandate_expired_event", + False, + ), + "V2MoneyManagementSpendingMandatePendingCancellationEvent": ( + "stripe.events._v2_money_management_spending_mandate_pending_cancellation_event", + False, + ), + "V2MoneyManagementSpendingMandatePendingCancellationEventNotification": ( + "stripe.events._v2_money_management_spending_mandate_pending_cancellation_event", + False, + ), + "V2MoneyManagementSpendingMandateUpdatedEvent": ( + "stripe.events._v2_money_management_spending_mandate_updated_event", + False, + ), + "V2MoneyManagementSpendingMandateUpdatedEventNotification": ( + "stripe.events._v2_money_management_spending_mandate_updated_event", + False, + ), "V2MoneyManagementTransactionCreatedEvent": ( "stripe.events._v2_money_management_transaction_created_event", False, diff --git a/stripe/events/_event_classes.py b/stripe/events/_event_classes.py index ff0d99aad..9958a0c8c 100644 --- a/stripe/events/_event_classes.py +++ b/stripe/events/_event_classes.py @@ -1546,6 +1546,21 @@ from stripe.events._v2_money_management_reward_program_reward_reversed_event import ( V2MoneyManagementRewardProgramRewardReversedEventNotification, ) + from stripe.events._v2_money_management_spending_mandate_canceled_event import ( + V2MoneyManagementSpendingMandateCanceledEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_created_event import ( + V2MoneyManagementSpendingMandateCreatedEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_expired_event import ( + V2MoneyManagementSpendingMandateExpiredEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_pending_cancellation_event import ( + V2MoneyManagementSpendingMandatePendingCancellationEventNotification, + ) + from stripe.events._v2_money_management_spending_mandate_updated_event import ( + V2MoneyManagementSpendingMandateUpdatedEventNotification, + ) from stripe.events._v2_money_management_transaction_created_event import ( V2MoneyManagementTransactionCreatedEventNotification, ) @@ -3709,6 +3724,26 @@ "stripe.events._v2_money_management_reward_program_reward_reversed_event", "V2MoneyManagementRewardProgramRewardReversedEvent", ), + "v2.money_management.spending_mandate.canceled": ( + "stripe.events._v2_money_management_spending_mandate_canceled_event", + "V2MoneyManagementSpendingMandateCanceledEvent", + ), + "v2.money_management.spending_mandate.created": ( + "stripe.events._v2_money_management_spending_mandate_created_event", + "V2MoneyManagementSpendingMandateCreatedEvent", + ), + "v2.money_management.spending_mandate.expired": ( + "stripe.events._v2_money_management_spending_mandate_expired_event", + "V2MoneyManagementSpendingMandateExpiredEvent", + ), + "v2.money_management.spending_mandate.pending_cancellation": ( + "stripe.events._v2_money_management_spending_mandate_pending_cancellation_event", + "V2MoneyManagementSpendingMandatePendingCancellationEvent", + ), + "v2.money_management.spending_mandate.updated": ( + "stripe.events._v2_money_management_spending_mandate_updated_event", + "V2MoneyManagementSpendingMandateUpdatedEvent", + ), "v2.money_management.transaction.created": ( "stripe.events._v2_money_management_transaction_created_event", "V2MoneyManagementTransactionCreatedEvent", @@ -5920,6 +5955,26 @@ def get_v2_event_class(type_: str): "stripe.events._v2_money_management_reward_program_reward_reversed_event", "V2MoneyManagementRewardProgramRewardReversedEventNotification", ), + "v2.money_management.spending_mandate.canceled": ( + "stripe.events._v2_money_management_spending_mandate_canceled_event", + "V2MoneyManagementSpendingMandateCanceledEventNotification", + ), + "v2.money_management.spending_mandate.created": ( + "stripe.events._v2_money_management_spending_mandate_created_event", + "V2MoneyManagementSpendingMandateCreatedEventNotification", + ), + "v2.money_management.spending_mandate.expired": ( + "stripe.events._v2_money_management_spending_mandate_expired_event", + "V2MoneyManagementSpendingMandateExpiredEventNotification", + ), + "v2.money_management.spending_mandate.pending_cancellation": ( + "stripe.events._v2_money_management_spending_mandate_pending_cancellation_event", + "V2MoneyManagementSpendingMandatePendingCancellationEventNotification", + ), + "v2.money_management.spending_mandate.updated": ( + "stripe.events._v2_money_management_spending_mandate_updated_event", + "V2MoneyManagementSpendingMandateUpdatedEventNotification", + ), "v2.money_management.transaction.created": ( "stripe.events._v2_money_management_transaction_created_event", "V2MoneyManagementTransactionCreatedEventNotification", @@ -6592,6 +6647,11 @@ def get_v2_event_notification_class(type_: str): "V2MoneyManagementRecipientVerificationUpdatedEventNotification", "V2MoneyManagementRewardProgramRewardEarnedEventNotification", "V2MoneyManagementRewardProgramRewardReversedEventNotification", + "V2MoneyManagementSpendingMandateCanceledEventNotification", + "V2MoneyManagementSpendingMandateCreatedEventNotification", + "V2MoneyManagementSpendingMandateExpiredEventNotification", + "V2MoneyManagementSpendingMandatePendingCancellationEventNotification", + "V2MoneyManagementSpendingMandateUpdatedEventNotification", "V2MoneyManagementTransactionCreatedEventNotification", "V2MoneyManagementTransactionUpdatedEventNotification", "V2OrchestratedCommerceAgreementConfirmedEventNotification", diff --git a/stripe/events/_v2_money_management_spending_mandate_canceled_event.py b/stripe/events/_v2_money_management_spending_mandate_canceled_event.py new file mode 100644 index 000000000..508840a4e --- /dev/null +++ b/stripe/events/_v2_money_management_spending_mandate_canceled_event.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.money_management._spending_mandate import SpendingMandate + + +class V2MoneyManagementSpendingMandateCanceledEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v2.money_management.spending_mandate.canceled" + type: Literal["v2.money_management.spending_mandate.canceled"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2MoneyManagementSpendingMandateCanceledEvent": + return cast( + "V2MoneyManagementSpendingMandateCanceledEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "SpendingMandate": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V2MoneyManagementSpendingMandateCanceledEvent": + return cast( + "V2MoneyManagementSpendingMandateCanceledEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "SpendingMandate": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2MoneyManagementSpendingMandateCanceledEvent(Event): + LOOKUP_TYPE = "v2.money_management.spending_mandate.canceled" + type: Literal["v2.money_management.spending_mandate.canceled"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "SpendingMandate": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "SpendingMandate", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_money_management_spending_mandate_created_event.py b/stripe/events/_v2_money_management_spending_mandate_created_event.py new file mode 100644 index 000000000..9d2a4dfce --- /dev/null +++ b/stripe/events/_v2_money_management_spending_mandate_created_event.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.money_management._spending_mandate import SpendingMandate + + +class V2MoneyManagementSpendingMandateCreatedEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v2.money_management.spending_mandate.created" + type: Literal["v2.money_management.spending_mandate.created"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2MoneyManagementSpendingMandateCreatedEvent": + return cast( + "V2MoneyManagementSpendingMandateCreatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "SpendingMandate": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V2MoneyManagementSpendingMandateCreatedEvent": + return cast( + "V2MoneyManagementSpendingMandateCreatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "SpendingMandate": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2MoneyManagementSpendingMandateCreatedEvent(Event): + LOOKUP_TYPE = "v2.money_management.spending_mandate.created" + type: Literal["v2.money_management.spending_mandate.created"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "SpendingMandate": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "SpendingMandate", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_money_management_spending_mandate_expired_event.py b/stripe/events/_v2_money_management_spending_mandate_expired_event.py new file mode 100644 index 000000000..c9d548a7b --- /dev/null +++ b/stripe/events/_v2_money_management_spending_mandate_expired_event.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.money_management._spending_mandate import SpendingMandate + + +class V2MoneyManagementSpendingMandateExpiredEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v2.money_management.spending_mandate.expired" + type: Literal["v2.money_management.spending_mandate.expired"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2MoneyManagementSpendingMandateExpiredEvent": + return cast( + "V2MoneyManagementSpendingMandateExpiredEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "SpendingMandate": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V2MoneyManagementSpendingMandateExpiredEvent": + return cast( + "V2MoneyManagementSpendingMandateExpiredEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "SpendingMandate": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2MoneyManagementSpendingMandateExpiredEvent(Event): + LOOKUP_TYPE = "v2.money_management.spending_mandate.expired" + type: Literal["v2.money_management.spending_mandate.expired"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "SpendingMandate": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "SpendingMandate", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_money_management_spending_mandate_pending_cancellation_event.py b/stripe/events/_v2_money_management_spending_mandate_pending_cancellation_event.py new file mode 100644 index 000000000..18e2c128d --- /dev/null +++ b/stripe/events/_v2_money_management_spending_mandate_pending_cancellation_event.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.money_management._spending_mandate import SpendingMandate + + +class V2MoneyManagementSpendingMandatePendingCancellationEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v2.money_management.spending_mandate.pending_cancellation" + type: Literal["v2.money_management.spending_mandate.pending_cancellation"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event( + self, + ) -> "V2MoneyManagementSpendingMandatePendingCancellationEvent": + return cast( + "V2MoneyManagementSpendingMandatePendingCancellationEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "SpendingMandate": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V2MoneyManagementSpendingMandatePendingCancellationEvent": + return cast( + "V2MoneyManagementSpendingMandatePendingCancellationEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "SpendingMandate": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2MoneyManagementSpendingMandatePendingCancellationEvent(Event): + LOOKUP_TYPE = "v2.money_management.spending_mandate.pending_cancellation" + type: Literal["v2.money_management.spending_mandate.pending_cancellation"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "SpendingMandate": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "SpendingMandate", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_money_management_spending_mandate_updated_event.py b/stripe/events/_v2_money_management_spending_mandate_updated_event.py new file mode 100644 index 000000000..b50f3273e --- /dev/null +++ b/stripe/events/_v2_money_management_spending_mandate_updated_event.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.money_management._spending_mandate import SpendingMandate + + +class V2MoneyManagementSpendingMandateUpdatedEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v2.money_management.spending_mandate.updated" + type: Literal["v2.money_management.spending_mandate.updated"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2MoneyManagementSpendingMandateUpdatedEvent": + return cast( + "V2MoneyManagementSpendingMandateUpdatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "SpendingMandate": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V2MoneyManagementSpendingMandateUpdatedEvent": + return cast( + "V2MoneyManagementSpendingMandateUpdatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "SpendingMandate": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "SpendingMandate", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2MoneyManagementSpendingMandateUpdatedEvent(Event): + LOOKUP_TYPE = "v2.money_management.spending_mandate.updated" + type: Literal["v2.money_management.spending_mandate.updated"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "SpendingMandate": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "SpendingMandate", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/identity/_verification_report.py b/stripe/identity/_verification_report.py index 60d7f5e35..9e0ccc189 100644 --- a/stripe/identity/_verification_report.py +++ b/stripe/identity/_verification_report.py @@ -694,15 +694,69 @@ class Indicator(StripeObject): """ _inner_class_types = {"indicators": Indicator} + class FraudulentSelfie(StripeObject): + class Indicator(StripeObject): + explanation: str + """ + A brief explanation of how this indicator contributed to the risk level. + """ + impact: Union[ + Literal[ + "decrease", + "neutral", + "slight_increase", + "strong_increase", + ], + str, + ] + """ + The effect this indicator had on the overall risk level. + """ + indicator: Union[ + Literal[ + "duplicate_selfie", + "duplicate_selfie_mismatched_data", + "face_mismatch", + "other", + "static_selfie", + ], + str, + ] + """ + The name of the specific indicator used in the risk assessment. + """ + + indicators: List[Indicator] + """ + Array of objects representing individual factors that contributed to the calculated risk level. + """ + risk_level: Union[ + Literal[ + "elevated", + "highest", + "low", + "normal", + "not_assessed", + "unknown", + ], + str, + ] + """ + Categorical assessment of the selfie risk. + """ + _inner_class_types = {"indicators": Indicator} + fraudulent_document: Optional[FraudulentDocument] fraudulent_email: Optional[FraudulentEmail] fraudulent_person: Optional[FraudulentPerson] fraudulent_phone: Optional[FraudulentPhone] + fraudulent_selfie: Optional[FraudulentSelfie] _inner_class_types = { "fraudulent_document": FraudulentDocument, "fraudulent_email": FraudulentEmail, "fraudulent_person": FraudulentPerson, "fraudulent_phone": FraudulentPhone, + "fraudulent_selfie": FraudulentSelfie, } client_reference_id: Optional[str] diff --git a/stripe/params/__init__.py b/stripe/params/__init__.py index a8d54486f..6cff6e423 100644 --- a/stripe/params/__init__.py +++ b/stripe/params/__init__.py @@ -1343,6 +1343,8 @@ CustomerModifyParamsInvoiceSettings as CustomerModifyParamsInvoiceSettings, CustomerModifyParamsInvoiceSettingsCustomField as CustomerModifyParamsInvoiceSettingsCustomField, CustomerModifyParamsInvoiceSettingsRenderingOptions as CustomerModifyParamsInvoiceSettingsRenderingOptions, + CustomerModifyParamsMarketingAttribution as CustomerModifyParamsMarketingAttribution, + CustomerModifyParamsMarketingAttributionAdConversion as CustomerModifyParamsMarketingAttributionAdConversion, CustomerModifyParamsShipping as CustomerModifyParamsShipping, CustomerModifyParamsShippingAddress as CustomerModifyParamsShippingAddress, CustomerModifyParamsTax as CustomerModifyParamsTax, @@ -1458,6 +1460,8 @@ CustomerUpdateParamsInvoiceSettings as CustomerUpdateParamsInvoiceSettings, CustomerUpdateParamsInvoiceSettingsCustomField as CustomerUpdateParamsInvoiceSettingsCustomField, CustomerUpdateParamsInvoiceSettingsRenderingOptions as CustomerUpdateParamsInvoiceSettingsRenderingOptions, + CustomerUpdateParamsMarketingAttribution as CustomerUpdateParamsMarketingAttribution, + CustomerUpdateParamsMarketingAttributionAdConversion as CustomerUpdateParamsMarketingAttributionAdConversion, CustomerUpdateParamsShipping as CustomerUpdateParamsShipping, CustomerUpdateParamsShippingAddress as CustomerUpdateParamsShippingAddress, CustomerUpdateParamsTax as CustomerUpdateParamsTax, @@ -2367,6 +2371,7 @@ PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetails as PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetails, PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCard as PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCard, PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardChecks as PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardChecks, + PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardThreeDSecure as PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardThreeDSecure, PaymentAttemptRecordReportAuthorizedParamsProcessorDetails as PaymentAttemptRecordReportAuthorizedParamsProcessorDetails, PaymentAttemptRecordReportAuthorizedParamsProcessorDetailsCustom as PaymentAttemptRecordReportAuthorizedParamsProcessorDetailsCustom, ) @@ -2390,6 +2395,7 @@ PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetails as PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetails, PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCard as PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCard, PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardChecks as PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardChecks, + PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardThreeDSecure as PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardThreeDSecure, PaymentAttemptRecordReportGuaranteedParamsProcessorDetails as PaymentAttemptRecordReportGuaranteedParamsProcessorDetails, PaymentAttemptRecordReportGuaranteedParamsProcessorDetailsCustom as PaymentAttemptRecordReportGuaranteedParamsProcessorDetailsCustom, ) @@ -4343,6 +4349,8 @@ PaymentMethodConfigurationCreateParamsSunbitDisplayPreference as PaymentMethodConfigurationCreateParamsSunbitDisplayPreference, PaymentMethodConfigurationCreateParamsSwish as PaymentMethodConfigurationCreateParamsSwish, PaymentMethodConfigurationCreateParamsSwishDisplayPreference as PaymentMethodConfigurationCreateParamsSwishDisplayPreference, + PaymentMethodConfigurationCreateParamsTossPay as PaymentMethodConfigurationCreateParamsTossPay, + PaymentMethodConfigurationCreateParamsTossPayDisplayPreference as PaymentMethodConfigurationCreateParamsTossPayDisplayPreference, PaymentMethodConfigurationCreateParamsTwint as PaymentMethodConfigurationCreateParamsTwint, PaymentMethodConfigurationCreateParamsTwintDisplayPreference as PaymentMethodConfigurationCreateParamsTwintDisplayPreference, PaymentMethodConfigurationCreateParamsUpi as PaymentMethodConfigurationCreateParamsUpi, @@ -4485,6 +4493,8 @@ PaymentMethodConfigurationModifyParamsSunbitDisplayPreference as PaymentMethodConfigurationModifyParamsSunbitDisplayPreference, PaymentMethodConfigurationModifyParamsSwish as PaymentMethodConfigurationModifyParamsSwish, PaymentMethodConfigurationModifyParamsSwishDisplayPreference as PaymentMethodConfigurationModifyParamsSwishDisplayPreference, + PaymentMethodConfigurationModifyParamsTossPay as PaymentMethodConfigurationModifyParamsTossPay, + PaymentMethodConfigurationModifyParamsTossPayDisplayPreference as PaymentMethodConfigurationModifyParamsTossPayDisplayPreference, PaymentMethodConfigurationModifyParamsTwint as PaymentMethodConfigurationModifyParamsTwint, PaymentMethodConfigurationModifyParamsTwintDisplayPreference as PaymentMethodConfigurationModifyParamsTwintDisplayPreference, PaymentMethodConfigurationModifyParamsUpi as PaymentMethodConfigurationModifyParamsUpi, @@ -4627,6 +4637,8 @@ PaymentMethodConfigurationUpdateParamsSunbitDisplayPreference as PaymentMethodConfigurationUpdateParamsSunbitDisplayPreference, PaymentMethodConfigurationUpdateParamsSwish as PaymentMethodConfigurationUpdateParamsSwish, PaymentMethodConfigurationUpdateParamsSwishDisplayPreference as PaymentMethodConfigurationUpdateParamsSwishDisplayPreference, + PaymentMethodConfigurationUpdateParamsTossPay as PaymentMethodConfigurationUpdateParamsTossPay, + PaymentMethodConfigurationUpdateParamsTossPayDisplayPreference as PaymentMethodConfigurationUpdateParamsTossPayDisplayPreference, PaymentMethodConfigurationUpdateParamsTwint as PaymentMethodConfigurationUpdateParamsTwint, PaymentMethodConfigurationUpdateParamsTwintDisplayPreference as PaymentMethodConfigurationUpdateParamsTwintDisplayPreference, PaymentMethodConfigurationUpdateParamsUpi as PaymentMethodConfigurationUpdateParamsUpi, @@ -4836,6 +4848,7 @@ PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetails as PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetails, PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCard as PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCard, PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardChecks as PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardChecks, + PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardThreeDSecure as PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardThreeDSecure, PaymentRecordReportPaymentAttemptGuaranteedParamsProcessorDetails as PaymentRecordReportPaymentAttemptGuaranteedParamsProcessorDetails, PaymentRecordReportPaymentAttemptGuaranteedParamsProcessorDetailsCustom as PaymentRecordReportPaymentAttemptGuaranteedParamsProcessorDetailsCustom, ) @@ -4859,6 +4872,7 @@ PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsBillingDetailsAddress as PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsBillingDetailsAddress, PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCard as PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCard, PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardChecks as PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardChecks, + PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardThreeDSecure as PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardThreeDSecure, PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCustom as PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCustom, PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsUsBankAccount as PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsUsBankAccount, PaymentRecordReportPaymentAttemptParamsShippingDetails as PaymentRecordReportPaymentAttemptParamsShippingDetails, @@ -4880,6 +4894,7 @@ PaymentRecordReportPaymentParamsPaymentMethodDetailsBillingDetailsAddress as PaymentRecordReportPaymentParamsPaymentMethodDetailsBillingDetailsAddress, PaymentRecordReportPaymentParamsPaymentMethodDetailsCard as PaymentRecordReportPaymentParamsPaymentMethodDetailsCard, PaymentRecordReportPaymentParamsPaymentMethodDetailsCardChecks as PaymentRecordReportPaymentParamsPaymentMethodDetailsCardChecks, + PaymentRecordReportPaymentParamsPaymentMethodDetailsCardThreeDSecure as PaymentRecordReportPaymentParamsPaymentMethodDetailsCardThreeDSecure, PaymentRecordReportPaymentParamsPaymentMethodDetailsCustom as PaymentRecordReportPaymentParamsPaymentMethodDetailsCustom, PaymentRecordReportPaymentParamsPaymentMethodDetailsUsBankAccount as PaymentRecordReportPaymentParamsPaymentMethodDetailsUsBankAccount, PaymentRecordReportPaymentParamsProcessorDetails as PaymentRecordReportPaymentParamsProcessorDetails, @@ -5539,6 +5554,7 @@ SetupIntentConfirmParamsPaymentMethodOptionsAcssDebitMandateOptions as SetupIntentConfirmParamsPaymentMethodOptionsAcssDebitMandateOptions, SetupIntentConfirmParamsPaymentMethodOptionsAmazonPay as SetupIntentConfirmParamsPaymentMethodOptionsAmazonPay, SetupIntentConfirmParamsPaymentMethodOptionsBacsDebit as SetupIntentConfirmParamsPaymentMethodOptionsBacsDebit, + SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitFinancialConnections as SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitFinancialConnections, SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitMandateOptions as SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitMandateOptions, SetupIntentConfirmParamsPaymentMethodOptionsBizum as SetupIntentConfirmParamsPaymentMethodOptionsBizum, SetupIntentConfirmParamsPaymentMethodOptionsBlik as SetupIntentConfirmParamsPaymentMethodOptionsBlik, @@ -5670,6 +5686,7 @@ SetupIntentCreateParamsPaymentMethodOptionsAcssDebitMandateOptions as SetupIntentCreateParamsPaymentMethodOptionsAcssDebitMandateOptions, SetupIntentCreateParamsPaymentMethodOptionsAmazonPay as SetupIntentCreateParamsPaymentMethodOptionsAmazonPay, SetupIntentCreateParamsPaymentMethodOptionsBacsDebit as SetupIntentCreateParamsPaymentMethodOptionsBacsDebit, + SetupIntentCreateParamsPaymentMethodOptionsBacsDebitFinancialConnections as SetupIntentCreateParamsPaymentMethodOptionsBacsDebitFinancialConnections, SetupIntentCreateParamsPaymentMethodOptionsBacsDebitMandateOptions as SetupIntentCreateParamsPaymentMethodOptionsBacsDebitMandateOptions, SetupIntentCreateParamsPaymentMethodOptionsBizum as SetupIntentCreateParamsPaymentMethodOptionsBizum, SetupIntentCreateParamsPaymentMethodOptionsBlik as SetupIntentCreateParamsPaymentMethodOptionsBlik, @@ -5801,6 +5818,7 @@ SetupIntentModifyParamsPaymentMethodOptionsAcssDebitMandateOptions as SetupIntentModifyParamsPaymentMethodOptionsAcssDebitMandateOptions, SetupIntentModifyParamsPaymentMethodOptionsAmazonPay as SetupIntentModifyParamsPaymentMethodOptionsAmazonPay, SetupIntentModifyParamsPaymentMethodOptionsBacsDebit as SetupIntentModifyParamsPaymentMethodOptionsBacsDebit, + SetupIntentModifyParamsPaymentMethodOptionsBacsDebitFinancialConnections as SetupIntentModifyParamsPaymentMethodOptionsBacsDebitFinancialConnections, SetupIntentModifyParamsPaymentMethodOptionsBacsDebitMandateOptions as SetupIntentModifyParamsPaymentMethodOptionsBacsDebitMandateOptions, SetupIntentModifyParamsPaymentMethodOptionsBizum as SetupIntentModifyParamsPaymentMethodOptionsBizum, SetupIntentModifyParamsPaymentMethodOptionsBlik as SetupIntentModifyParamsPaymentMethodOptionsBlik, @@ -5929,6 +5947,7 @@ SetupIntentUpdateParamsPaymentMethodOptionsAcssDebitMandateOptions as SetupIntentUpdateParamsPaymentMethodOptionsAcssDebitMandateOptions, SetupIntentUpdateParamsPaymentMethodOptionsAmazonPay as SetupIntentUpdateParamsPaymentMethodOptionsAmazonPay, SetupIntentUpdateParamsPaymentMethodOptionsBacsDebit as SetupIntentUpdateParamsPaymentMethodOptionsBacsDebit, + SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitFinancialConnections as SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitFinancialConnections, SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitMandateOptions as SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitMandateOptions, SetupIntentUpdateParamsPaymentMethodOptionsBizum as SetupIntentUpdateParamsPaymentMethodOptionsBizum, SetupIntentUpdateParamsPaymentMethodOptionsBlik as SetupIntentUpdateParamsPaymentMethodOptionsBlik, @@ -10949,6 +10968,14 @@ "stripe.params._customer_modify_params", False, ), + "CustomerModifyParamsMarketingAttribution": ( + "stripe.params._customer_modify_params", + False, + ), + "CustomerModifyParamsMarketingAttributionAdConversion": ( + "stripe.params._customer_modify_params", + False, + ), "CustomerModifyParamsShipping": ( "stripe.params._customer_modify_params", False, @@ -11179,6 +11206,14 @@ "stripe.params._customer_update_params", False, ), + "CustomerUpdateParamsMarketingAttribution": ( + "stripe.params._customer_update_params", + False, + ), + "CustomerUpdateParamsMarketingAttributionAdConversion": ( + "stripe.params._customer_update_params", + False, + ), "CustomerUpdateParamsShipping": ( "stripe.params._customer_update_params", False, @@ -13984,6 +14019,10 @@ "stripe.params._payment_attempt_record_report_authorized_params", False, ), + "PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardThreeDSecure": ( + "stripe.params._payment_attempt_record_report_authorized_params", + False, + ), "PaymentAttemptRecordReportAuthorizedParamsProcessorDetails": ( "stripe.params._payment_attempt_record_report_authorized_params", False, @@ -14044,6 +14083,10 @@ "stripe.params._payment_attempt_record_report_guaranteed_params", False, ), + "PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardThreeDSecure": ( + "stripe.params._payment_attempt_record_report_guaranteed_params", + False, + ), "PaymentAttemptRecordReportGuaranteedParamsProcessorDetails": ( "stripe.params._payment_attempt_record_report_guaranteed_params", False, @@ -21520,6 +21563,14 @@ "stripe.params._payment_method_configuration_create_params", False, ), + "PaymentMethodConfigurationCreateParamsTossPay": ( + "stripe.params._payment_method_configuration_create_params", + False, + ), + "PaymentMethodConfigurationCreateParamsTossPayDisplayPreference": ( + "stripe.params._payment_method_configuration_create_params", + False, + ), "PaymentMethodConfigurationCreateParamsTwint": ( "stripe.params._payment_method_configuration_create_params", False, @@ -22072,6 +22123,14 @@ "stripe.params._payment_method_configuration_modify_params", False, ), + "PaymentMethodConfigurationModifyParamsTossPay": ( + "stripe.params._payment_method_configuration_modify_params", + False, + ), + "PaymentMethodConfigurationModifyParamsTossPayDisplayPreference": ( + "stripe.params._payment_method_configuration_modify_params", + False, + ), "PaymentMethodConfigurationModifyParamsTwint": ( "stripe.params._payment_method_configuration_modify_params", False, @@ -22624,6 +22683,14 @@ "stripe.params._payment_method_configuration_update_params", False, ), + "PaymentMethodConfigurationUpdateParamsTossPay": ( + "stripe.params._payment_method_configuration_update_params", + False, + ), + "PaymentMethodConfigurationUpdateParamsTossPayDisplayPreference": ( + "stripe.params._payment_method_configuration_update_params", + False, + ), "PaymentMethodConfigurationUpdateParamsTwint": ( "stripe.params._payment_method_configuration_update_params", False, @@ -23284,6 +23351,10 @@ "stripe.params._payment_record_report_payment_attempt_guaranteed_params", False, ), + "PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardThreeDSecure": ( + "stripe.params._payment_record_report_payment_attempt_guaranteed_params", + False, + ), "PaymentRecordReportPaymentAttemptGuaranteedParamsProcessorDetails": ( "stripe.params._payment_record_report_payment_attempt_guaranteed_params", False, @@ -23360,6 +23431,10 @@ "stripe.params._payment_record_report_payment_attempt_params", False, ), + "PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardThreeDSecure": ( + "stripe.params._payment_record_report_payment_attempt_params", + False, + ), "PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCustom": ( "stripe.params._payment_record_report_payment_attempt_params", False, @@ -23436,6 +23511,10 @@ "stripe.params._payment_record_report_payment_params", False, ), + "PaymentRecordReportPaymentParamsPaymentMethodDetailsCardThreeDSecure": ( + "stripe.params._payment_record_report_payment_params", + False, + ), "PaymentRecordReportPaymentParamsPaymentMethodDetailsCustom": ( "stripe.params._payment_record_report_payment_params", False, @@ -25244,6 +25323,10 @@ "stripe.params._setup_intent_confirm_params", False, ), + "SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitFinancialConnections": ( + "stripe.params._setup_intent_confirm_params", + False, + ), "SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitMandateOptions": ( "stripe.params._setup_intent_confirm_params", False, @@ -25760,6 +25843,10 @@ "stripe.params._setup_intent_create_params", False, ), + "SetupIntentCreateParamsPaymentMethodOptionsBacsDebitFinancialConnections": ( + "stripe.params._setup_intent_create_params", + False, + ), "SetupIntentCreateParamsPaymentMethodOptionsBacsDebitMandateOptions": ( "stripe.params._setup_intent_create_params", False, @@ -26268,6 +26355,10 @@ "stripe.params._setup_intent_modify_params", False, ), + "SetupIntentModifyParamsPaymentMethodOptionsBacsDebitFinancialConnections": ( + "stripe.params._setup_intent_modify_params", + False, + ), "SetupIntentModifyParamsPaymentMethodOptionsBacsDebitMandateOptions": ( "stripe.params._setup_intent_modify_params", False, @@ -26764,6 +26855,10 @@ "stripe.params._setup_intent_update_params", False, ), + "SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitFinancialConnections": ( + "stripe.params._setup_intent_update_params", + False, + ), "SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitMandateOptions": ( "stripe.params._setup_intent_update_params", False, diff --git a/stripe/params/_customer_modify_params.py b/stripe/params/_customer_modify_params.py index 49ce2e0d1..9531dd6c0 100644 --- a/stripe/params/_customer_modify_params.py +++ b/stripe/params/_customer_modify_params.py @@ -55,6 +55,12 @@ class CustomerModifyParams(RequestOptions): """ Default invoice settings for this customer. """ + marketing_attributions: NotRequired[ + List["CustomerModifyParamsMarketingAttribution"] + ] + """ + Advertising attribution information for this customer. Only one attribution is supported, and it can only be set once. + """ metadata: NotRequired[ "Literal['']|Dict[str, str]|UntypedStripeObject[str]" ] @@ -186,6 +192,54 @@ class CustomerModifyParamsInvoiceSettingsRenderingOptions(TypedDict): """ +class CustomerModifyParamsMarketingAttribution(TypedDict): + ad_conversion: NotRequired[ + "CustomerModifyParamsMarketingAttributionAdConversion" + ] + """ + Information used when sending conversions to an advertising platform. + """ + click_id: NotRequired[str] + """ + The advertising platform's click identifier. + """ + occurred_at: NotRequired[int] + """ + The Unix timestamp when the advertising interaction occurred. + """ + utm_adgroup: NotRequired[str] + """ + The advertising group ID from the `utm_adgroup` parameter. + """ + utm_content: NotRequired[str] + """ + The advertising content identifier from the `utm_content` parameter. + """ + utm_id: NotRequired[str] + """ + The advertising campaign ID from the `utm_id` parameter. + """ + utm_medium: NotRequired[str] + """ + The marketing medium from the `utm_medium` parameter. + """ + utm_source: NotRequired[str] + """ + The referral source from the `utm_source` parameter. + """ + utm_term: NotRequired[str] + """ + The paid search term from the `utm_term` parameter. + """ + + +class CustomerModifyParamsMarketingAttributionAdConversion(TypedDict): + consent_collected: bool + """ + Whether the customer consented to sending conversion data to an advertising platform. + """ + + class CustomerModifyParamsShipping(TypedDict): address: "CustomerModifyParamsShippingAddress" """ diff --git a/stripe/params/_customer_update_params.py b/stripe/params/_customer_update_params.py index a07528cfe..57cf5269e 100644 --- a/stripe/params/_customer_update_params.py +++ b/stripe/params/_customer_update_params.py @@ -54,6 +54,12 @@ class CustomerUpdateParams(TypedDict): """ Default invoice settings for this customer. """ + marketing_attributions: NotRequired[ + List["CustomerUpdateParamsMarketingAttribution"] + ] + """ + Advertising attribution information for this customer. Only one attribution is supported, and it can only be set once. + """ metadata: NotRequired[ "Literal['']|Dict[str, str]|UntypedStripeObject[str]" ] @@ -185,6 +191,54 @@ class CustomerUpdateParamsInvoiceSettingsRenderingOptions(TypedDict): """ +class CustomerUpdateParamsMarketingAttribution(TypedDict): + ad_conversion: NotRequired[ + "CustomerUpdateParamsMarketingAttributionAdConversion" + ] + """ + Information used when sending conversions to an advertising platform. + """ + click_id: NotRequired[str] + """ + The advertising platform's click identifier. + """ + occurred_at: NotRequired[int] + """ + The Unix timestamp when the advertising interaction occurred. + """ + utm_adgroup: NotRequired[str] + """ + The advertising group ID from the `utm_adgroup` parameter. + """ + utm_content: NotRequired[str] + """ + The advertising content identifier from the `utm_content` parameter. + """ + utm_id: NotRequired[str] + """ + The advertising campaign ID from the `utm_id` parameter. + """ + utm_medium: NotRequired[str] + """ + The marketing medium from the `utm_medium` parameter. + """ + utm_source: NotRequired[str] + """ + The referral source from the `utm_source` parameter. + """ + utm_term: NotRequired[str] + """ + The paid search term from the `utm_term` parameter. + """ + + +class CustomerUpdateParamsMarketingAttributionAdConversion(TypedDict): + consent_collected: bool + """ + Whether the customer consented to sending conversion data to an advertising platform. + """ + + class CustomerUpdateParamsShipping(TypedDict): address: "CustomerUpdateParamsShippingAddress" """ diff --git a/stripe/params/_fx_quote_create_params.py b/stripe/params/_fx_quote_create_params.py index a6163d467..068a6b7e6 100644 --- a/stripe/params/_fx_quote_create_params.py +++ b/stripe/params/_fx_quote_create_params.py @@ -12,7 +12,7 @@ class FxQuoteCreateParams(RequestOptions): """ from_currencies: List[str] """ - A list of three letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be [supported currencies](https://stripe.com/docs/currencies). + A list of three letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be [supported currencies](https://stripe.com/docs/currencies). Payout-only currencies are also supported, but only for informational quotes (`lock_duration=none`). """ lock_duration: Union[Literal["day", "five_minutes", "hour", "none"], str] """ @@ -20,7 +20,7 @@ class FxQuoteCreateParams(RequestOptions): """ to_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). + 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). Payout-only currencies are also supported, but only for informational quotes (`lock_duration=none`). """ usage: NotRequired["FxQuoteCreateParamsUsage"] """ diff --git a/stripe/params/_payment_attempt_record_report_authenticated_params.py b/stripe/params/_payment_attempt_record_report_authenticated_params.py index 8e5e42979..af1546fd2 100644 --- a/stripe/params/_payment_attempt_record_report_authenticated_params.py +++ b/stripe/params/_payment_attempt_record_report_authenticated_params.py @@ -21,6 +21,10 @@ class PaymentAttemptRecordReportAuthenticatedParams(RequestOptions): """ Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. """ + payment_evaluations: NotRequired[List[str]] + """ + Payment evaluations associated with this reported payment. + """ payment_method_details: NotRequired[ "PaymentAttemptRecordReportAuthenticatedParamsPaymentMethodDetails" ] diff --git a/stripe/params/_payment_attempt_record_report_authorized_params.py b/stripe/params/_payment_attempt_record_report_authorized_params.py index 3f1f4df6f..d6b93a06b 100644 --- a/stripe/params/_payment_attempt_record_report_authorized_params.py +++ b/stripe/params/_payment_attempt_record_report_authorized_params.py @@ -2,7 +2,7 @@ # File generated from our OpenAPI spec from stripe._request_options import RequestOptions from stripe._stripe_object import UntypedStripeObject -from typing import Dict, List +from typing import Dict, List, Union from typing_extensions import Literal, NotRequired, TypedDict @@ -63,6 +63,12 @@ class PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCard( """ Verification checks performed on the card. """ + three_d_secure: NotRequired[ + "PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardThreeDSecure" + ] + """ + Populated if this transaction used 3D Secure authentication. + """ class PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardChecks( @@ -88,6 +94,51 @@ class PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardChecks( """ +class PaymentAttemptRecordReportAuthorizedParamsPaymentMethodDetailsCardThreeDSecure( + TypedDict, +): + authentication_flow: NotRequired[ + "Literal['challenge', 'frictionless']|str" + ] + """ + For authenticated transactions: Indicates how the issuing bank authenticated the customer. + """ + electronic_commerce_indicator: NotRequired[ + "Literal['01', '02', '05', '06', '07']|str" + ] + """ + The Electronic Commerce Indicator (ECI). A protocol-level field indicating what degree of authentication was performed. + """ + exemption_indicator: NotRequired["Literal['low_risk', 'none']|str"] + """ + The exemption requested via 3DS and accepted by the issuer at authentication time. + """ + result: Union[ + Literal[ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ], + str, + ] + """ + Indicates the outcome of 3D Secure authentication. + """ + result_reason: NotRequired[ + "Literal['abandoned', 'canceled', 'card_not_enrolled', 'network_not_supported', 'protocol_error', 'rejected']|str" + ] + """ + Additional information about why 3D Secure succeeded or failed, based on the `result`. + """ + version: Union[Literal["1.0.2", "2.1.0", "2.2.0", "2.3.0", "2.3.1"], str] + """ + The version of 3D Secure that was used. + """ + + class PaymentAttemptRecordReportAuthorizedParamsProcessorDetails(TypedDict): custom: NotRequired[ "PaymentAttemptRecordReportAuthorizedParamsProcessorDetailsCustom" diff --git a/stripe/params/_payment_attempt_record_report_guaranteed_params.py b/stripe/params/_payment_attempt_record_report_guaranteed_params.py index 9c24e7dc5..afc35af43 100644 --- a/stripe/params/_payment_attempt_record_report_guaranteed_params.py +++ b/stripe/params/_payment_attempt_record_report_guaranteed_params.py @@ -67,6 +67,12 @@ class PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCard( """ Verification checks performed on the card. """ + three_d_secure: NotRequired[ + "PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardThreeDSecure" + ] + """ + Populated if this transaction used 3D Secure authentication. + """ class PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardChecks( @@ -92,6 +98,51 @@ class PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardChecks( """ +class PaymentAttemptRecordReportGuaranteedParamsPaymentMethodDetailsCardThreeDSecure( + TypedDict, +): + authentication_flow: NotRequired[ + "Literal['challenge', 'frictionless']|str" + ] + """ + For authenticated transactions: Indicates how the issuing bank authenticated the customer. + """ + electronic_commerce_indicator: NotRequired[ + "Literal['01', '02', '05', '06', '07']|str" + ] + """ + The Electronic Commerce Indicator (ECI). A protocol-level field indicating what degree of authentication was performed. + """ + exemption_indicator: NotRequired["Literal['low_risk', 'none']|str"] + """ + The exemption requested via 3DS and accepted by the issuer at authentication time. + """ + result: Union[ + Literal[ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ], + str, + ] + """ + Indicates the outcome of 3D Secure authentication. + """ + result_reason: NotRequired[ + "Literal['abandoned', 'canceled', 'card_not_enrolled', 'network_not_supported', 'protocol_error', 'rejected']|str" + ] + """ + Additional information about why 3D Secure succeeded or failed, based on the `result`. + """ + version: Union[Literal["1.0.2", "2.1.0", "2.2.0", "2.3.0", "2.3.1"], str] + """ + The version of 3D Secure that was used. + """ + + class PaymentAttemptRecordReportGuaranteedParamsProcessorDetails(TypedDict): custom: NotRequired[ "PaymentAttemptRecordReportGuaranteedParamsProcessorDetailsCustom" diff --git a/stripe/params/_payment_method_configuration_create_params.py b/stripe/params/_payment_method_configuration_create_params.py index 38bdd882d..36d6b095e 100644 --- a/stripe/params/_payment_method_configuration_create_params.py +++ b/stripe/params/_payment_method_configuration_create_params.py @@ -288,6 +288,10 @@ class PaymentMethodConfigurationCreateParams(RequestOptions): """ Swish is a [real-time](https://docs.stripe.com/payments/real-time) payment method popular in Sweden. It allows customers to [authenticate and approve](https://docs.stripe.com/payments/payment-methods#customer-actions) payments using the Swish mobile app and the Swedish BankID mobile app. Check this [page](https://docs.stripe.com/payments/swish) for more details. """ + toss_pay: NotRequired["PaymentMethodConfigurationCreateParamsTossPay"] + """ + Customers are redirected to Toss Pay to authenticate their payment, then return to your website or app. You receive immediate notification of whether the payment succeeded or failed. With recurring access, customers can authorize a reusable mandate for future off-session payments. + """ twint: NotRequired["PaymentMethodConfigurationCreateParamsTwint"] """ Twint is a payment method popular in Switzerland. It allows customers to pay using their mobile phone. Check this [page](https://docs.stripe.com/payments/twint) for more details. @@ -1370,6 +1374,24 @@ class PaymentMethodConfigurationCreateParamsSwishDisplayPreference(TypedDict): """ +class PaymentMethodConfigurationCreateParamsTossPay(TypedDict): + display_preference: NotRequired[ + "PaymentMethodConfigurationCreateParamsTossPayDisplayPreference" + ] + """ + Whether or not the payment method should be displayed. + """ + + +class PaymentMethodConfigurationCreateParamsTossPayDisplayPreference( + TypedDict +): + preference: NotRequired["Literal['none', 'off', 'on']|str"] + """ + The account's preference for whether or not to display this payment method. + """ + + class PaymentMethodConfigurationCreateParamsTwint(TypedDict): display_preference: NotRequired[ "PaymentMethodConfigurationCreateParamsTwintDisplayPreference" diff --git a/stripe/params/_payment_method_configuration_modify_params.py b/stripe/params/_payment_method_configuration_modify_params.py index 117a2e4d3..cad4c35ef 100644 --- a/stripe/params/_payment_method_configuration_modify_params.py +++ b/stripe/params/_payment_method_configuration_modify_params.py @@ -288,6 +288,10 @@ class PaymentMethodConfigurationModifyParams(RequestOptions): """ Swish is a [real-time](https://docs.stripe.com/payments/real-time) payment method popular in Sweden. It allows customers to [authenticate and approve](https://docs.stripe.com/payments/payment-methods#customer-actions) payments using the Swish mobile app and the Swedish BankID mobile app. Check this [page](https://docs.stripe.com/payments/swish) for more details. """ + toss_pay: NotRequired["PaymentMethodConfigurationModifyParamsTossPay"] + """ + Customers are redirected to Toss Pay to authenticate their payment, then return to your website or app. You receive immediate notification of whether the payment succeeded or failed. With recurring access, customers can authorize a reusable mandate for future off-session payments. + """ twint: NotRequired["PaymentMethodConfigurationModifyParamsTwint"] """ Twint is a payment method popular in Switzerland. It allows customers to pay using their mobile phone. Check this [page](https://docs.stripe.com/payments/twint) for more details. @@ -1370,6 +1374,24 @@ class PaymentMethodConfigurationModifyParamsSwishDisplayPreference(TypedDict): """ +class PaymentMethodConfigurationModifyParamsTossPay(TypedDict): + display_preference: NotRequired[ + "PaymentMethodConfigurationModifyParamsTossPayDisplayPreference" + ] + """ + Whether or not the payment method should be displayed. + """ + + +class PaymentMethodConfigurationModifyParamsTossPayDisplayPreference( + TypedDict +): + preference: NotRequired["Literal['none', 'off', 'on']|str"] + """ + The account's preference for whether or not to display this payment method. + """ + + class PaymentMethodConfigurationModifyParamsTwint(TypedDict): display_preference: NotRequired[ "PaymentMethodConfigurationModifyParamsTwintDisplayPreference" diff --git a/stripe/params/_payment_method_configuration_update_params.py b/stripe/params/_payment_method_configuration_update_params.py index cc2f3b50d..995db4cdd 100644 --- a/stripe/params/_payment_method_configuration_update_params.py +++ b/stripe/params/_payment_method_configuration_update_params.py @@ -287,6 +287,10 @@ class PaymentMethodConfigurationUpdateParams(TypedDict): """ Swish is a [real-time](https://docs.stripe.com/payments/real-time) payment method popular in Sweden. It allows customers to [authenticate and approve](https://docs.stripe.com/payments/payment-methods#customer-actions) payments using the Swish mobile app and the Swedish BankID mobile app. Check this [page](https://docs.stripe.com/payments/swish) for more details. """ + toss_pay: NotRequired["PaymentMethodConfigurationUpdateParamsTossPay"] + """ + Customers are redirected to Toss Pay to authenticate their payment, then return to your website or app. You receive immediate notification of whether the payment succeeded or failed. With recurring access, customers can authorize a reusable mandate for future off-session payments. + """ twint: NotRequired["PaymentMethodConfigurationUpdateParamsTwint"] """ Twint is a payment method popular in Switzerland. It allows customers to pay using their mobile phone. Check this [page](https://docs.stripe.com/payments/twint) for more details. @@ -1369,6 +1373,24 @@ class PaymentMethodConfigurationUpdateParamsSwishDisplayPreference(TypedDict): """ +class PaymentMethodConfigurationUpdateParamsTossPay(TypedDict): + display_preference: NotRequired[ + "PaymentMethodConfigurationUpdateParamsTossPayDisplayPreference" + ] + """ + Whether or not the payment method should be displayed. + """ + + +class PaymentMethodConfigurationUpdateParamsTossPayDisplayPreference( + TypedDict +): + preference: NotRequired["Literal['none', 'off', 'on']|str"] + """ + The account's preference for whether or not to display this payment method. + """ + + class PaymentMethodConfigurationUpdateParamsTwint(TypedDict): display_preference: NotRequired[ "PaymentMethodConfigurationUpdateParamsTwintDisplayPreference" diff --git a/stripe/params/_payment_record_report_payment_attempt_guaranteed_params.py b/stripe/params/_payment_record_report_payment_attempt_guaranteed_params.py index 25a4e00ef..97a58da2d 100644 --- a/stripe/params/_payment_record_report_payment_attempt_guaranteed_params.py +++ b/stripe/params/_payment_record_report_payment_attempt_guaranteed_params.py @@ -63,6 +63,12 @@ class PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCard( """ Verification checks performed on the card. """ + three_d_secure: NotRequired[ + "PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardThreeDSecure" + ] + """ + Populated if this transaction used 3D Secure authentication. + """ class PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardChecks( @@ -88,6 +94,51 @@ class PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardC """ +class PaymentRecordReportPaymentAttemptGuaranteedParamsPaymentMethodDetailsCardThreeDSecure( + TypedDict, +): + authentication_flow: NotRequired[ + "Literal['challenge', 'frictionless']|str" + ] + """ + For authenticated transactions: Indicates how the issuing bank authenticated the customer. + """ + electronic_commerce_indicator: NotRequired[ + "Literal['01', '02', '05', '06', '07']|str" + ] + """ + The Electronic Commerce Indicator (ECI). A protocol-level field indicating what degree of authentication was performed. + """ + exemption_indicator: NotRequired["Literal['low_risk', 'none']|str"] + """ + The exemption requested via 3DS and accepted by the issuer at authentication time. + """ + result: Union[ + Literal[ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ], + str, + ] + """ + Indicates the outcome of 3D Secure authentication. + """ + result_reason: NotRequired[ + "Literal['abandoned', 'canceled', 'card_not_enrolled', 'network_not_supported', 'protocol_error', 'rejected']|str" + ] + """ + Additional information about why 3D Secure succeeded or failed, based on the `result`. + """ + version: Union[Literal["1.0.2", "2.1.0", "2.2.0", "2.3.0", "2.3.1"], str] + """ + The version of 3D Secure that was used. + """ + + class PaymentRecordReportPaymentAttemptGuaranteedParamsProcessorDetails( TypedDict, ): diff --git a/stripe/params/_payment_record_report_payment_attempt_params.py b/stripe/params/_payment_record_report_payment_attempt_params.py index c620cc13b..bb9bf9f2a 100644 --- a/stripe/params/_payment_record_report_payment_attempt_params.py +++ b/stripe/params/_payment_record_report_payment_attempt_params.py @@ -2,7 +2,7 @@ # File generated from our OpenAPI spec from stripe._request_options import RequestOptions from stripe._stripe_object import UntypedStripeObject -from typing import Dict, List +from typing import Dict, List, Union from typing_extensions import Literal, NotRequired, TypedDict @@ -256,6 +256,12 @@ class PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCard( """ Verification checks performed on the card. """ + three_d_secure: NotRequired[ + "PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardThreeDSecure" + ] + """ + Populated if this transaction used 3D Secure authentication. + """ class PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardChecks( @@ -281,6 +287,51 @@ class PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardChecks( """ +class PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCardThreeDSecure( + TypedDict, +): + authentication_flow: NotRequired[ + "Literal['challenge', 'frictionless']|str" + ] + """ + For authenticated transactions: Indicates how the issuing bank authenticated the customer. + """ + electronic_commerce_indicator: NotRequired[ + "Literal['01', '02', '05', '06', '07']|str" + ] + """ + The Electronic Commerce Indicator (ECI). A protocol-level field indicating what degree of authentication was performed. + """ + exemption_indicator: NotRequired["Literal['low_risk', 'none']|str"] + """ + The exemption requested via 3DS and accepted by the issuer at authentication time. + """ + result: Union[ + Literal[ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ], + str, + ] + """ + Indicates the outcome of 3D Secure authentication. + """ + result_reason: NotRequired[ + "Literal['abandoned', 'canceled', 'card_not_enrolled', 'network_not_supported', 'protocol_error', 'rejected']|str" + ] + """ + Additional information about why 3D Secure succeeded or failed, based on the `result`. + """ + version: Union[Literal["1.0.2", "2.1.0", "2.2.0", "2.3.0", "2.3.1"], str] + """ + The version of 3D Secure that was used. + """ + + class PaymentRecordReportPaymentAttemptParamsPaymentMethodDetailsCustom( TypedDict, ): diff --git a/stripe/params/_payment_record_report_payment_params.py b/stripe/params/_payment_record_report_payment_params.py index 6bb7e045d..70d1d1802 100644 --- a/stripe/params/_payment_record_report_payment_params.py +++ b/stripe/params/_payment_record_report_payment_params.py @@ -2,7 +2,7 @@ # File generated from our OpenAPI spec from stripe._request_options import RequestOptions from stripe._stripe_object import UntypedStripeObject -from typing import Dict, List +from typing import Dict, List, Union from typing_extensions import Literal, NotRequired, TypedDict @@ -298,6 +298,12 @@ class PaymentRecordReportPaymentParamsPaymentMethodDetailsCard(TypedDict): """ Verification checks performed on the card. """ + three_d_secure: NotRequired[ + "PaymentRecordReportPaymentParamsPaymentMethodDetailsCardThreeDSecure" + ] + """ + Populated if this transaction used 3D Secure authentication. + """ class PaymentRecordReportPaymentParamsPaymentMethodDetailsCardChecks( @@ -323,6 +329,51 @@ class PaymentRecordReportPaymentParamsPaymentMethodDetailsCardChecks( """ +class PaymentRecordReportPaymentParamsPaymentMethodDetailsCardThreeDSecure( + TypedDict, +): + authentication_flow: NotRequired[ + "Literal['challenge', 'frictionless']|str" + ] + """ + For authenticated transactions: Indicates how the issuing bank authenticated the customer. + """ + electronic_commerce_indicator: NotRequired[ + "Literal['01', '02', '05', '06', '07']|str" + ] + """ + The Electronic Commerce Indicator (ECI). A protocol-level field indicating what degree of authentication was performed. + """ + exemption_indicator: NotRequired["Literal['low_risk', 'none']|str"] + """ + The exemption requested via 3DS and accepted by the issuer at authentication time. + """ + result: Union[ + Literal[ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ], + str, + ] + """ + Indicates the outcome of 3D Secure authentication. + """ + result_reason: NotRequired[ + "Literal['abandoned', 'canceled', 'card_not_enrolled', 'network_not_supported', 'protocol_error', 'rejected']|str" + ] + """ + Additional information about why 3D Secure succeeded or failed, based on the `result`. + """ + version: Union[Literal["1.0.2", "2.1.0", "2.2.0", "2.3.0", "2.3.1"], str] + """ + The version of 3D Secure that was used. + """ + + class PaymentRecordReportPaymentParamsPaymentMethodDetailsCustom(TypedDict): display_name: NotRequired[str] """ diff --git a/stripe/params/_setup_intent_confirm_params.py b/stripe/params/_setup_intent_confirm_params.py index 67af5b4f6..3cac5a788 100644 --- a/stripe/params/_setup_intent_confirm_params.py +++ b/stripe/params/_setup_intent_confirm_params.py @@ -1397,6 +1397,12 @@ class SetupIntentConfirmParamsPaymentMethodOptionsAmazonPay(TypedDict): class SetupIntentConfirmParamsPaymentMethodOptionsBacsDebit(TypedDict): + financial_connections: NotRequired[ + "SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitFinancialConnections" + ] + """ + Additional fields for Financial Connections session creation. + """ mandate_options: NotRequired[ "SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitMandateOptions" ] @@ -1408,6 +1414,15 @@ class SetupIntentConfirmParamsPaymentMethodOptionsBacsDebit(TypedDict): ] +class SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitFinancialConnections( + TypedDict, +): + return_url: NotRequired[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. + """ + + class SetupIntentConfirmParamsPaymentMethodOptionsBacsDebitMandateOptions( TypedDict, ): diff --git a/stripe/params/_setup_intent_create_params.py b/stripe/params/_setup_intent_create_params.py index 8030aaadd..fa7931546 100644 --- a/stripe/params/_setup_intent_create_params.py +++ b/stripe/params/_setup_intent_create_params.py @@ -1546,6 +1546,12 @@ class SetupIntentCreateParamsPaymentMethodOptionsAmazonPay(TypedDict): class SetupIntentCreateParamsPaymentMethodOptionsBacsDebit(TypedDict): + financial_connections: NotRequired[ + "SetupIntentCreateParamsPaymentMethodOptionsBacsDebitFinancialConnections" + ] + """ + Additional fields for Financial Connections session creation. + """ mandate_options: NotRequired[ "SetupIntentCreateParamsPaymentMethodOptionsBacsDebitMandateOptions" ] @@ -1557,6 +1563,15 @@ class SetupIntentCreateParamsPaymentMethodOptionsBacsDebit(TypedDict): ] +class SetupIntentCreateParamsPaymentMethodOptionsBacsDebitFinancialConnections( + TypedDict, +): + return_url: NotRequired[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. + """ + + class SetupIntentCreateParamsPaymentMethodOptionsBacsDebitMandateOptions( TypedDict, ): diff --git a/stripe/params/_setup_intent_modify_params.py b/stripe/params/_setup_intent_modify_params.py index eb213bc71..21b13c3ca 100644 --- a/stripe/params/_setup_intent_modify_params.py +++ b/stripe/params/_setup_intent_modify_params.py @@ -1251,6 +1251,12 @@ class SetupIntentModifyParamsPaymentMethodOptionsAmazonPay(TypedDict): class SetupIntentModifyParamsPaymentMethodOptionsBacsDebit(TypedDict): + financial_connections: NotRequired[ + "SetupIntentModifyParamsPaymentMethodOptionsBacsDebitFinancialConnections" + ] + """ + Additional fields for Financial Connections session creation. + """ mandate_options: NotRequired[ "SetupIntentModifyParamsPaymentMethodOptionsBacsDebitMandateOptions" ] @@ -1262,6 +1268,15 @@ class SetupIntentModifyParamsPaymentMethodOptionsBacsDebit(TypedDict): ] +class SetupIntentModifyParamsPaymentMethodOptionsBacsDebitFinancialConnections( + TypedDict, +): + return_url: NotRequired[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. + """ + + class SetupIntentModifyParamsPaymentMethodOptionsBacsDebitMandateOptions( TypedDict, ): diff --git a/stripe/params/_setup_intent_update_params.py b/stripe/params/_setup_intent_update_params.py index 6cb4ccdd1..d4a03f692 100644 --- a/stripe/params/_setup_intent_update_params.py +++ b/stripe/params/_setup_intent_update_params.py @@ -1250,6 +1250,12 @@ class SetupIntentUpdateParamsPaymentMethodOptionsAmazonPay(TypedDict): class SetupIntentUpdateParamsPaymentMethodOptionsBacsDebit(TypedDict): + financial_connections: NotRequired[ + "SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitFinancialConnections" + ] + """ + Additional fields for Financial Connections session creation. + """ mandate_options: NotRequired[ "SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitMandateOptions" ] @@ -1261,6 +1267,15 @@ class SetupIntentUpdateParamsPaymentMethodOptionsBacsDebit(TypedDict): ] +class SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitFinancialConnections( + TypedDict, +): + return_url: NotRequired[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. + """ + + class SetupIntentUpdateParamsPaymentMethodOptionsBacsDebitMandateOptions( TypedDict, ): diff --git a/stripe/params/checkout/_session_create_params.py b/stripe/params/checkout/_session_create_params.py index a259f7a0d..184462a1e 100644 --- a/stripe/params/checkout/_session_create_params.py +++ b/stripe/params/checkout/_session_create_params.py @@ -415,6 +415,10 @@ class SessionCreateParams(RequestOptions): We recommend that you review your privacy policy and check with your legal contacts before using this feature. Learn more about [collecting phone numbers with Checkout](https://docs.stripe.com/payments/checkout/phone-numbers). """ + pricing_token: NotRequired[str] + """ + Token used to resolve the presentment currency for this Checkout Session. + """ redirect_on_completion: NotRequired[ "Literal['always', 'if_required', 'never']|str" ] diff --git a/stripe/params/radar/_payment_evaluation_create_params.py b/stripe/params/radar/_payment_evaluation_create_params.py index de6664735..6a787f6c7 100644 --- a/stripe/params/radar/_payment_evaluation_create_params.py +++ b/stripe/params/radar/_payment_evaluation_create_params.py @@ -178,6 +178,14 @@ class PaymentEvaluationCreateParamsPaymentDetailsMoneyMovementDetailsSepaDebit( """ Supply the SEPA Creditor Identifier configured for the intended debit with your selected processor. Obtain it from your processor's SEPA configuration API or onboarding/support information. Do not supply a statement descriptor, IBAN, processor merchant-account ID, or mandate reference. If the creditor identifier is unknown, omit it. """ + customer_presence: NotRequired["Literal['off_session', 'on_session']|str"] + """ + Describes the presence of the customer during the payment. + """ + payment_type: NotRequired[Literal["one_off", "recurring"]] + """ + Describes whether this payment is one-off or recurring. + """ class PaymentEvaluationCreateParamsPaymentDetailsMoneyMovementDetailsUsBankAccount( diff --git a/stripe/params/shared_payment/__init__.py b/stripe/params/shared_payment/__init__.py index ec8fc0913..c03f2f201 100644 --- a/stripe/params/shared_payment/__init__.py +++ b/stripe/params/shared_payment/__init__.py @@ -17,6 +17,7 @@ ) from stripe.params.shared_payment._issued_token_create_params import ( IssuedTokenCreateParams as IssuedTokenCreateParams, + IssuedTokenCreateParamsReferralFeeDetails as IssuedTokenCreateParamsReferralFeeDetails, IssuedTokenCreateParamsSellerDetails as IssuedTokenCreateParamsSellerDetails, IssuedTokenCreateParamsUsageLimits as IssuedTokenCreateParamsUsageLimits, IssuedTokenCreateParamsUsageLimitsRecurring as IssuedTokenCreateParamsUsageLimitsRecurring, @@ -54,6 +55,10 @@ "stripe.params.shared_payment._issued_token_create_params", False, ), + "IssuedTokenCreateParamsReferralFeeDetails": ( + "stripe.params.shared_payment._issued_token_create_params", + False, + ), "IssuedTokenCreateParamsSellerDetails": ( "stripe.params.shared_payment._issued_token_create_params", False, diff --git a/stripe/params/shared_payment/_issued_token_create_params.py b/stripe/params/shared_payment/_issued_token_create_params.py index 29362b2ac..c0537a2f7 100644 --- a/stripe/params/shared_payment/_issued_token_create_params.py +++ b/stripe/params/shared_payment/_issued_token_create_params.py @@ -15,6 +15,12 @@ class IssuedTokenCreateParams(RequestOptions): """ The PaymentMethod that is going to be shared by the SharedPaymentIssuedToken. """ + referral_fee_details: NotRequired[ + "IssuedTokenCreateParamsReferralFeeDetails" + ] + """ + Referral fee details for this SharedPaymentToken. + """ return_url: NotRequired[str] """ If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. @@ -41,6 +47,21 @@ class IssuedTokenCreateParams(RequestOptions): """ +class IssuedTokenCreateParamsReferralFeeDetails(TypedDict): + customer: NotRequired[str] + """ + The Customer to be invoiced for fees assessed. + """ + customer_account: NotRequired[str] + """ + The account with a Customer configuration to be invoiced for fees assessed. + """ + referral_fee_percent: float + """ + The percentage of the payment to charge as a referral fee, from 0 through 50 with at most two decimal places. + """ + + class IssuedTokenCreateParamsSellerDetails(TypedDict): external_id: NotRequired[str] """ diff --git a/stripe/params/terminal/_reader_list_params.py b/stripe/params/terminal/_reader_list_params.py index caeaa5c8f..e27226260 100644 --- a/stripe/params/terminal/_reader_list_params.py +++ b/stripe/params/terminal/_reader_list_params.py @@ -7,7 +7,7 @@ class ReaderListParams(RequestOptions): device_type: NotRequired[ - "Literal['bbpos_chipper2x', 'bbpos_wisepad3', 'bbpos_wisepos_e', 'mobile_phone_reader', 'simulated_stripe_s700', 'simulated_stripe_s710', 'simulated_stripe_t600', 'simulated_verifone_m425', 'simulated_verifone_p630', 'simulated_verifone_ux700', 'simulated_verifone_v660p', 'simulated_wisepos_e', 'stripe_m2', 'stripe_s700', 'stripe_s710', 'stripe_t600', 'verifone_P400', 'verifone_m425', 'verifone_p630', 'verifone_ux700', 'verifone_v660p']|str" + "Literal['bbpos_chipper2x', 'bbpos_wisepad3', 'bbpos_wisepos_e', 'mobile_phone_reader', 'simulated_stripe_s700', 'simulated_stripe_s710', 'simulated_stripe_t600', 'simulated_verifone_m425', 'simulated_verifone_p630', 'simulated_verifone_ux700', 'simulated_verifone_v660p', 'simulated_wisepos_e', 'stripe_m2', 'stripe_s700', 'stripe_s700_devkit', 'stripe_s710', 'stripe_s710_devkit', 'stripe_t600', 'stripe_t600_devkit', 'verifone_P400', 'verifone_m425', 'verifone_p630', 'verifone_ux700', 'verifone_ux700_devkit', 'verifone_v660p', 'verifone_v660p_devkit']|str" ] """ Filters readers by device type diff --git a/stripe/params/v2/money_management/__init__.py b/stripe/params/v2/money_management/__init__.py index 6d22a4c9f..fdf436784 100644 --- a/stripe/params/v2/money_management/__init__.py +++ b/stripe/params/v2/money_management/__init__.py @@ -154,6 +154,7 @@ OutboundPaymentCreateParamsToPayoutMethodOptionsBankAccount as OutboundPaymentCreateParamsToPayoutMethodOptionsBankAccount, OutboundPaymentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptions as OutboundPaymentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptions, OutboundPaymentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptionsAch as OutboundPaymentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptionsAch, + OutboundPaymentCreateParamsToPayoutMethodOptionsCheckSend as OutboundPaymentCreateParamsToPayoutMethodOptionsCheckSend, ) from stripe.params.v2.money_management._outbound_payment_list_params import ( OutboundPaymentListParams as OutboundPaymentListParams, @@ -185,6 +186,8 @@ OutboundSetupIntentCreateParamsPayoutMethodDataApplePay as OutboundSetupIntentCreateParamsPayoutMethodDataApplePay, OutboundSetupIntentCreateParamsPayoutMethodDataBankAccount as OutboundSetupIntentCreateParamsPayoutMethodDataBankAccount, OutboundSetupIntentCreateParamsPayoutMethodDataCard as OutboundSetupIntentCreateParamsPayoutMethodDataCard, + OutboundSetupIntentCreateParamsPayoutMethodDataCheckSend as OutboundSetupIntentCreateParamsPayoutMethodDataCheckSend, + OutboundSetupIntentCreateParamsPayoutMethodDataCheckSendMailingAddress as OutboundSetupIntentCreateParamsPayoutMethodDataCheckSendMailingAddress, OutboundSetupIntentCreateParamsPayoutMethodDataCryptoWallet as OutboundSetupIntentCreateParamsPayoutMethodDataCryptoWallet, OutboundSetupIntentCreateParamsPayoutMethodDataPix as OutboundSetupIntentCreateParamsPayoutMethodDataPix, ) @@ -235,6 +238,7 @@ PayoutIntentCreateParamsToPayoutMethodOptionsBankAccount as PayoutIntentCreateParamsToPayoutMethodOptionsBankAccount, PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptions as PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptions, PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptionsAch as PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptionsAch, + PayoutIntentCreateParamsToPayoutMethodOptionsCheckSend as PayoutIntentCreateParamsToPayoutMethodOptionsCheckSend, ) from stripe.params.v2.money_management._payout_intent_list_params import ( PayoutIntentListParams as PayoutIntentListParams, @@ -257,6 +261,7 @@ PayoutIntentUpdateParamsToPayoutMethodOptionsBankAccount as PayoutIntentUpdateParamsToPayoutMethodOptionsBankAccount, PayoutIntentUpdateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptions as PayoutIntentUpdateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptions, PayoutIntentUpdateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptionsAch as PayoutIntentUpdateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptionsAch, + PayoutIntentUpdateParamsToPayoutMethodOptionsCheckSend as PayoutIntentUpdateParamsToPayoutMethodOptionsCheckSend, ) from stripe.params.v2.money_management._payout_method_archive_params import ( PayoutMethodArchiveParams as PayoutMethodArchiveParams, @@ -342,6 +347,15 @@ from stripe.params.v2.money_management._reward_program_update_params import ( RewardProgramUpdateParams as RewardProgramUpdateParams, ) + from stripe.params.v2.money_management._spending_mandate_cancel_params import ( + SpendingMandateCancelParams as SpendingMandateCancelParams, + ) + from stripe.params.v2.money_management._spending_mandate_list_params import ( + SpendingMandateListParams as SpendingMandateListParams, + ) + from stripe.params.v2.money_management._spending_mandate_retrieve_params import ( + SpendingMandateRetrieveParams as SpendingMandateRetrieveParams, + ) from stripe.params.v2.money_management._test_helper_earned_credits_params import ( TestHelperEarnedCreditsParams as TestHelperEarnedCreditsParams, ) @@ -673,6 +687,10 @@ "stripe.params.v2.money_management._outbound_payment_create_params", False, ), + "OutboundPaymentCreateParamsToPayoutMethodOptionsCheckSend": ( + "stripe.params.v2.money_management._outbound_payment_create_params", + False, + ), "OutboundPaymentListParams": ( "stripe.params.v2.money_management._outbound_payment_list_params", False, @@ -749,6 +767,14 @@ "stripe.params.v2.money_management._outbound_setup_intent_create_params", False, ), + "OutboundSetupIntentCreateParamsPayoutMethodDataCheckSend": ( + "stripe.params.v2.money_management._outbound_setup_intent_create_params", + False, + ), + "OutboundSetupIntentCreateParamsPayoutMethodDataCheckSendMailingAddress": ( + "stripe.params.v2.money_management._outbound_setup_intent_create_params", + False, + ), "OutboundSetupIntentCreateParamsPayoutMethodDataCryptoWallet": ( "stripe.params.v2.money_management._outbound_setup_intent_create_params", False, @@ -869,6 +895,10 @@ "stripe.params.v2.money_management._payout_intent_create_params", False, ), + "PayoutIntentCreateParamsToPayoutMethodOptionsCheckSend": ( + "stripe.params.v2.money_management._payout_intent_create_params", + False, + ), "PayoutIntentListParams": ( "stripe.params.v2.money_management._payout_intent_list_params", False, @@ -917,6 +947,10 @@ "stripe.params.v2.money_management._payout_intent_update_params", False, ), + "PayoutIntentUpdateParamsToPayoutMethodOptionsCheckSend": ( + "stripe.params.v2.money_management._payout_intent_update_params", + False, + ), "PayoutMethodArchiveParams": ( "stripe.params.v2.money_management._payout_method_archive_params", False, @@ -1037,6 +1071,18 @@ "stripe.params.v2.money_management._reward_program_update_params", False, ), + "SpendingMandateCancelParams": ( + "stripe.params.v2.money_management._spending_mandate_cancel_params", + False, + ), + "SpendingMandateListParams": ( + "stripe.params.v2.money_management._spending_mandate_list_params", + False, + ), + "SpendingMandateRetrieveParams": ( + "stripe.params.v2.money_management._spending_mandate_retrieve_params", + False, + ), "TestHelperEarnedCreditsParams": ( "stripe.params.v2.money_management._test_helper_earned_credits_params", False, diff --git a/stripe/params/v2/money_management/_outbound_payment_create_params.py b/stripe/params/v2/money_management/_outbound_payment_create_params.py index 4f1cc77e2..f528fe1b9 100644 --- a/stripe/params/v2/money_management/_outbound_payment_create_params.py +++ b/stripe/params/v2/money_management/_outbound_payment_create_params.py @@ -147,6 +147,12 @@ class OutboundPaymentCreateParamsToPayoutMethodOptions(TypedDict): """ Options for bank account payout methods. """ + check_send: NotRequired[ + "OutboundPaymentCreateParamsToPayoutMethodOptionsCheckSend" + ] + """ + Options for check send payout methods. + """ class OutboundPaymentCreateParamsToPayoutMethodOptionsBankAccount(TypedDict): @@ -207,3 +213,22 @@ class OutboundPaymentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetwor """ The transaction purpose for this ACH payment. """ + + +class OutboundPaymentCreateParamsToPayoutMethodOptionsCheckSend(TypedDict): + attachment_file: NotRequired[str] + """ + The ID of a file to include as an attachment with the check. + """ + memo: NotRequired[str] + """ + Memo printed on the memo field of the check. + """ + shipping_speed: NotRequired["Literal['priority', 'standard']|str"] + """ + Open Enum. Shipping speed of the check. Defaults to standard. + """ + signature: str + """ + Signature printed on the check. + """ diff --git a/stripe/params/v2/money_management/_outbound_setup_intent_create_params.py b/stripe/params/v2/money_management/_outbound_setup_intent_create_params.py index 75e8e0f8e..e3fef7129 100644 --- a/stripe/params/v2/money_management/_outbound_setup_intent_create_params.py +++ b/stripe/params/v2/money_management/_outbound_setup_intent_create_params.py @@ -56,6 +56,12 @@ class OutboundSetupIntentCreateParamsPayoutMethodData(TypedDict): """ The type specific details of the card payout method. """ + check_send: NotRequired[ + "OutboundSetupIntentCreateParamsPayoutMethodDataCheckSend" + ] + """ + The type specific details of the check send payout method. + """ crypto_wallet: NotRequired[ "OutboundSetupIntentCreateParamsPayoutMethodDataCryptoWallet" ] @@ -71,6 +77,7 @@ class OutboundSetupIntentCreateParamsPayoutMethodData(TypedDict): "apple_pay", "bank_account", "card", + "check_send", "crypto_wallet", "network_business_profile_wallet", "pix", @@ -145,6 +152,46 @@ class OutboundSetupIntentCreateParamsPayoutMethodDataCard(TypedDict): """ +class OutboundSetupIntentCreateParamsPayoutMethodDataCheckSend(TypedDict): + mailing_address: "OutboundSetupIntentCreateParamsPayoutMethodDataCheckSendMailingAddress" + """ + The US mailing address the check is sent to. + """ + payee_name: str + """ + The name printed on the check's payee line. + """ + + +class OutboundSetupIntentCreateParamsPayoutMethodDataCheckSendMailingAddress( + TypedDict, +): + city: str + """ + City. + """ + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: str + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: NotRequired[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: str + """ + ZIP or postal code. + """ + state: str + """ + State. + """ + + class OutboundSetupIntentCreateParamsPayoutMethodDataCryptoWallet(TypedDict): address: str """ diff --git a/stripe/params/v2/money_management/_outbound_setup_intent_update_params.py b/stripe/params/v2/money_management/_outbound_setup_intent_update_params.py index 854d4d3dd..ab049395f 100644 --- a/stripe/params/v2/money_management/_outbound_setup_intent_update_params.py +++ b/stripe/params/v2/money_management/_outbound_setup_intent_update_params.py @@ -35,6 +35,7 @@ class OutboundSetupIntentUpdateParamsPayoutMethodData(TypedDict): "apple_pay", "bank_account", "card", + "check_send", "crypto_wallet", "network_business_profile_wallet", "pix", diff --git a/stripe/params/v2/money_management/_payout_intent_create_params.py b/stripe/params/v2/money_management/_payout_intent_create_params.py index 0b29f409e..1624f29bf 100644 --- a/stripe/params/v2/money_management/_payout_intent_create_params.py +++ b/stripe/params/v2/money_management/_payout_intent_create_params.py @@ -102,6 +102,12 @@ class PayoutIntentCreateParamsToPayoutMethodOptions(TypedDict): """ Options for bank account payout methods. """ + check_send: NotRequired[ + "PayoutIntentCreateParamsToPayoutMethodOptionsCheckSend" + ] + """ + Options for check send payout methods. + """ class PayoutIntentCreateParamsToPayoutMethodOptionsBankAccount(TypedDict): @@ -162,3 +168,22 @@ class PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOp """ The transaction purpose for this ACH payment. """ + + +class PayoutIntentCreateParamsToPayoutMethodOptionsCheckSend(TypedDict): + attachment_file: NotRequired[str] + """ + The ID of a file to include as an attachment with the check. + """ + memo: NotRequired[str] + """ + Memo printed on the memo field of the check. + """ + shipping_speed: NotRequired["Literal['priority', 'standard']|str"] + """ + Open Enum. Shipping speed of the check. Defaults to standard. + """ + signature: str + """ + Signature printed on the check. + """ diff --git a/stripe/params/v2/money_management/_payout_intent_update_params.py b/stripe/params/v2/money_management/_payout_intent_update_params.py index 915a5237e..d2979e4e0 100644 --- a/stripe/params/v2/money_management/_payout_intent_update_params.py +++ b/stripe/params/v2/money_management/_payout_intent_update_params.py @@ -77,6 +77,12 @@ class PayoutIntentUpdateParamsToPayoutMethodOptions(TypedDict): """ Options for bank account payout methods. """ + check_send: NotRequired[ + "PayoutIntentUpdateParamsToPayoutMethodOptionsCheckSend" + ] + """ + Options for check send payout methods. + """ class PayoutIntentUpdateParamsToPayoutMethodOptionsBankAccount(TypedDict): @@ -137,3 +143,22 @@ class PayoutIntentUpdateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOp """ The transaction purpose for this ACH payment. """ + + +class PayoutIntentUpdateParamsToPayoutMethodOptionsCheckSend(TypedDict): + attachment_file: NotRequired[str] + """ + The ID of a file to include as an attachment with the check. + """ + memo: NotRequired[str] + """ + Memo printed on the memo field of the check. + """ + shipping_speed: NotRequired["Literal['priority', 'standard']|str"] + """ + Open Enum. Shipping speed of the check. Defaults to standard. + """ + signature: str + """ + Signature printed on the check. + """ diff --git a/stripe/params/v2/money_management/_received_debit_list_params.py b/stripe/params/v2/money_management/_received_debit_list_params.py index 4525e0f42..dc1b936ba 100644 --- a/stripe/params/v2/money_management/_received_debit_list_params.py +++ b/stripe/params/v2/money_management/_received_debit_list_params.py @@ -10,5 +10,9 @@ class ReceivedDebitListParams(TypedDict): """ received_debit_mandate: NotRequired[str] """ - Filter by the received debit mandate ID. + Filter by the received debit mandate ID. Deprecated: use `spending_mandate` instead. + """ + spending_mandate: NotRequired[str] + """ + Filter by the SpendingMandate ID. """ diff --git a/stripe/params/v2/money_management/_spending_mandate_cancel_params.py b/stripe/params/v2/money_management/_spending_mandate_cancel_params.py new file mode 100644 index 000000000..5c0977b14 --- /dev/null +++ b/stripe/params/v2/money_management/_spending_mandate_cancel_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TypedDict + + +class SpendingMandateCancelParams(TypedDict): + pass diff --git a/stripe/params/v2/money_management/_spending_mandate_list_params.py b/stripe/params/v2/money_management/_spending_mandate_list_params.py new file mode 100644 index 000000000..1043e98c8 --- /dev/null +++ b/stripe/params/v2/money_management/_spending_mandate_list_params.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import List, Union +from typing_extensions import Literal, NotRequired, TypedDict + + +class SpendingMandateListParams(TypedDict): + financial_account: NotRequired[str] + """ + The ID of the FinancialAccount to filter by. + """ + limit: NotRequired[int] + """ + The page limit. + """ + statuses: NotRequired[ + List[ + Union[ + Literal[ + "active", "canceled", "expired", "pending_cancellation" + ], + str, + ] + ] + ] + """ + Filter by mandate status. + """ + type: NotRequired["Literal['bank_transfer']|str"] + """ + The type of SpendingMandate to filter by. + """ diff --git a/stripe/params/v2/money_management/_spending_mandate_retrieve_params.py b/stripe/params/v2/money_management/_spending_mandate_retrieve_params.py new file mode 100644 index 000000000..6a7f386af --- /dev/null +++ b/stripe/params/v2/money_management/_spending_mandate_retrieve_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TypedDict + + +class SpendingMandateRetrieveParams(TypedDict): + pass diff --git a/stripe/radar/_payment_evaluation.py b/stripe/radar/_payment_evaluation.py index e4b065d7d..8e44dabb0 100644 --- a/stripe/radar/_payment_evaluation.py +++ b/stripe/radar/_payment_evaluation.py @@ -377,6 +377,16 @@ class SepaDebit(StripeObject): """ Creditor identifier used for the intended debit. """ + customer_presence: Optional[ + Union[Literal["off_session", "on_session"], str] + ] + """ + Describes the presence of the customer during the payment. + """ + payment_type: Optional[Literal["one_off", "recurring"]] + """ + Describes whether this payment is one-off or recurring. + """ class UsBankAccount(StripeObject): customer_presence: Optional[ diff --git a/stripe/reserve/_hold.py b/stripe/reserve/_hold.py index 878db9dbf..c449398fc 100644 --- a/stripe/reserve/_hold.py +++ b/stripe/reserve/_hold.py @@ -16,7 +16,7 @@ class Hold(ListableAPIResource["Hold"]): """ - ReserveHolds are used to place a temporary ReserveHold on a merchant's funds. + A ReserveHold holds a portion of an account's funds until it's released. Stripe or the account's platform can create a ReserveHold directly, and a ReservePlan creates ReserveHolds automatically from incoming Charges. """ OBJECT_NAME: ClassVar[Literal["reserve.hold"]] = "reserve.hold" @@ -110,7 +110,7 @@ class ReleaseSchedule(StripeObject): @classmethod def list(cls, **params: Unpack["HoldListParams"]) -> ListObject["Hold"]: """ - Returns a list of ReserveHolds previously created. The ReserveHolds are returned in sorted order, with the most recent ReserveHolds appearing first. + Returns a list of ReserveHolds on your account or on one of your connected accounts. The ReserveHolds are returned in sorted order, with the most recent ReserveHolds appearing first. """ result = cls._static_request( "get", @@ -130,7 +130,7 @@ async def list_async( cls, **params: Unpack["HoldListParams"] ) -> ListObject["Hold"]: """ - Returns a list of ReserveHolds previously created. The ReserveHolds are returned in sorted order, with the most recent ReserveHolds appearing first. + Returns a list of ReserveHolds on your account or on one of your connected accounts. The ReserveHolds are returned in sorted order, with the most recent ReserveHolds appearing first. """ result = await cls._static_request_async( "get", @@ -150,7 +150,7 @@ def retrieve( cls, id: str, **params: Unpack["HoldRetrieveParams"] ) -> "Hold": """ - Retrieve a ReserveHold. + Retrieve a ReserveHold on your account or on one of your connected accounts. """ instance = cls(id, **params) instance.refresh() @@ -161,7 +161,7 @@ async def retrieve_async( cls, id: str, **params: Unpack["HoldRetrieveParams"] ) -> "Hold": """ - Retrieve a ReserveHold. + Retrieve a ReserveHold on your account or on one of your connected accounts. """ instance = cls(id, **params) await instance.refresh_async() diff --git a/stripe/reserve/_hold_service.py b/stripe/reserve/_hold_service.py index 552d912b0..a6ad058bb 100644 --- a/stripe/reserve/_hold_service.py +++ b/stripe/reserve/_hold_service.py @@ -20,7 +20,7 @@ def list( options: Optional["RequestOptions"] = None, ) -> "ListObject[Hold]": """ - Returns a list of ReserveHolds previously created. The ReserveHolds are returned in sorted order, with the most recent ReserveHolds appearing first. + Returns a list of ReserveHolds on your account or on one of your connected accounts. The ReserveHolds are returned in sorted order, with the most recent ReserveHolds appearing first. """ return cast( "ListObject[Hold]", @@ -39,7 +39,7 @@ async def list_async( options: Optional["RequestOptions"] = None, ) -> "ListObject[Hold]": """ - Returns a list of ReserveHolds previously created. The ReserveHolds are returned in sorted order, with the most recent ReserveHolds appearing first. + Returns a list of ReserveHolds on your account or on one of your connected accounts. The ReserveHolds are returned in sorted order, with the most recent ReserveHolds appearing first. """ return cast( "ListObject[Hold]", @@ -60,7 +60,7 @@ def retrieve( options: Optional["RequestOptions"] = None, ) -> "Hold": """ - Retrieve a ReserveHold. + Retrieve a ReserveHold on your account or on one of your connected accounts. """ return cast( "Hold", @@ -81,7 +81,7 @@ async def retrieve_async( options: Optional["RequestOptions"] = None, ) -> "Hold": """ - Retrieve a ReserveHold. + Retrieve a ReserveHold on your account or on one of your connected accounts. """ return cast( "Hold", diff --git a/stripe/reserve/_plan.py b/stripe/reserve/_plan.py index 25f54030d..ce9cc20ec 100644 --- a/stripe/reserve/_plan.py +++ b/stripe/reserve/_plan.py @@ -98,7 +98,7 @@ class RollingRelease(StripeObject): @classmethod def list(cls, **params: Unpack["PlanListParams"]) -> ListObject["Plan"]: """ - Returns a list of ReservePlans previously created. The ReservePlans are returned in sorted order, with the most recent ReservePlans appearing first. + Returns a list of ReservePlans on your account or on one of your connected accounts. The ReservePlans are returned in sorted order, with the most recent ReservePlans appearing first. """ result = cls._static_request( "get", @@ -118,7 +118,7 @@ async def list_async( cls, **params: Unpack["PlanListParams"] ) -> ListObject["Plan"]: """ - Returns a list of ReservePlans previously created. The ReservePlans are returned in sorted order, with the most recent ReservePlans appearing first. + Returns a list of ReservePlans on your account or on one of your connected accounts. The ReservePlans are returned in sorted order, with the most recent ReservePlans appearing first. """ result = await cls._static_request_async( "get", @@ -138,7 +138,7 @@ def retrieve( cls, id: str, **params: Unpack["PlanRetrieveParams"] ) -> "Plan": """ - Retrieve a ReservePlan. + Retrieve a ReservePlan on your account or on one of your connected accounts. """ instance = cls(id, **params) instance.refresh() @@ -149,7 +149,7 @@ async def retrieve_async( cls, id: str, **params: Unpack["PlanRetrieveParams"] ) -> "Plan": """ - Retrieve a ReservePlan. + Retrieve a ReservePlan on your account or on one of your connected accounts. """ instance = cls(id, **params) await instance.refresh_async() diff --git a/stripe/reserve/_plan_service.py b/stripe/reserve/_plan_service.py index c987e6507..c1796a4c4 100644 --- a/stripe/reserve/_plan_service.py +++ b/stripe/reserve/_plan_service.py @@ -20,7 +20,7 @@ def list( options: Optional["RequestOptions"] = None, ) -> "ListObject[Plan]": """ - Returns a list of ReservePlans previously created. The ReservePlans are returned in sorted order, with the most recent ReservePlans appearing first. + Returns a list of ReservePlans on your account or on one of your connected accounts. The ReservePlans are returned in sorted order, with the most recent ReservePlans appearing first. """ return cast( "ListObject[Plan]", @@ -39,7 +39,7 @@ async def list_async( options: Optional["RequestOptions"] = None, ) -> "ListObject[Plan]": """ - Returns a list of ReservePlans previously created. The ReservePlans are returned in sorted order, with the most recent ReservePlans appearing first. + Returns a list of ReservePlans on your account or on one of your connected accounts. The ReservePlans are returned in sorted order, with the most recent ReservePlans appearing first. """ return cast( "ListObject[Plan]", @@ -60,7 +60,7 @@ def retrieve( options: Optional["RequestOptions"] = None, ) -> "Plan": """ - Retrieve a ReservePlan. + Retrieve a ReservePlan on your account or on one of your connected accounts. """ return cast( "Plan", @@ -81,7 +81,7 @@ async def retrieve_async( options: Optional["RequestOptions"] = None, ) -> "Plan": """ - Retrieve a ReservePlan. + Retrieve a ReservePlan on your account or on one of your connected accounts. """ return cast( "Plan", diff --git a/stripe/reserve/_release.py b/stripe/reserve/_release.py index 222f02ed9..d0eb5386d 100644 --- a/stripe/reserve/_release.py +++ b/stripe/reserve/_release.py @@ -106,7 +106,7 @@ def list( cls, **params: Unpack["ReleaseListParams"] ) -> ListObject["Release"]: """ - Returns a list of ReserveReleases previously created. The ReserveReleases are returned in sorted order, with the most recent ReserveReleases appearing first. + Returns a list of ReserveReleases on your account or on one of your connected accounts. The ReserveReleases are returned in sorted order, with the most recent ReserveReleases appearing first. """ result = cls._static_request( "get", @@ -126,7 +126,7 @@ async def list_async( cls, **params: Unpack["ReleaseListParams"] ) -> ListObject["Release"]: """ - Returns a list of ReserveReleases previously created. The ReserveReleases are returned in sorted order, with the most recent ReserveReleases appearing first. + Returns a list of ReserveReleases on your account or on one of your connected accounts. The ReserveReleases are returned in sorted order, with the most recent ReserveReleases appearing first. """ result = await cls._static_request_async( "get", @@ -146,7 +146,7 @@ def retrieve( cls, id: str, **params: Unpack["ReleaseRetrieveParams"] ) -> "Release": """ - Retrieve a ReserveRelease. + Retrieve a ReserveRelease on your account or on one of your connected accounts. """ instance = cls(id, **params) instance.refresh() @@ -157,7 +157,7 @@ async def retrieve_async( cls, id: str, **params: Unpack["ReleaseRetrieveParams"] ) -> "Release": """ - Retrieve a ReserveRelease. + Retrieve a ReserveRelease on your account or on one of your connected accounts. """ instance = cls(id, **params) await instance.refresh_async() diff --git a/stripe/reserve/_release_service.py b/stripe/reserve/_release_service.py index f453e927c..fc3ea847e 100644 --- a/stripe/reserve/_release_service.py +++ b/stripe/reserve/_release_service.py @@ -22,7 +22,7 @@ def list( options: Optional["RequestOptions"] = None, ) -> "ListObject[Release]": """ - Returns a list of ReserveReleases previously created. The ReserveReleases are returned in sorted order, with the most recent ReserveReleases appearing first. + Returns a list of ReserveReleases on your account or on one of your connected accounts. The ReserveReleases are returned in sorted order, with the most recent ReserveReleases appearing first. """ return cast( "ListObject[Release]", @@ -41,7 +41,7 @@ async def list_async( options: Optional["RequestOptions"] = None, ) -> "ListObject[Release]": """ - Returns a list of ReserveReleases previously created. The ReserveReleases are returned in sorted order, with the most recent ReserveReleases appearing first. + Returns a list of ReserveReleases on your account or on one of your connected accounts. The ReserveReleases are returned in sorted order, with the most recent ReserveReleases appearing first. """ return cast( "ListObject[Release]", @@ -62,7 +62,7 @@ def retrieve( options: Optional["RequestOptions"] = None, ) -> "Release": """ - Retrieve a ReserveRelease. + Retrieve a ReserveRelease on your account or on one of your connected accounts. """ return cast( "Release", @@ -83,7 +83,7 @@ async def retrieve_async( options: Optional["RequestOptions"] = None, ) -> "Release": """ - Retrieve a ReserveRelease. + Retrieve a ReserveRelease on your account or on one of your connected accounts. """ return cast( "Release", diff --git a/stripe/shared_payment/_granted_token.py b/stripe/shared_payment/_granted_token.py index b039114a3..560039563 100644 --- a/stripe/shared_payment/_granted_token.py +++ b/stripe/shared_payment/_granted_token.py @@ -92,11 +92,11 @@ 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`. + If an 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`. + If an address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. """ cvc_check: Optional[str] """ @@ -428,6 +428,20 @@ class Link(StripeObject): "link": Link, } + class ReferralFeeDetails(StripeObject): + class Rate(StripeObject): + percentage: Optional[float] + """ + The percentage of the payment amount which will be calculated as a fee. + """ + type: Literal["percentage"] + """ + The type of fee rate. + """ + + rate: Rate + _inner_class_types = {"rate": Rate} + class RiskDetails(StripeObject): class Insights(StripeObject): class Bot(StripeObject): @@ -602,6 +616,10 @@ class Recurring(StripeObject): """ Details of the PaymentMethod that was shared via this token. """ + referral_fee_details: Optional[ReferralFeeDetails] + """ + Referral fees may be charged when a SharedPaymentGrantedToken is used. This behavior is controlled by the issuer of the token. This field provides details about the referral fee rate. + """ risk_details: Optional[RiskDetails] """ Risk details of the SharedPaymentGrantedToken. @@ -811,6 +829,7 @@ def test_helpers(self): _inner_class_types = { "agent_details": AgentDetails, "payment_method_details": PaymentMethodDetails, + "referral_fee_details": ReferralFeeDetails, "risk_details": RiskDetails, "usage_details": UsageDetails, "usage_limits": UsageLimits, diff --git a/stripe/shared_payment/_issued_token.py b/stripe/shared_payment/_issued_token.py index 9216e3f04..a148b1b4c 100644 --- a/stripe/shared_payment/_issued_token.py +++ b/stripe/shared_payment/_issued_token.py @@ -61,6 +61,20 @@ class UseStripeSdk(StripeObject): "use_stripe_sdk": UseStripeSdk, } + class ReferralFeeDetails(StripeObject): + customer: str + """ + The Customer to be invoiced for fees assessed. + """ + customer_account: Optional[str] + """ + The account to be invoiced for fees assessed. + """ + referral_fee_percent: float + """ + The percentage of the payment charged as a referral fee. + """ + class RiskDetails(StripeObject): class Insights(StripeObject): class Bot(StripeObject): @@ -245,6 +259,10 @@ class Recurring(StripeObject): """ ID of an existing PaymentMethod. """ + referral_fee_details: Optional[ReferralFeeDetails] + """ + Referral fee details of the SharedPaymentIssuedToken. + """ return_url: Optional[str] """ If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. @@ -468,6 +486,7 @@ async def revoke_async( _inner_class_types = { "next_action": NextAction, + "referral_fee_details": ReferralFeeDetails, "risk_details": RiskDetails, "seller_details": SellerDetails, "usage_details": UsageDetails, diff --git a/stripe/terminal/_reader.py b/stripe/terminal/_reader.py index dd1b2dff7..b070d57ef 100644 --- a/stripe/terminal/_reader.py +++ b/stripe/terminal/_reader.py @@ -1011,6 +1011,12 @@ class LineItem(StripeObject): "set_reader_display": SetReaderDisplay, } + class DeviceHealthDetail(StripeObject): + type: Union[Literal["unrecoverable_tamper"], str] + """ + The type of condition affecting the reader's device health. + """ + action: Optional[Action] """ The most recent action performed by the reader. @@ -1019,6 +1025,14 @@ class LineItem(StripeObject): """ Always true for a deleted object """ + device_health: Optional[Union[Literal["healthy", "unhealthy"], str]] + """ + The overall device health of the reader: `healthy` or `unhealthy`. Renamed to `no_issues_detected` and `needs_attention` respectively; see `device_health_details` for the specific conditions. + """ + device_health_details: Optional[List[DeviceHealthDetail]] + """ + The set of conditions affecting the reader's device health. Empty when there are no conditions. + """ device_sw_version: Optional[str] """ The current software version of the reader. @@ -3024,7 +3038,10 @@ async def timeout_input_collection_async( def test_helpers(self): return self.TestHelpers(self) - _inner_class_types = {"action": Action} + _inner_class_types = { + "action": Action, + "device_health_details": DeviceHealthDetail, + } Reader.TestHelpers._resource_cls = Reader diff --git a/stripe/v2/_money_management_service.py b/stripe/v2/_money_management_service.py index 6fc741223..56a4054e8 100644 --- a/stripe/v2/_money_management_service.py +++ b/stripe/v2/_money_management_service.py @@ -77,6 +77,9 @@ from stripe.v2.money_management._reward_program_service import ( RewardProgramService, ) + from stripe.v2.money_management._spending_mandate_service import ( + SpendingMandateService, + ) from stripe.v2.money_management._test_helper_service import ( TestHelperService, ) @@ -184,6 +187,10 @@ "stripe.v2.money_management._reward_program_enrollment_service", "RewardProgramEnrollmentService", ], + "spending_mandates": [ + "stripe.v2.money_management._spending_mandate_service", + "SpendingMandateService", + ], "test_helpers": [ "stripe.v2.money_management._test_helper_service", "TestHelperService", @@ -224,6 +231,7 @@ class MoneyManagementService(StripeService): recipient_verifications: "RecipientVerificationService" reward_programs: "RewardProgramService" reward_program_enrollments: "RewardProgramEnrollmentService" + spending_mandates: "SpendingMandateService" test_helpers: "TestHelperService" transactions: "TransactionService" transaction_entries: "TransactionEntryService" diff --git a/stripe/v2/money_management/__init__.py b/stripe/v2/money_management/__init__.py index 8aa5668aa..befe116e4 100644 --- a/stripe/v2/money_management/__init__.py +++ b/stripe/v2/money_management/__init__.py @@ -175,6 +175,12 @@ from stripe.v2.money_management._reward_program_service import ( RewardProgramService as RewardProgramService, ) + from stripe.v2.money_management._spending_mandate import ( + SpendingMandate as SpendingMandate, + ) + from stripe.v2.money_management._spending_mandate_service import ( + SpendingMandateService as SpendingMandateService, + ) from stripe.v2.money_management._test_helper_service import ( TestHelperService as TestHelperService, ) @@ -384,6 +390,11 @@ "stripe.v2.money_management._reward_program_service", False, ), + "SpendingMandate": ("stripe.v2.money_management._spending_mandate", False), + "SpendingMandateService": ( + "stripe.v2.money_management._spending_mandate_service", + False, + ), "TestHelperService": ( "stripe.v2.money_management._test_helper_service", False, diff --git a/stripe/v2/money_management/_outbound_payment.py b/stripe/v2/money_management/_outbound_payment.py index 6ff1e3504..93abd2da3 100644 --- a/stripe/v2/money_management/_outbound_payment.py +++ b/stripe/v2/money_management/_outbound_payment.py @@ -73,6 +73,9 @@ class StatusDetails(StripeObject): class Failed(StripeObject): reason: Union[ Literal[ + "check_attachment_too_large", + "check_expired", + "check_undeliverable", "fx_rate_drift_exceeded_after_review", "paper_check_attachment_too_large", "paper_check_expired", @@ -218,11 +221,38 @@ class Ach(StripeObject): "preferred_network_options": PreferredNetworkOptions, } + class CheckSend(StripeObject): + attachment_file: Optional[str] + """ + The ID of a file to include as an attachment with the check. + """ + memo: Optional[str] + """ + Memo printed on the memo field of the check. + """ + shipping_speed: Optional[ + Union[Literal["priority", "standard"], str] + ] + """ + Open Enum. Shipping speed of the check. Defaults to standard. + """ + signature: str + """ + Signature printed on the check. + """ + bank_account: Optional[BankAccount] """ Options for bank account payout methods. """ - _inner_class_types = {"bank_account": BankAccount} + check_send: Optional[CheckSend] + """ + Options for check send payout methods. + """ + _inner_class_types = { + "bank_account": BankAccount, + "check_send": CheckSend, + } credited: Amount """ @@ -268,6 +298,69 @@ class Card(StripeObject): A unique identifier that can be used to track this OutboundPayment with the recipient card. """ + class CheckSend(StripeObject): + class MailingAddress(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. + """ + + carrier: Union[Literal["fedex", "usps"], str] + """ + Open Enum. Carrier of the check. + """ + check_number: str + """ + Check number. + """ + current_postal_code: str + """ + Postal code of the latest tracking update. + """ + mailed_check_preview_file: Optional[str] + """ + The ID of a file containing a preview image of the mailed check. + """ + mailing_address: MailingAddress + """ + Mailing address of the check. + """ + tracking_number: str + """ + Tracking number for the check. + """ + tracking_status: Union[ + Literal["delivered", "in_transit", "mailed"], str + ] + """ + Open Enum. Tracking status of the check. + """ + updated_at: str + """ + When the tracking details were last updated. + """ + _inner_class_types = {"mailing_address": MailingAddress} + class CryptoWallet(StripeObject): blockchain_transaction: Optional[str] """ @@ -341,6 +434,10 @@ class MailingAddress(StripeObject): """ Card tracking details. """ + check_send: Optional[CheckSend] + """ + Check send tracking details. + """ crypto_wallet: Optional[CryptoWallet] """ Crypto wallet tracking details. @@ -369,6 +466,7 @@ class MailingAddress(StripeObject): _inner_class_types = { "bank_account": BankAccount, "card": Card, + "check_send": CheckSend, "crypto_wallet": CryptoWallet, "paper_check": PaperCheck, } diff --git a/stripe/v2/money_management/_payout_intent.py b/stripe/v2/money_management/_payout_intent.py index 5711d9365..ce1589a3f 100644 --- a/stripe/v2/money_management/_payout_intent.py +++ b/stripe/v2/money_management/_payout_intent.py @@ -189,6 +189,9 @@ class HandleFailure(StripeObject): failure_reason: Union[ Literal[ "account_not_configured_as_recipient", + "check_attachment_too_large", + "check_expired", + "check_undeliverable", "currency_not_supported_for_financial_account_balance", "feature_not_active_for_recipient", "fx_rate_drift_exceeded_after_review", @@ -367,11 +370,38 @@ class Ach(StripeObject): "preferred_network_options": PreferredNetworkOptions, } + class CheckSend(StripeObject): + attachment_file: Optional[str] + """ + The ID of a file to include as an attachment with the check. + """ + memo: Optional[str] + """ + Memo printed on the memo field of the check. + """ + shipping_speed: Optional[ + Union[Literal["priority", "standard"], str] + ] + """ + Open Enum. Shipping speed of the check. Defaults to standard. + """ + signature: str + """ + Signature printed on the check. + """ + bank_account: Optional[BankAccount] """ Options for bank account payout methods. """ - _inner_class_types = {"bank_account": BankAccount} + check_send: Optional[CheckSend] + """ + Options for check send payout methods. + """ + _inner_class_types = { + "bank_account": BankAccount, + "check_send": CheckSend, + } credited: Optional[Amount] """ diff --git a/stripe/v2/money_management/_payout_method.py b/stripe/v2/money_management/_payout_method.py index 7c6a776bb..4df01249f 100644 --- a/stripe/v2/money_management/_payout_method.py +++ b/stripe/v2/money_management/_payout_method.py @@ -121,6 +121,43 @@ class Card(StripeObject): The list of currencies supported by this bank account. """ + class CheckSend(StripeObject): + class MailingAddress(StripeObject): + city: str + """ + City. + """ + country: str + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: 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: str + """ + ZIP or postal code. + """ + state: str + """ + State. + """ + + mailing_address: MailingAddress + """ + The US mailing address the check is sent to. + """ + payee_name: str + """ + The name printed on the check's payee line. + """ + _inner_class_types = {"mailing_address": MailingAddress} + class CryptoWallet(StripeObject): address: str """ @@ -210,6 +247,10 @@ class UsageStatus(StripeObject): """ The PayoutMethodCard object details. """ + check_send: Optional[CheckSend] + """ + The PayoutMethodCheckSend object details. + """ created: str """ Created timestamp. @@ -252,6 +293,7 @@ class UsageStatus(StripeObject): "apple_pay", "bank_account", "card", + "check_send", "crypto_wallet", "network_business_profile_wallet", "pix", @@ -270,6 +312,7 @@ class UsageStatus(StripeObject): "apple_pay": ApplePay, "bank_account": BankAccount, "card": Card, + "check_send": CheckSend, "crypto_wallet": CryptoWallet, "network_business_profile_wallet": NetworkBusinessProfileWallet, "pix": Pix, diff --git a/stripe/v2/money_management/_received_debit.py b/stripe/v2/money_management/_received_debit.py index 4b9a8451a..553285044 100644 --- a/stripe/v2/money_management/_received_debit.py +++ b/stripe/v2/money_management/_received_debit.py @@ -50,6 +50,7 @@ class GbBankAccount(StripeObject): received_debit_mandate: Optional[str] """ The ID of the mandate associated with this debit. + Deprecated: use `bank_transfer.spending_mandate` instead. """ sort_code: Optional[str] """ @@ -148,6 +149,10 @@ class UsBankAccount(StripeObject): """ Open Enum. The type of the payment method used to originate the debit. """ + spending_mandate: Optional[str] + """ + The ID of the SpendingMandate associated with this debit. + """ statement_descriptor: Optional[str] """ The statement descriptor set by the originator of the debit. diff --git a/stripe/v2/money_management/_received_debit_mandate_service.py b/stripe/v2/money_management/_received_debit_mandate_service.py index 1c1375356..2069e6ca3 100644 --- a/stripe/v2/money_management/_received_debit_mandate_service.py +++ b/stripe/v2/money_management/_received_debit_mandate_service.py @@ -29,6 +29,7 @@ def list( options: Optional["RequestOptions"] = None, ) -> "ListObject[ReceivedDebitMandate]": """ + Deprecated: Use ListSpendingMandates instead. Returns a list of ReceivedDebitMandates. """ return cast( @@ -48,6 +49,7 @@ async def list_async( options: Optional["RequestOptions"] = None, ) -> "ListObject[ReceivedDebitMandate]": """ + Deprecated: Use ListSpendingMandates instead. Returns a list of ReceivedDebitMandates. """ return cast( @@ -69,6 +71,7 @@ def retrieve( options: Optional["RequestOptions"] = None, ) -> "ReceivedDebitMandate": """ + Deprecated: Use RetrieveSpendingMandate instead. Retrieves the details of an existing ReceivedDebitMandate. """ return cast( @@ -92,6 +95,7 @@ async def retrieve_async( options: Optional["RequestOptions"] = None, ) -> "ReceivedDebitMandate": """ + Deprecated: Use RetrieveSpendingMandate instead. Retrieves the details of an existing ReceivedDebitMandate. """ return cast( @@ -115,6 +119,7 @@ def cancel( options: Optional["RequestOptions"] = None, ) -> "ReceivedDebitMandate": """ + Deprecated: Use CancelSpendingMandate instead. Cancels an active ReceivedDebitMandate. """ return cast( @@ -138,6 +143,7 @@ async def cancel_async( options: Optional["RequestOptions"] = None, ) -> "ReceivedDebitMandate": """ + Deprecated: Use CancelSpendingMandate instead. Cancels an active ReceivedDebitMandate. """ return cast( diff --git a/stripe/v2/money_management/_spending_mandate.py b/stripe/v2/money_management/_spending_mandate.py new file mode 100644 index 000000000..b4ba23526 --- /dev/null +++ b/stripe/v2/money_management/_spending_mandate.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar, Optional, Union +from typing_extensions import Literal + + +class SpendingMandate(StripeObject): + """ + A SpendingMandate authorizes a counterparty to pull money from a Financial Account. + """ + + OBJECT_NAME: ClassVar[Literal["v2.money_management.spending_mandate"]] = ( + "v2.money_management.spending_mandate" + ) + + class BankTransfer(StripeObject): + account_holder_name: Optional[str] + """ + The name of the account holder that initiated the debit. + """ + financial_address: str + """ + The financial address associated with this mandate. + """ + network: Union[Literal["bacs"], str] + """ + The bank transfer network for this mandate. + """ + reference: Optional[str] + """ + The bank transfer reference provided by the bank. Only present when `network` is `bacs`. + """ + + class StatusDetails(StripeObject): + class Canceled(StripeObject): + reason: Union[ + Literal[ + "canceled_by_beneficiary", + "canceled_by_stripe", + "user_action", + ], + str, + ] + """ + The `canceled` status reason. + """ + + canceled: Optional[Canceled] + """ + If the mandate is canceled, this field provides more details on the cancellation reason. + """ + _inner_class_types = {"canceled": Canceled} + + class StatusTransitions(StripeObject): + activated_at: Optional[str] + """ + Timestamp describing when the SpendingMandate changed status to `active`. + Represented as a RFC 3339 date & time UTC value in millisecond precision. + """ + canceled_at: Optional[str] + """ + Timestamp describing when the SpendingMandate changed status to `canceled`. + Represented as a RFC 3339 date & time UTC value in millisecond precision. + """ + created_at: Optional[str] + """ + Timestamp describing when the SpendingMandate was created. + Represented as a RFC 3339 date & time UTC value in millisecond precision. + """ + expired_at: Optional[str] + """ + Timestamp describing when the SpendingMandate changed status to `expired`. + Represented as a RFC 3339 date & time UTC value in millisecond precision. + """ + pending_cancellation_at: Optional[str] + """ + Timestamp describing when the SpendingMandate changed status to `pending_cancellation`. + Represented as a RFC 3339 date & time UTC value in millisecond precision. + """ + + bank_transfer: Optional[BankTransfer] + """ + Bank transfer details. Present if `type` is `bank_transfer`. + """ + created: str + """ + The time at which the SpendingMandate was created. + Represented as a RFC 3339 date & time UTC value in millisecond precision. + """ + currency: str + """ + The currency in ISO 4217 format that debits will be collected in. + """ + financial_account: str + """ + Financial account ID associated with this mandate. + """ + id: str + """ + The unique identifier for the SpendingMandate. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + object: Literal["v2.money_management.spending_mandate"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + status: Union[ + Literal["active", "canceled", "expired", "pending_cancellation"], str + ] + """ + The status of the SpendingMandate. + """ + status_details: Optional[StatusDetails] + """ + Detailed information about the status of the SpendingMandate. + """ + status_transitions: Optional[StatusTransitions] + """ + Timestamps describing when the mandate changed status. + """ + type: Union[Literal["bank_transfer"], str] + """ + The type of the SpendingMandate. + """ + _inner_class_types = { + "bank_transfer": BankTransfer, + "status_details": StatusDetails, + "status_transitions": StatusTransitions, + } diff --git a/stripe/v2/money_management/_spending_mandate_service.py b/stripe/v2/money_management/_spending_mandate_service.py new file mode 100644 index 000000000..9724296dd --- /dev/null +++ b/stripe/v2/money_management/_spending_mandate_service.py @@ -0,0 +1,152 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_service import StripeService +from stripe._util import sanitize_id +from typing import Optional, cast +from typing_extensions import TYPE_CHECKING + +if TYPE_CHECKING: + from stripe._request_options import RequestOptions + from stripe.params.v2.money_management._spending_mandate_cancel_params import ( + SpendingMandateCancelParams, + ) + from stripe.params.v2.money_management._spending_mandate_list_params import ( + SpendingMandateListParams, + ) + from stripe.params.v2.money_management._spending_mandate_retrieve_params import ( + SpendingMandateRetrieveParams, + ) + from stripe.v2._list_object import ListObject + from stripe.v2.money_management._spending_mandate import SpendingMandate + + +class SpendingMandateService(StripeService): + def list( + self, + params: Optional["SpendingMandateListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[SpendingMandate]": + """ + Returns a list of SpendingMandates. + """ + return cast( + "ListObject[SpendingMandate]", + self._request( + "get", + "/v2/money_management/spending_mandates", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + params: Optional["SpendingMandateListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[SpendingMandate]": + """ + Returns a list of SpendingMandates. + """ + return cast( + "ListObject[SpendingMandate]", + await self._request_async( + "get", + "/v2/money_management/spending_mandates", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + id: str, + /, + params: Optional["SpendingMandateRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "SpendingMandate": + """ + Retrieves the details of an existing SpendingMandate. + """ + return cast( + "SpendingMandate", + self._request( + "get", + "/v2/money_management/spending_mandates/{id}".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + id: str, + /, + params: Optional["SpendingMandateRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "SpendingMandate": + """ + Retrieves the details of an existing SpendingMandate. + """ + return cast( + "SpendingMandate", + await self._request_async( + "get", + "/v2/money_management/spending_mandates/{id}".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def cancel( + self, + id: str, + /, + params: Optional["SpendingMandateCancelParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "SpendingMandate": + """ + Cancels an active SpendingMandate. + """ + return cast( + "SpendingMandate", + self._request( + "post", + "/v2/money_management/spending_mandates/{id}/cancel".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def cancel_async( + self, + id: str, + /, + params: Optional["SpendingMandateCancelParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "SpendingMandate": + """ + Cancels an active SpendingMandate. + """ + return cast( + "SpendingMandate", + await self._request_async( + "post", + "/v2/money_management/spending_mandates/{id}/cancel".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/tests/test_api_requestor.py b/tests/test_api_requestor.py index dadb1232e..2b94d7c98 100644 --- a/tests/test_api_requestor.py +++ b/tests/test_api_requestor.py @@ -669,6 +669,37 @@ def test_uses_instance_context(self, http_client_mock): stripe_context=context, ) + def test_with_stripe_context_clears_stripe_account( + self, requestor, http_client_mock: HTTPClientMock + ): + """ + with_stripe_context is used to scope a requestor to a v2 Event's own + context (see Event's construction in _util._convert_to_stripe_object). + Unlike _new_requestor_with_options, it must always clear stripe_account, + even though one was already set, so a stale account from whatever + request produced the original requestor can't leak into requests made + with the new one. + """ + requestor = requestor._new_requestor_with_options( + RequestOptions(stripe_account="acct_original") + ) + + requestor = requestor.with_stripe_context("acct_context") + + http_client_mock.stub_request( + "get", path=self.v1_path, rbody="{}", rcode=200 + ) + + requestor.request("get", self.v1_path, {}, base_address="api") + + http_client_mock.assert_requested( + "get", + stripe_context="acct_context", + ) + call = http_client_mock.get_last_call() + assert call.headers is not None + assert "Stripe-Account" not in call.headers + def test_sets_default_http_client(self, mocker): assert not stripe.default_http_client diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 15469daaf..d9aa146a5 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -49262,6 +49262,12 @@ def test_v2_money_management_outbound_payment_post_service( }, "preferred_networks": ["fedwire"], }, + "check_send": { + "attachment_file": "attachment_file", + "memo": "memo", + "shipping_speed": "priority", + "signature": "signature", + }, }, "recipient": "recipient", }, @@ -49272,7 +49278,7 @@ def test_v2_money_management_outbound_payment_post_service( path="/v2/money_management/outbound_payments", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","payout_method_options":{"bank_account":{"preferred_network_options":{"ach":{"addenda":"addenda","submission":"next_day","transaction_purpose":"payroll"}},"preferred_networks":["fedwire"]}},"recipient":"recipient"}}', + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","payout_method_options":{"bank_account":{"preferred_network_options":{"ach":{"addenda":"addenda","submission":"next_day","transaction_purpose":"payroll"}},"preferred_networks":["fedwire"]},"check_send":{"attachment_file":"attachment_file","memo":"memo","shipping_speed":"priority","signature":"signature"}},"recipient":"recipient"}}', is_json=True, ) @@ -49648,6 +49654,12 @@ def test_v2_money_management_payout_intent_post_service( }, "preferred_networks": ["fedwire"], }, + "check_send": { + "attachment_file": "attachment_file", + "memo": "memo", + "shipping_speed": "priority", + "signature": "signature", + }, }, "recipient": "recipient", }, @@ -49658,7 +49670,7 @@ def test_v2_money_management_payout_intent_post_service( path="/v2/money_management/payout_intents", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","payout_method_options":{"bank_account":{"preferred_network_options":{"ach":{"addenda":"addenda","submission":"next_day","transaction_purpose":"payroll"}},"preferred_networks":["fedwire"]}},"recipient":"recipient"}}', + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","payout_method_options":{"bank_account":{"preferred_network_options":{"ach":{"addenda":"addenda","submission":"next_day","transaction_purpose":"payroll"}},"preferred_networks":["fedwire"]},"check_send":{"attachment_file":"attachment_file","memo":"memo","shipping_speed":"priority","signature":"signature"}},"recipient":"recipient"}}', is_json=True, ) @@ -50533,6 +50545,68 @@ def test_v2_money_management_reward_program_enrollment_post_3_service( is_json=True, ) + def test_v2_money_management_spending_mandate_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/money_management/spending_mandates", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.money_management.spending_mandates.list() + http_client_mock.assert_requested( + "get", + path="/v2/money_management/spending_mandates", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_money_management_spending_mandate_get_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/money_management/spending_mandates/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.money_management.spending_mandates.retrieve("id_123") + http_client_mock.assert_requested( + "get", + path="/v2/money_management/spending_mandates/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_money_management_spending_mandate_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/spending_mandates/id_123/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.money_management.spending_mandates.cancel("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/money_management/spending_mandates/id_123/cancel", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + def test_v2_money_management_test_helper_post_service( self, http_client_mock: HTTPClientMock ) -> None: diff --git a/tests/test_http_client.py b/tests/test_http_client.py index 8b3ab71fb..0c6eaa557 100644 --- a/tests/test_http_client.py +++ b/tests/test_http_client.py @@ -1149,6 +1149,23 @@ def _check_call( return _check_call + def test_request_rejects_header_injection( + self, mocked_request_lib, make_request: MakeReqFunc, mock_response + ): + mock_response(mocked_request_lib, '{"foo": "baz"}', 200) + + hostile_headers = [ + {"Stripe-Context": "acct_123\r\nX-Injected: 1"}, + {"Stripe-Request-Trigger": "event=evt_1\nX-Injected: 1"}, + {"Authorization": "Bearer sk_test_123\r\n"}, + {"Authorization": "Bearer sk_test_123\0"}, + {"X-Injected\r\nEvil": "value"}, + ] + + for headers in hostile_headers: + with pytest.raises(ValueError): + make_request("get", self.valid_url, headers, None) + class TestPycurlClientHttpProxy(TestPycurlClient): PROXY = "http://user:withPwd@slap:8888/" diff --git a/tests/test_v2_event.py b/tests/test_v2_event.py index 4fc0dc682..8c6359acc 100644 --- a/tests/test_v2_event.py +++ b/tests/test_v2_event.py @@ -17,6 +17,7 @@ V1BillingMeterErrorReportTriggeredEvent, ) from stripe.events._v1_product_updated_event import ( + V1ProductUpdatedEvent, V1ProductUpdatedEventNotification, ) from stripe.v2.core._event import ( @@ -517,3 +518,62 @@ async def test_related_object_retains_event_context_async( http_client_mock.assert_requested( "delete", path=path, stripe_context="acct_child" ) + + def test_direct_retrieve_related_object_retains_event_context( + self, http_client_mock: HTTPClientMock + ): + """ + Unlike EventNotification (built from a webhook), a directly-retrieved + Event doesn't go through StripeClient.with_stripe_context in its own + construction, so historically it kept whatever stripe_account retrieved + it. Make sure fetch_related_object() only ever uses the event's own + context, with no stale account from the retrieving client leaking in. + """ + event_path = "/v2/core/events/evt_123" + related_path = "/v1/products/prod_shared" + + http_client_mock.stub_request( + "get", + path=event_path, + rbody=json.dumps( + { + "id": "evt_123", + "object": "v2.core.event", + "type": "v1.product.updated", + "created": "2022-02-15T00:27:45.330Z", + "livemode": False, + "context": "acct_child", + "related_object": { + "id": "prod_shared", + "type": "product", + "url": related_path, + }, + } + ), + ) + http_client_mock.stub_request( + "get", + path=related_path, + rbody=json.dumps({"id": "prod_shared", "object": "product"}), + ) + + client = StripeClient( + api_key="sk_test_1234", + stripe_account="acct_platform", + http_client=http_client_mock.get_mock_http_client(), + ) + + event = client.v2.core.events.retrieve("evt_123") + assert isinstance(event, V1ProductUpdatedEvent) + + product = event.fetch_related_object() + assert product.id == "prod_shared" + + http_client_mock.assert_requested( + "get", path=related_path, stripe_context="acct_child" + ) + + assert len(http_client_mock.get_all_calls()) == 2 + related_call = http_client_mock.get_last_call() + assert related_call.headers is not None + assert "Stripe-Account" not in related_call.headers diff --git a/tests/test_webhook.py b/tests/test_webhook.py index 2a884ef0a..7248ef01e 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -1,4 +1,5 @@ import time +from hashlib import sha256 import pytest @@ -35,12 +36,19 @@ def generate_header( - payload=DUMMY_WEBHOOK_PAYLOAD, secret=DUMMY_WEBHOOK_SECRET, timestamp=None + payload=DUMMY_WEBHOOK_PAYLOAD, + secret=DUMMY_WEBHOOK_SECRET, + timestamp=None, + debug_metadata=None, ): """Thin wrapper around WebhookSignature.generate_signature_header for tests.""" - return WebhookSignature.generate_signature_header( + header = WebhookSignature.generate_signature_header( payload, secret, timestamp ) + for key, value in (debug_metadata or {}).items(): + if value is not None: + header += f",{key}={value}" + return header def _build_header_with_scheme( @@ -214,6 +222,166 @@ def test_raise_on_no_valid_signatures_for_payload(self): DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) + def test_diagnose_secret_mismatch(self): + dashboard_url_base = "https://dashboard.stripe.com/webhooks" + cases = [ + # Secret and masket secret don't match; show URL with endpoint + { + "masked_secret": "whsec_******************1q84", + "destination": "we_example", + "url": dashboard_url_base + "/we_example", + }, + # Missing and blank destinations use the bare Dashboard URL + { + "masked_secret": "whsec_******************1q84", + "destination": "", + "url": dashboard_url_base, + }, + # Length mismatch + {"masked_secret": "whsec_******************cret"}, + # An attacker-selected mask must not expose more than the last four characters + {"masked_secret": "whsec_*bcdefghijklmnopqrstuvwxyZ"}, + ] + for case in cases: + secret = case.get("secret", DUMMY_WEBHOOK_SECRET) + secret_suffix = case.get("secret_suffix", secret[-4:]) + masked_secret = case.get("masked_secret", "whsec_*******cret") + url = case.get("url", dashboard_url_base) + header = generate_header( + secret="whsec_other_secret", + debug_metadata={ + "secret": masked_secret, + "destination": case.get("destination"), + "payload": "00000000", + }, + ) + with pytest.raises(SignatureVerificationError) as error: + WebhookSignature.verify_header( + DUMMY_WEBHOOK_PAYLOAD, header, secret + ) + assert str(error.value) == ( + "Webhook signature verification failed. This request may not have originated from Stripe.\n\n" + f"The signing secret you provided is {len(secret)} characters long and ends in `{secret_suffix}`. " + f"However, the signing secret for this destination is {len(masked_secret)} characters long " + f"and looks like `{masked_secret}`. Ensure you're using the signing secret for this " + f"destination, as shown on the Dashboard: {url}\n\n" + "Learn more: https://docs.stripe.com/webhooks/signature" + ) + + def test_diagnose_payload_mismatch(self): + # User supplies the original body with an extra trailing space. + payload = DUMMY_WEBHOOK_PAYLOAD + " " + expected_hash = sha256( + DUMMY_WEBHOOK_PAYLOAD.encode("utf-8") + ).hexdigest()[-8:] + actual_hash = sha256(payload.encode("utf-8")).hexdigest()[-8:] + header = generate_header( + debug_metadata={ + "secret": "whsec_*******cret", + "payload": expected_hash.upper(), + } + ) + with pytest.raises(SignatureVerificationError) as error: + WebhookSignature.verify_header( + payload, header, DUMMY_WEBHOOK_SECRET + ) + assert str(error.value) == ( + "Webhook signature verification failed.\n\n" + "The request body you passed to this function differs from the request body sent by Stripe to this webhook destination.\n" + f"The SHA-256 hash of the body should end in `{expected_hash}`. However, the SHA-256 hash of the body you provided ends in `{actual_hash}`.\n\n" + "Make sure your code does not reformat or otherwise alter the raw HTTP request body before passing it to this function.\n\n" + "Learn more: https://docs.stripe.com/webhooks/signature" + ) + + def test_matching_metadata_falls_back_to_generic_error(self): + for masked_secret, secret in [ + ("whsec_*******cret", DUMMY_WEBHOOK_SECRET), + # Prefixes and mask widths do not change the fixed four-character comparison. + ("other_*******cret", DUMMY_WEBHOOK_SECRET), + ( + "whsec_*bcdefghijklmnopqrstuvwxyz", + "whsec_abcdefghijklmnopqrstuvwxyz", + ), + ("*", "*"), + ]: + header = generate_header( + secret="whsec_other_secret", + debug_metadata={"secret": masked_secret}, + ) + with pytest.raises(SignatureVerificationError) as error: + WebhookSignature.verify_header( + DUMMY_WEBHOOK_PAYLOAD, header, secret + ) + assert ( + str(error.value) + == "No signatures found matching the expected signature for payload" + ) + + def test_invalid_secret_metadata_falls_back_to_generic_error(self): + payload_hash = sha256( + DUMMY_WEBHOOK_PAYLOAD.encode("utf-8") + ).hexdigest()[-8:] + for masked_secret in [ + "unmasked", + "*" * 101, + "*\ud800", + # A blank first secret must not be replaced by a later value. + ",secret=whsec_*******abcd", + ]: + header = generate_header( + secret="whsec_other_secret", + debug_metadata={ + "secret": masked_secret, + "payload": payload_hash, + }, + ) + with pytest.raises(SignatureVerificationError) as error: + WebhookSignature.verify_header( + DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET + ) + assert ( + str(error.value) + == "No signatures found matching the expected signature for payload" + ) + + def test_invalid_payload_metadata_falls_back_to_generic_error(self): + for payload_hash in [ + "1234567", + "123456789", + "not-hex!", + "a" * 101, + "1234567\ud800", + # A blank first hash must not be replaced by a later value. + ",payload=00000000", + ]: + header = generate_header( + secret="whsec_other_secret", + debug_metadata={ + "secret": "whsec_*******cret", + "payload": payload_hash, + }, + ) + with pytest.raises(SignatureVerificationError) as error: + WebhookSignature.verify_header( + DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET + ) + assert ( + str(error.value) + == "No signatures found matching the expected signature for payload" + ) + + def test_valid_signature_ignores_conflicting_metadata(self): + header = generate_header( + debug_metadata={ + "secret": "*abcd", + "destination": "clidev_example", + "payload": "00000000", + } + ) + assert WebhookSignature.verify_header( + DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET + ) + def test_raise_on_timestamp_outside_tolerance(self): header = generate_header(timestamp=int(time.time()) - 15) with pytest.raises(