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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion API_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
56689dcbcaa4c7ce6bf1b51a5add451972e0689c
7684500f9744e3dbcd9b4b87db96f2e919c105aa
74 changes: 40 additions & 34 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Changelog

## 13.2.0b1 - 2025-10-29

This release changes the pinned API version to `2025-10-29.preview`.

* [#1655](https://github.com/stripe/stripe-python/pull/1655) Update generated code for beta
* Add support for `crypto_storer` on `v2.core.AccountModifyParamsIdentityAttestationTermsOfService`
* [#1624](https://github.com/stripe/stripe-python/pull/1624) Update generated code for beta
* Add support for `modify` method on resource `v2.money_management.FinancialAccount`
* Add support for `confirm_microdeposits`, `list`, and `send_microdeposits` methods on resource `v2.core.vault.UsBankAccount`
* Add support for `list` method on resource `v2.core.vault.GbBankAccount`
* Add support for new value `verification_data_not_found` on enums `Account.FutureRequirement.Error.code`, `Account.Requirement.Error.code`, `BankAccount.FutureRequirement.Error.code`, `BankAccount.Requirement.Error.code`, `Capability.FutureRequirement.Error.code`, `Capability.Requirement.Error.code`, `Person.FutureRequirement.Error.code`, and `Person.Requirement.Error.code`
* Add support for `payment_portal_url` on `Charge.PaymentMethodDetail.Rechnung`, `PaymentAttemptRecord.PaymentMethodDetail.Rechnung`, and `PaymentRecord.PaymentMethodDetail.Rechnung`
* Add support for `tax_id_element` on `CustomerSession.Component` and `CustomerSessionCreateParamsComponent`
* Add support for `starting_after` on `PaymentAttemptRecordListParams`
* Add support for new value `solana` on enums `PaymentAttemptRecord.PaymentMethodDetail.Crypto.network` and `PaymentRecord.PaymentMethodDetail.Crypto.network`
* Add support for `reference` on `PaymentIntentAmountDetailsLineItem.PaymentMethodOption.Klarna`, `PaymentIntentCaptureParamsAmountDetailLineItemPaymentMethodOptionKlarna`, `PaymentIntentConfirmParamsAmountDetailLineItemPaymentMethodOptionKlarna`, `PaymentIntentCreateParamsAmountDetailLineItemPaymentMethodOptionKlarna`, `PaymentIntentIncrementAuthorizationParamsAmountDetailLineItemPaymentMethodOptionKlarna`, and `PaymentIntentModifyParamsAmountDetailLineItemPaymentMethodOptionKlarna`
* Change `PaymentIntent.PaymentDetail.customer_reference` to be required
* Change `PaymentIntent.PaymentDetail.order_reference` to be required
* Add support for `subscription_reference` on `PaymentIntentAmountDetailsLineItem.PaymentMethodOption.Klarna`
* Add support for `closed` on `V2.Core.Account` and `v2.core.AccountListParams`
* Add support for new value `payment_method` on enums `V2.Core.Account.Configuration.Customer.AutomaticIndirectTax.location_source`, `v2.core.AccountCreateParamsConfigurationCustomerAutomaticIndirectTax.location_source`, and `v2.core.AccountModifyParamsConfigurationCustomerAutomaticIndirectTax.location_source`
* Add support for `usd` on `V2.Core.Account.Configuration.Storer.Capability.HoldsCurrency`, `v2.core.AccountCreateParamsConfigurationStorerCapabilityHoldsCurrency`, and `v2.core.AccountModifyParamsConfigurationStorerCapabilityHoldsCurrency`
* Add support for new values `application_custom` and `application_express` on enums `V2.Core.Account.Default.Responsibility.fees_collector`, `v2.core.AccountCreateParamsDefaultResponsibility.fees_collector`, and `v2.core.AccountModifyParamsDefaultResponsibility.fees_collector`
* Add support for `representative_declaration` on `V2.Core.Account.Identity.Attestation`, `v2.core.AccountCreateParamsIdentityAttestation`, and `v2.core.AccountModifyParamsIdentityAttestation`
* Add support for new value `holds_currencies.usd` on enum `V2.Core.Account.Requirement.Entry.Impact.RestrictsCapability.capability`
* Add support for `verification` on `V2.Core.Vault.UsBankAccount`
* Add support for `v1_id` on `EventsV2MoneyManagementTransactionCreatedEvent`
* Remove support for thin event `V2BillingBillSettingUpdatedEvent` with related object `v2.billing.BillSetting`
* Add support for error code `payment_intent_rate_limit_exceeded` on `QuotePreviewInvoice.LastFinalizationError`
* Add support for error codes `blocked_payout_method_crypto_wallet` and `unsupported_payout_method_crypto_wallet` on `BlockedByStripeError`
* Add support for error code `outbound_flow_from_closed_financial_account_unsupported` on `FeatureNotEnabledError`
* Add support for error code `limit_payout_method_crypto_wallet` on `QuotaExceededError`
* [#1617](https://github.com/stripe/stripe-python/pull/1617) Update generated code for beta
* Add support for `last_seen_at` on `Terminal.Reader`
* Add support for new value `2025-10-29.clover` on enum `WebhookEndpointCreateParams.api_version`

## 13.2.0a2 - 2025-10-30
* [#1659](https://github.com/stripe/stripe-python/pull/1659) Update generated code for private-preview
* Change `delegated_checkout.RequestedSessionModifyParamsLineItemDetail.quantity` to be required
Expand Down Expand Up @@ -63,42 +99,12 @@
* Add support for `external_amount` on `V2.MoneyManagement.ReceivedCredit` and `V2.MoneyManagement.ReceivedDebit`
* Add support for error code `payment_intent_rate_limit_exceeded` on `Invoice.LastFinalizationError`, `PaymentIntent.LastPaymentError`, `QuotePreviewInvoice.LastFinalizationError`, `SetupAttempt.SetupError`, `SetupIntent.LastSetupError`, and `StripeError`

## 13.2.0b1 - 2025-10-29
## 13.1.2 - 2025-11-04
* [#1661](https://github.com/stripe/stripe-python/pull/1661) Add support for value `payment_record` to enum `InvoicePayment.payment.type`

This release changes the pinned API version to `2025-10-29.preview`.
## 13.1.1 - 2025-10-31
* [#1660](https://github.com/stripe/stripe-python/pull/1660) Fix `stripe-context` header not being included in paged list requests

* [#1655](https://github.com/stripe/stripe-python/pull/1655) Update generated code for beta
* Add support for `crypto_storer` on `v2.core.AccountModifyParamsIdentityAttestationTermsOfService`
* [#1624](https://github.com/stripe/stripe-python/pull/1624) Update generated code for beta
* Add support for `modify` method on resource `v2.money_management.FinancialAccount`
* Add support for `confirm_microdeposits`, `list`, and `send_microdeposits` methods on resource `v2.core.vault.UsBankAccount`
* Add support for `list` method on resource `v2.core.vault.GbBankAccount`
* Add support for new value `verification_data_not_found` on enums `Account.FutureRequirement.Error.code`, `Account.Requirement.Error.code`, `BankAccount.FutureRequirement.Error.code`, `BankAccount.Requirement.Error.code`, `Capability.FutureRequirement.Error.code`, `Capability.Requirement.Error.code`, `Person.FutureRequirement.Error.code`, and `Person.Requirement.Error.code`
* Add support for `payment_portal_url` on `Charge.PaymentMethodDetail.Rechnung`, `PaymentAttemptRecord.PaymentMethodDetail.Rechnung`, and `PaymentRecord.PaymentMethodDetail.Rechnung`
* Add support for `tax_id_element` on `CustomerSession.Component` and `CustomerSessionCreateParamsComponent`
* Add support for `starting_after` on `PaymentAttemptRecordListParams`
* Add support for new value `solana` on enums `PaymentAttemptRecord.PaymentMethodDetail.Crypto.network` and `PaymentRecord.PaymentMethodDetail.Crypto.network`
* Add support for `reference` on `PaymentIntentAmountDetailsLineItem.PaymentMethodOption.Klarna`, `PaymentIntentCaptureParamsAmountDetailLineItemPaymentMethodOptionKlarna`, `PaymentIntentConfirmParamsAmountDetailLineItemPaymentMethodOptionKlarna`, `PaymentIntentCreateParamsAmountDetailLineItemPaymentMethodOptionKlarna`, `PaymentIntentIncrementAuthorizationParamsAmountDetailLineItemPaymentMethodOptionKlarna`, and `PaymentIntentModifyParamsAmountDetailLineItemPaymentMethodOptionKlarna`
* Change `PaymentIntent.PaymentDetail.customer_reference` to be required
* Change `PaymentIntent.PaymentDetail.order_reference` to be required
* Add support for `subscription_reference` on `PaymentIntentAmountDetailsLineItem.PaymentMethodOption.Klarna`
* Add support for `closed` on `V2.Core.Account` and `v2.core.AccountListParams`
* Add support for new value `payment_method` on enums `V2.Core.Account.Configuration.Customer.AutomaticIndirectTax.location_source`, `v2.core.AccountCreateParamsConfigurationCustomerAutomaticIndirectTax.location_source`, and `v2.core.AccountModifyParamsConfigurationCustomerAutomaticIndirectTax.location_source`
* Add support for `usd` on `V2.Core.Account.Configuration.Storer.Capability.HoldsCurrency`, `v2.core.AccountCreateParamsConfigurationStorerCapabilityHoldsCurrency`, and `v2.core.AccountModifyParamsConfigurationStorerCapabilityHoldsCurrency`
* Add support for new values `application_custom` and `application_express` on enums `V2.Core.Account.Default.Responsibility.fees_collector`, `v2.core.AccountCreateParamsDefaultResponsibility.fees_collector`, and `v2.core.AccountModifyParamsDefaultResponsibility.fees_collector`
* Add support for `representative_declaration` on `V2.Core.Account.Identity.Attestation`, `v2.core.AccountCreateParamsIdentityAttestation`, and `v2.core.AccountModifyParamsIdentityAttestation`
* Add support for new value `holds_currencies.usd` on enum `V2.Core.Account.Requirement.Entry.Impact.RestrictsCapability.capability`
* Add support for `verification` on `V2.Core.Vault.UsBankAccount`
* Add support for `v1_id` on `EventsV2MoneyManagementTransactionCreatedEvent`
* Remove support for thin event `V2BillingBillSettingUpdatedEvent` with related object `v2.billing.BillSetting`
* Add support for error code `payment_intent_rate_limit_exceeded` on `QuotePreviewInvoice.LastFinalizationError`
* Add support for error codes `blocked_payout_method_crypto_wallet` and `unsupported_payout_method_crypto_wallet` on `BlockedByStripeError`
* Add support for error code `outbound_flow_from_closed_financial_account_unsupported` on `FeatureNotEnabledError`
* Add support for error code `limit_payout_method_crypto_wallet` on `QuotaExceededError`
* [#1617](https://github.com/stripe/stripe-python/pull/1617) Update generated code for beta
* Add support for `last_seen_at` on `Terminal.Reader`
* Add support for new value `2025-10-29.clover` on enum `WebhookEndpointCreateParams.api_version`

## 13.1.0 - 2025-10-29

This release changes the pinned API version to `2025-10-29.clover`.
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2106
v2110
2 changes: 2 additions & 0 deletions stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ def add_beta_version(
TransferReversalService as TransferReversalService,
)
from stripe._transfer_service import TransferService as TransferService
from stripe._transit_balance import TransitBalance as TransitBalance
from stripe._treasury_service import TreasuryService as TreasuryService
from stripe._updateable_api_resource import (
UpdateableAPIResource as UpdateableAPIResource,
Expand Down Expand Up @@ -985,6 +986,7 @@ def add_beta_version(
"Transfer": ("stripe._transfer", False),
"TransferReversalService": ("stripe._transfer_reversal_service", False),
"TransferService": ("stripe._transfer_service", False),
"TransitBalance": ("stripe._transit_balance", False),
"TreasuryService": ("stripe._treasury_service", False),
"UpdateableAPIResource": ("stripe._updateable_api_resource", False),
"convert_to_stripe_object": ("stripe._util", False),
Expand Down
21 changes: 15 additions & 6 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
StripeStreamResponse,
StripeStreamResponseAsync,
)
from stripe._request_options import RequestOptions, merge_options
from stripe._request_options import (
PERSISTENT_OPTIONS_KEYS,
RequestOptions,
merge_options,
)
from stripe._requestor_options import (
RequestorOptions,
_GlobalRequestorOptions,
Expand Down Expand Up @@ -124,12 +128,15 @@ def _get_http_client(self) -> HTTPClient:
return stripe.default_http_client
return client

def _replace_options(
def _new_requestor_with_options(
self, options: Optional[RequestOptions]
) -> "_APIRequestor":
"""
Returns a new _APIRequestor instance with the same HTTP client but a (potentially) updated set of options. Useful for ensuring the original isn't modified, but any options the original had are still used.
"""
options = options or {}
new_options = self._options.to_dict()
for key in ["api_key", "stripe_account", "stripe_version"]:
for key in PERSISTENT_OPTIONS_KEYS:
if key in options and options[key] is not None:
new_options[key] = options[key]
return _APIRequestor(
Expand Down Expand Up @@ -168,7 +175,9 @@ def _global_instance(cls):
def _global_with_options(
**params: Unpack[RequestOptions],
) -> "_APIRequestor":
return _APIRequestor._global_instance()._replace_options(params)
return _APIRequestor._global_instance()._new_requestor_with_options(
params
)

@classmethod
def _format_app_info(cls, info):
Expand All @@ -190,7 +199,7 @@ def request(
usage: Optional[List[str]] = None,
) -> "StripeObject":
api_mode = get_api_mode(url)
requestor = self._replace_options(options)
requestor = self._new_requestor_with_options(options)
rbody, rcode, rheaders = requestor.request_raw(
method.lower(),
url,
Expand Down Expand Up @@ -224,7 +233,7 @@ async def request_async(
usage: Optional[List[str]] = None,
) -> "StripeObject":
api_mode = get_api_mode(url)
requestor = self._replace_options(options)
requestor = self._new_requestor_with_options(options)
rbody, rcode, rheaders = await requestor.request_raw_async(
method.lower(),
url,
Expand Down
5 changes: 5 additions & 0 deletions stripe/_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from stripe._review import Review
from stripe._source import Source
from stripe._transfer import Transfer
from stripe._transit_balance import TransitBalance
from stripe.params._charge_capture_params import ChargeCaptureParams
from stripe.params._charge_create_params import ChargeCreateParams
from stripe.params._charge_list_params import ChargeListParams
Expand Down Expand Up @@ -2339,6 +2340,10 @@ class TransferData(StripeObject):
ID of an existing, connected Stripe account to transfer funds to if `transfer_data` was specified in the charge request.
"""

allocated_funds: Optional["TransitBalance"]
"""
Funds that are in transit and destined for another balance or another connected account.
"""
amount: int
"""
Amount intended to be collected by this payment. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
Expand Down
4 changes: 2 additions & 2 deletions stripe/_error_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def refresh_from(
values=values,
partial=partial,
last_response=last_response,
requestor=self._requestor._replace_options(
requestor=self._requestor._new_requestor_with_options(
{
"api_key": api_key,
"stripe_version": stripe_version,
Expand Down Expand Up @@ -102,7 +102,7 @@ def refresh_from(
values=values,
partial=partial,
last_response=last_response,
requestor=self._requestor._replace_options(
requestor=self._requestor._new_requestor_with_options(
{
"api_key": api_key,
"stripe_version": stripe_version,
Expand Down
2 changes: 1 addition & 1 deletion stripe/_invoice_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Payment(StripeObject):
"""
ID of the PaymentRecord associated with this payment when `type` is `payment_record`.
"""
type: Literal["charge", "payment_intent"]
type: Literal["charge", "payment_intent", "payment_record"]
"""
Type of payment object associated with this invoice payment.
"""
Expand Down
6 changes: 6 additions & 0 deletions stripe/_object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
"token": ("stripe._token", "Token"),
"topup": ("stripe._topup", "Topup"),
"transfer": ("stripe._transfer", "Transfer"),
"transit_balance": ("stripe._transit_balance", "TransitBalance"),
"treasury.credit_reversal": (
"stripe.treasury._credit_reversal",
"CreditReversal",
Expand Down Expand Up @@ -581,6 +582,11 @@
"stripe.v2.payments._off_session_payment",
"OffSessionPayment",
),
"v2.reporting.report": ("stripe.v2.reporting._report", "Report"),
"v2.reporting.report_run": (
"stripe.v2.reporting._report_run",
"ReportRun",
),
"v2.tax.automatic_rule": (
"stripe.v2.tax._automatic_rule",
"AutomaticRule",
Expand Down
12 changes: 12 additions & 0 deletions stripe/_request_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ def merge_options(
}


PERSISTENT_OPTIONS_KEYS = {
"api_key",
"stripe_version",
"stripe_account",
"stripe_context",
}
"""
These are the keys in RequestOptions that should persist across requests made
by the same requestor.
"""


def extract_options_from_dict(
d: Optional[Mapping[str, Any]],
) -> Tuple[RequestOptions, Dict[str, Any]]:
Expand Down
13 changes: 9 additions & 4 deletions stripe/_stripe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
StripeStreamResponseAsync,
)
from stripe._encode import _encode_datetime # pyright: ignore
from stripe._request_options import extract_options_from_dict
from stripe._request_options import (
PERSISTENT_OPTIONS_KEYS,
extract_options_from_dict,
)
from stripe._api_mode import ApiMode
from stripe._base_address import BaseAddress

Expand Down Expand Up @@ -152,8 +155,10 @@ def update( # pyright: ignore
if not TYPE_CHECKING:

def __setattr__(self, k, v):
if k in {"api_key", "stripe_account", "stripe_version"}:
self._requestor = self._requestor._replace_options({k: v})
if k in PERSISTENT_OPTIONS_KEYS:
self._requestor = self._requestor._new_requestor_with_options(
{k: v}
)
return None

if k[0] == "_" or k in self.__dict__:
Expand Down Expand Up @@ -303,7 +308,7 @@ def refresh_from(
values=values,
partial=partial,
last_response=last_response,
requestor=self._requestor._replace_options( # pyright: ignore[reportPrivateUsage]
requestor=self._requestor._new_requestor_with_options( # pyright: ignore[reportPrivateUsage]
{
"api_key": api_key,
"stripe_version": stripe_version,
Expand Down
3 changes: 3 additions & 0 deletions stripe/_test_helpers_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing_extensions import TYPE_CHECKING

if TYPE_CHECKING:
from stripe.test_helpers._capital_service import CapitalService
from stripe.test_helpers._confirmation_token_service import (
ConfirmationTokenService,
)
Expand All @@ -16,6 +17,7 @@
from stripe.test_helpers._treasury_service import TreasuryService

_subservices = {
"capital": ["stripe.test_helpers._capital_service", "CapitalService"],
"confirmation_tokens": [
"stripe.test_helpers._confirmation_token_service",
"ConfirmationTokenService",
Expand All @@ -33,6 +35,7 @@


class TestHelpersService(StripeService):
capital: "CapitalService"
confirmation_tokens: "ConfirmationTokenService"
customers: "CustomerService"
issuing: "IssuingService"
Expand Down
Loading