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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .hark/changes/2026-11-09_stripe-openapi_67eb12fb.change.md
Original file line number Diff line number Diff line change
@@ -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`
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
df2bff12c487cb1d6af4f5bd7debe8dea8b01e47
5b1e713ce463b45ef5e0d44fe81667a61fd28115
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2598
v2600
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
19 changes: 19 additions & 0 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stripe/_balance_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
36 changes: 30 additions & 6 deletions stripe/_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
"""
Expand Down Expand Up @@ -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]
"""
Expand Down Expand Up @@ -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"],
Expand All @@ -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`.
Expand All @@ -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[
Expand Down Expand Up @@ -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]
"""
Expand Down
30 changes: 28 additions & 2 deletions stripe/_confirmation_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
"""
Expand Down Expand Up @@ -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[
Expand Down Expand Up @@ -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`.
Expand All @@ -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[
Expand Down
80 changes: 80 additions & 0 deletions stripe/_event_notification_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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]",
Expand Down
Loading
Loading