From d8dd636430d34651c08bb45e03ca9d43308bf955 Mon Sep 17 00:00:00 2001 From: David Brownman <109395161+xavdid-stripe@users.noreply.github.com> Date: Fri, 31 Oct 2025 13:04:06 -0700 Subject: [PATCH 1/7] Fix `stripe-context` not being included in subsequent list requests (#1660) * fix stripe-context getting dropped from subsequent requests * rename _replace_options and centralize keys --- stripe/_api_requestor.py | 21 +++-- stripe/_error_object.py | 4 +- stripe/_request_options.py | 12 +++ stripe/_stripe_object.py | 13 ++- tests/api_resources/test_list_object.py | 110 ++++++++++++++++++++++++ tests/test_api_requestor.py | 8 +- 6 files changed, 153 insertions(+), 15 deletions(-) diff --git a/stripe/_api_requestor.py b/stripe/_api_requestor.py index e70018261..4c4e44cb6 100644 --- a/stripe/_api_requestor.py +++ b/stripe/_api_requestor.py @@ -42,7 +42,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, @@ -121,12 +125,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( @@ -165,7 +172,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): @@ -187,7 +196,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, @@ -221,7 +230,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, diff --git a/stripe/_error_object.py b/stripe/_error_object.py index da2f38918..9221218be 100644 --- a/stripe/_error_object.py +++ b/stripe/_error_object.py @@ -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, @@ -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, diff --git a/stripe/_request_options.py b/stripe/_request_options.py index 05d8c45a3..b3c00c433 100644 --- a/stripe/_request_options.py +++ b/stripe/_request_options.py @@ -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]]: diff --git a/stripe/_stripe_object.py b/stripe/_stripe_object.py index bcf3c69ab..0f44342f4 100644 --- a/stripe/_stripe_object.py +++ b/stripe/_stripe_object.py @@ -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 @@ -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__: @@ -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, diff --git a/tests/api_resources/test_list_object.py b/tests/api_resources/test_list_object.py index 37ab96fe1..02568c4b7 100644 --- a/tests/api_resources/test_list_object.py +++ b/tests/api_resources/test_list_object.py @@ -5,6 +5,7 @@ import stripe from stripe._util import convert_to_stripe_object from stripe._stripe_object import StripeObject +from tests.http_client_mock import HTTPClientMock class TestListObject(object): @@ -522,6 +523,115 @@ def test_forwards_api_key_to_nested_resources(self, http_client_mock): # assert seen == ["prod_001", "prod_002"] + def test_iter_with_stripe_account(self, http_client_mock: HTTPClientMock): + http_client_mock.stub_request( + "get", + path="/v1/customers", + rbody='{"object": "list", "data": [{"id": "cus_001", "object": "customer"}], "url": "/v1/customers", "has_more": true}', + ) + http_client_mock.stub_request( + "get", + path="/v1/customers", + query_string="starting_after=cus_001", + rbody='{"object": "list", "data": [{"id": "cus_002", "object": "customer"}], "url": "/v1/customers", "has_more": false}', + ) + + cu_list = stripe.Customer.list( + api_key="org_key_abc", + stripe_account="ctx_123", + ) + + customers = [item.id for item in cu_list.auto_paging_iter()] + assert customers == ["cus_001", "cus_002"] + + http_client_mock.assert_requested( + "get", + path="/v1/customers", + api_key="org_key_abc", + stripe_account="ctx_123", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers", + query_string="starting_after=cus_001", + api_key="org_key_abc", + stripe_account="ctx_123", + ) + + def test_iter_with_stripe_context(self, http_client_mock: HTTPClientMock): + http_client_mock.stub_request( + "get", + path="/v1/customers", + rbody='{"object": "list", "data": [{"id": "cus_001", "object": "customer"}], "url": "/v1/customers", "has_more": true}', + ) + http_client_mock.stub_request( + "get", + path="/v1/customers", + query_string="starting_after=cus_001", + rbody='{"object": "list", "data": [{"id": "cus_002", "object": "customer"}], "url": "/v1/customers", "has_more": false}', + ) + + cu_list = stripe.Customer.list( + api_key="org_key_abc", + stripe_context="ctx_123", + ) + + customers = [item.id for item in cu_list.auto_paging_iter()] + assert customers == ["cus_001", "cus_002"] + + http_client_mock.assert_requested( + "get", + path="/v1/customers", + api_key="org_key_abc", + stripe_context="ctx_123", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers", + query_string="starting_after=cus_001", + api_key="org_key_abc", + stripe_context="ctx_123", + ) + + def test_iter_with_stripe_context_client( + self, http_client_mock: HTTPClientMock + ): + http_client_mock.stub_request( + "get", + path="/v1/customers", + rbody='{"object": "list", "data": [{"id": "cus_001", "object": "customer"}], "url": "/v1/customers", "has_more": true}', + ) + http_client_mock.stub_request( + "get", + path="/v1/customers", + query_string="starting_after=cus_001", + rbody='{"object": "list", "data": [{"id": "cus_002", "object": "customer"}], "url": "/v1/customers", "has_more": false}', + ) + + client = stripe.StripeClient( + "org_key_abc", http_client=http_client_mock.get_mock_http_client() + ) + cu_list = client.v1.customers.list( + options={"stripe_context": "ctx_123"} + ) + + customers = [item.id for item in cu_list.auto_paging_iter()] + assert customers == ["cus_001", "cus_002"] + + http_client_mock.assert_requested( + "get", + path="/v1/customers", + api_key="org_key_abc", + stripe_context="ctx_123", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers", + query_string="starting_after=cus_001", + api_key="org_key_abc", + stripe_context="ctx_123", + ) + class TestAutoPagingAsync: @staticmethod diff --git a/tests/test_api_requestor.py b/tests/test_api_requestor.py index 0262f75fb..3e5a80947 100644 --- a/tests/test_api_requestor.py +++ b/tests/test_api_requestor.py @@ -572,7 +572,9 @@ def test_prefers_headers_api_version(self, requestor, http_client_mock): def test_uses_instance_key(self, requestor, http_client_mock): key = "fookey" - requestor = requestor._replace_options(RequestOptions(api_key=key)) + requestor = requestor._new_requestor_with_options( + RequestOptions(api_key=key) + ) http_client_mock.stub_request( "get", path=self.v1_path, rbody="{}", rcode=200 @@ -585,7 +587,7 @@ def test_uses_instance_key(self, requestor, http_client_mock): def test_uses_instance_account(self, requestor, http_client_mock): account = "acct_foo" - requestor = requestor._replace_options( + requestor = requestor._new_requestor_with_options( RequestOptions(stripe_account=account) ) @@ -610,7 +612,7 @@ def test_removes_None_account( in the generated fetch_related_object doesn't actually send the null header """ account = None - requestor = requestor._replace_options( + requestor = requestor._new_requestor_with_options( RequestOptions(stripe_account=account) ) From 3e0df8b2019f577291a2e57da43ba61d20883358 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Fri, 31 Oct 2025 13:06:38 -0700 Subject: [PATCH 2/7] Bump version to 13.1.1 --- CHANGELOG.md | 3 +++ VERSION | 2 +- pyproject.toml | 2 +- stripe/_version.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7694b752..96dac03a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 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 + ## 13.1.0 - 2025-10-29 This release changes the pinned API version to `2025-10-29.clover`. diff --git a/VERSION b/VERSION index e6ba35136..21b80e995 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.1.0 +13.1.1 diff --git a/pyproject.toml b/pyproject.toml index 3c397cd67..e0ea92d0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "stripe" -version = "13.1.0" +version = "13.1.1" readme = "README.md" description = "Python bindings for the Stripe API" authors = [{ name = "Stripe", email = "support@stripe.com" }] diff --git a/stripe/_version.py b/stripe/_version.py index 06b380e3b..7e440d406 100644 --- a/stripe/_version.py +++ b/stripe/_version.py @@ -1 +1 @@ -VERSION = "13.1.0" +VERSION = "13.1.1" From d07f3de9b92dbbf84c681a0d5176c2d816ec9f9d Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 15:02:28 -0800 Subject: [PATCH 3/7] Update generated code for v2108 and (#1661) Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- API_VERSION | 2 +- OPENAPI_VERSION | 2 +- stripe/_invoice_payment.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/API_VERSION b/API_VERSION index 1105d4353..6ab1f382f 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -3ccf295957c8cadc88e1463ea3ab4ec683a0314f \ No newline at end of file +07c094f7c1f64823539941252667a6620cc6bb44 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index c8ed627ff..93363663d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2102 \ No newline at end of file +v2108 \ No newline at end of file diff --git a/stripe/_invoice_payment.py b/stripe/_invoice_payment.py index 203fec916..a66e08069 100644 --- a/stripe/_invoice_payment.py +++ b/stripe/_invoice_payment.py @@ -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. """ From 2b4c14a146f29591fc8aac899823e19513564db0 Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Tue, 4 Nov 2025 15:07:15 -0800 Subject: [PATCH 4/7] Bump version to 13.1.2 --- CHANGELOG.md | 3 +++ VERSION | 2 +- pyproject.toml | 2 +- stripe/_version.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96dac03a5..02213a97a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 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` + ## 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 diff --git a/VERSION b/VERSION index 21b80e995..383738180 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.1.1 +13.1.2 diff --git a/pyproject.toml b/pyproject.toml index e0ea92d0e..bee351afe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "stripe" -version = "13.1.1" +version = "13.1.2" readme = "README.md" description = "Python bindings for the Stripe API" authors = [{ name = "Stripe", email = "support@stripe.com" }] diff --git a/stripe/_version.py b/stripe/_version.py index 7e440d406..34ea198a5 100644 --- a/stripe/_version.py +++ b/stripe/_version.py @@ -1 +1 @@ -VERSION = "13.1.1" +VERSION = "13.1.2" From 6f57ab82685acdfb7b55b00674d6d789741bceff Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 14:50:57 -0800 Subject: [PATCH 5/7] Update generated code (#1662) * Update generated code for v2109 and * Update generated code for v2111 and * Update generated code for v2111 and --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- API_VERSION | 2 +- OPENAPI_VERSION | 2 +- stripe/_account.py | 2 +- stripe/_invoice.py | 2 +- stripe/_payment_intent.py | 4 ++++ stripe/params/_account_create_params.py | 2 +- stripe/params/_account_update_params.py | 2 +- .../params/_customer_session_create_params.py | 2 +- .../params/_payment_intent_confirm_params.py | 8 ++++++++ stripe/params/_payment_intent_create_params.py | 8 ++++++++ stripe/params/_payment_intent_modify_params.py | 8 ++++++++ stripe/params/_payment_intent_update_params.py | 8 ++++++++ .../terminal/_configuration_create_params.py | 18 +++++++++--------- .../terminal/_configuration_modify_params.py | 18 +++++++++--------- .../terminal/_configuration_update_params.py | 18 +++++++++--------- stripe/v2/billing/_meter_event.py | 3 ++- 16 files changed, 72 insertions(+), 35 deletions(-) diff --git a/API_VERSION b/API_VERSION index 6ab1f382f..dffa3a76a 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -07c094f7c1f64823539941252667a6620cc6bb44 \ No newline at end of file +6d15a7f20cb77c2c22091a30e499cb89d7e3248c \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 93363663d..dfd2783f1 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2108 \ No newline at end of file +v2111 \ No newline at end of file diff --git a/stripe/_account.py b/stripe/_account.py index c0ed4a960..64f50c8a1 100644 --- a/stripe/_account.py +++ b/stripe/_account.py @@ -1267,7 +1267,7 @@ class Invoices(StripeObject): Literal["always", "never", "offer"] ] """ - Whether payment methods should be saved when a payment is completed for a one-time invoices on a hosted invoice page. + Whether to save the payment method after a payment is completed for a one-time invoice or a subscription invoice when the customer already has a default payment method on the hosted invoice page. """ class Payments(StripeObject): diff --git a/stripe/_invoice.py b/stripe/_invoice.py index 3b290ee2a..8bb7ed6a5 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -1257,7 +1257,7 @@ class TaxRateDetails(StripeObject): * `subscription_cycle`: A subscription advanced into a new period. * `subscription_threshold`: A subscription reached a billing threshold. * `subscription_update`: A subscription was updated. - * `upcoming`: Reserved for simulated invoices, per the upcoming invoice endpoint. + * `upcoming`: Reserved for upcoming invoices created through the Create Preview Invoice API or when an `invoice.upcoming` event is generated for an upcoming invoice on a subscription. """ collection_method: Literal["charge_automatically", "send_invoice"] """ diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index 27b2502d3..1fcf76a04 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -1834,6 +1834,10 @@ class Routing(StripeObject): Requested routing priority """ + capture_method: Optional[Literal["manual", "manual_preferred"]] + """ + Controls when the funds will be captured from the customer's account. + """ request_extended_authorization: Optional[bool] """ Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity) diff --git a/stripe/params/_account_create_params.py b/stripe/params/_account_create_params.py index ccc90971e..f77ac9d77 100644 --- a/stripe/params/_account_create_params.py +++ b/stripe/params/_account_create_params.py @@ -1864,7 +1864,7 @@ class AccountCreateParamsSettingsInvoices(TypedDict): Literal["always", "never", "offer"] ] """ - Whether payment methods should be saved when a payment is completed for a one-time invoices on a hosted invoice page. + Whether to save the payment method after a payment is completed for a one-time invoice or a subscription invoice when the customer already has a default payment method on the hosted invoice page. """ diff --git a/stripe/params/_account_update_params.py b/stripe/params/_account_update_params.py index d7713720d..0b3275ff1 100644 --- a/stripe/params/_account_update_params.py +++ b/stripe/params/_account_update_params.py @@ -1810,7 +1810,7 @@ class AccountUpdateParamsSettingsInvoices(TypedDict): Literal["always", "never", "offer"] ] """ - Whether payment methods should be saved when a payment is completed for a one-time invoices on a hosted invoice page. + Whether to save the payment method after a payment is completed for a one-time invoice or a subscription invoice when the customer already has a default payment method on the hosted invoice page. """ diff --git a/stripe/params/_customer_session_create_params.py b/stripe/params/_customer_session_create_params.py index 959baa012..04316c59a 100644 --- a/stripe/params/_customer_session_create_params.py +++ b/stripe/params/_customer_session_create_params.py @@ -8,7 +8,7 @@ class CustomerSessionCreateParams(RequestOptions): components: "CustomerSessionCreateParamsComponents" """ - Configuration for each component. Exactly 1 component must be enabled. + Configuration for each component. At least 1 component must be enabled. """ customer: str """ diff --git a/stripe/params/_payment_intent_confirm_params.py b/stripe/params/_payment_intent_confirm_params.py index ba60c8bc9..b172c01ee 100644 --- a/stripe/params/_payment_intent_confirm_params.py +++ b/stripe/params/_payment_intent_confirm_params.py @@ -2029,6 +2029,14 @@ class PaymentIntentConfirmParamsPaymentMethodOptionsCardThreeDSecureNetworkOptio class PaymentIntentConfirmParamsPaymentMethodOptionsCardPresent(TypedDict): + capture_method: NotRequired[Literal["manual", "manual_preferred"]] + """ + Controls when the funds are captured from the customer's account. + + If provided, this parameter overrides the behavior of the top-level [capture_method](https://docs.stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + + If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + """ request_extended_authorization: NotRequired[bool] """ Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity) diff --git a/stripe/params/_payment_intent_create_params.py b/stripe/params/_payment_intent_create_params.py index 3867a4b5d..c54c2a398 100644 --- a/stripe/params/_payment_intent_create_params.py +++ b/stripe/params/_payment_intent_create_params.py @@ -2148,6 +2148,14 @@ class PaymentIntentCreateParamsPaymentMethodOptionsCardThreeDSecureNetworkOption class PaymentIntentCreateParamsPaymentMethodOptionsCardPresent(TypedDict): + capture_method: NotRequired[Literal["manual", "manual_preferred"]] + """ + Controls when the funds are captured from the customer's account. + + If provided, this parameter overrides the behavior of the top-level [capture_method](https://docs.stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + + If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + """ request_extended_authorization: NotRequired[bool] """ Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity) diff --git a/stripe/params/_payment_intent_modify_params.py b/stripe/params/_payment_intent_modify_params.py index 35f4c39cd..21b3581bd 100644 --- a/stripe/params/_payment_intent_modify_params.py +++ b/stripe/params/_payment_intent_modify_params.py @@ -1986,6 +1986,14 @@ class PaymentIntentModifyParamsPaymentMethodOptionsCardThreeDSecureNetworkOption class PaymentIntentModifyParamsPaymentMethodOptionsCardPresent(TypedDict): + capture_method: NotRequired[Literal["manual", "manual_preferred"]] + """ + Controls when the funds are captured from the customer's account. + + If provided, this parameter overrides the behavior of the top-level [capture_method](https://docs.stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + + If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + """ request_extended_authorization: NotRequired[bool] """ Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity) diff --git a/stripe/params/_payment_intent_update_params.py b/stripe/params/_payment_intent_update_params.py index df17c3e85..fcb152100 100644 --- a/stripe/params/_payment_intent_update_params.py +++ b/stripe/params/_payment_intent_update_params.py @@ -1985,6 +1985,14 @@ class PaymentIntentUpdateParamsPaymentMethodOptionsCardThreeDSecureNetworkOption class PaymentIntentUpdateParamsPaymentMethodOptionsCardPresent(TypedDict): + capture_method: NotRequired[Literal["manual", "manual_preferred"]] + """ + Controls when the funds are captured from the customer's account. + + If provided, this parameter overrides the behavior of the top-level [capture_method](https://docs.stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + + If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + """ request_extended_authorization: NotRequired[bool] """ Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity) diff --git a/stripe/params/terminal/_configuration_create_params.py b/stripe/params/terminal/_configuration_create_params.py index b1a022b9c..4172b8028 100644 --- a/stripe/params/terminal/_configuration_create_params.py +++ b/stripe/params/terminal/_configuration_create_params.py @@ -8,11 +8,11 @@ class ConfigurationCreateParams(RequestOptions): bbpos_wisepad3: NotRequired["ConfigurationCreateParamsBbposWisepad3"] """ - An object containing device type specific settings for BBPOS WisePad 3 readers + An object containing device type specific settings for BBPOS WisePad 3 readers. """ bbpos_wisepos_e: NotRequired["ConfigurationCreateParamsBbposWiseposE"] """ - An object containing device type specific settings for BBPOS WisePOS E readers + An object containing device type specific settings for BBPOS WisePOS E readers. """ expand: NotRequired[List[str]] """ @@ -28,19 +28,19 @@ class ConfigurationCreateParams(RequestOptions): """ reboot_window: NotRequired["ConfigurationCreateParamsRebootWindow"] """ - Reboot time settings for readers that support customized reboot time configuration. + Reboot time settings for readers. that support customized reboot time configuration. """ stripe_s700: NotRequired["ConfigurationCreateParamsStripeS700"] """ - An object containing device type specific settings for Stripe S700 readers + An object containing device type specific settings for Stripe S700 readers. """ tipping: NotRequired["Literal['']|ConfigurationCreateParamsTipping"] """ - Tipping configurations for readers supporting on-reader tips + Tipping configurations for readers. supporting on-reader tips """ verifone_p400: NotRequired["ConfigurationCreateParamsVerifoneP400"] """ - An object containing device type specific settings for Verifone P400 readers + An object containing device type specific settings for Verifone P400 readers. """ wifi: NotRequired["Literal['']|ConfigurationCreateParamsWifi"] """ @@ -51,7 +51,7 @@ class ConfigurationCreateParams(RequestOptions): class ConfigurationCreateParamsBbposWisepad3(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ @@ -83,7 +83,7 @@ class ConfigurationCreateParamsRebootWindow(TypedDict): class ConfigurationCreateParamsStripeS700(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ @@ -511,7 +511,7 @@ class ConfigurationCreateParamsTippingUsd(TypedDict): class ConfigurationCreateParamsVerifoneP400(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ diff --git a/stripe/params/terminal/_configuration_modify_params.py b/stripe/params/terminal/_configuration_modify_params.py index 298003bc3..0c7d6ca35 100644 --- a/stripe/params/terminal/_configuration_modify_params.py +++ b/stripe/params/terminal/_configuration_modify_params.py @@ -10,13 +10,13 @@ class ConfigurationModifyParams(RequestOptions): "Literal['']|ConfigurationModifyParamsBbposWisepad3" ] """ - An object containing device type specific settings for BBPOS WisePad 3 readers + An object containing device type specific settings for BBPOS WisePad 3 readers. """ bbpos_wisepos_e: NotRequired[ "Literal['']|ConfigurationModifyParamsBbposWiseposE" ] """ - An object containing device type specific settings for BBPOS WisePOS E readers + An object containing device type specific settings for BBPOS WisePOS E readers. """ expand: NotRequired[List[str]] """ @@ -34,21 +34,21 @@ class ConfigurationModifyParams(RequestOptions): "Literal['']|ConfigurationModifyParamsRebootWindow" ] """ - Reboot time settings for readers that support customized reboot time configuration. + Reboot time settings for readers. that support customized reboot time configuration. """ stripe_s700: NotRequired["Literal['']|ConfigurationModifyParamsStripeS700"] """ - An object containing device type specific settings for Stripe S700 readers + An object containing device type specific settings for Stripe S700 readers. """ tipping: NotRequired["Literal['']|ConfigurationModifyParamsTipping"] """ - Tipping configurations for readers supporting on-reader tips + Tipping configurations for readers. supporting on-reader tips """ verifone_p400: NotRequired[ "Literal['']|ConfigurationModifyParamsVerifoneP400" ] """ - An object containing device type specific settings for Verifone P400 readers + An object containing device type specific settings for Verifone P400 readers. """ wifi: NotRequired["Literal['']|ConfigurationModifyParamsWifi"] """ @@ -59,7 +59,7 @@ class ConfigurationModifyParams(RequestOptions): class ConfigurationModifyParamsBbposWisepad3(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ @@ -91,7 +91,7 @@ class ConfigurationModifyParamsRebootWindow(TypedDict): class ConfigurationModifyParamsStripeS700(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ @@ -519,7 +519,7 @@ class ConfigurationModifyParamsTippingUsd(TypedDict): class ConfigurationModifyParamsVerifoneP400(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ diff --git a/stripe/params/terminal/_configuration_update_params.py b/stripe/params/terminal/_configuration_update_params.py index dc9781e9d..d7891bf1d 100644 --- a/stripe/params/terminal/_configuration_update_params.py +++ b/stripe/params/terminal/_configuration_update_params.py @@ -9,13 +9,13 @@ class ConfigurationUpdateParams(TypedDict): "Literal['']|ConfigurationUpdateParamsBbposWisepad3" ] """ - An object containing device type specific settings for BBPOS WisePad 3 readers + An object containing device type specific settings for BBPOS WisePad 3 readers. """ bbpos_wisepos_e: NotRequired[ "Literal['']|ConfigurationUpdateParamsBbposWiseposE" ] """ - An object containing device type specific settings for BBPOS WisePOS E readers + An object containing device type specific settings for BBPOS WisePOS E readers. """ expand: NotRequired[List[str]] """ @@ -33,21 +33,21 @@ class ConfigurationUpdateParams(TypedDict): "Literal['']|ConfigurationUpdateParamsRebootWindow" ] """ - Reboot time settings for readers that support customized reboot time configuration. + Reboot time settings for readers. that support customized reboot time configuration. """ stripe_s700: NotRequired["Literal['']|ConfigurationUpdateParamsStripeS700"] """ - An object containing device type specific settings for Stripe S700 readers + An object containing device type specific settings for Stripe S700 readers. """ tipping: NotRequired["Literal['']|ConfigurationUpdateParamsTipping"] """ - Tipping configurations for readers supporting on-reader tips + Tipping configurations for readers. supporting on-reader tips """ verifone_p400: NotRequired[ "Literal['']|ConfigurationUpdateParamsVerifoneP400" ] """ - An object containing device type specific settings for Verifone P400 readers + An object containing device type specific settings for Verifone P400 readers. """ wifi: NotRequired["Literal['']|ConfigurationUpdateParamsWifi"] """ @@ -58,7 +58,7 @@ class ConfigurationUpdateParams(TypedDict): class ConfigurationUpdateParamsBbposWisepad3(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ @@ -90,7 +90,7 @@ class ConfigurationUpdateParamsRebootWindow(TypedDict): class ConfigurationUpdateParamsStripeS700(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ @@ -518,7 +518,7 @@ class ConfigurationUpdateParamsTippingUsd(TypedDict): class ConfigurationUpdateParamsVerifoneP400(TypedDict): splashscreen: NotRequired["Literal['']|str"] """ - A File ID representing an image you would like displayed on the reader. + A File ID representing an image you want to display on the reader. """ diff --git a/stripe/v2/billing/_meter_event.py b/stripe/v2/billing/_meter_event.py index 9d5a304dd..7ab581a1a 100644 --- a/stripe/v2/billing/_meter_event.py +++ b/stripe/v2/billing/_meter_event.py @@ -37,7 +37,8 @@ class MeterEvent(StripeObject): """ The payload of the event. This must contain the fields corresponding to a meter's `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and - `value_settings.event_payload_key` (default is `value`). Read more about the payload. + `value_settings.event_payload_key` (default is `value`). Read more about + the [payload](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides).. """ timestamp: str """ From 639dcb9e8985bdcd2f16c7b465303869d8e5dfb7 Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Wed, 5 Nov 2025 15:00:26 -0800 Subject: [PATCH 6/7] Bump version to 13.2.0 --- CHANGELOG.md | 4 ++++ VERSION | 2 +- pyproject.toml | 2 +- stripe/_version.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02213a97a..36b6f1dd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 13.2.0 - 2025-11-05 +* [#1662](https://github.com/stripe/stripe-python/pull/1662) Update generated code + * Add support for `capture_method` on `PaymentIntent.PaymentMethodOption.CardPresent`, `PaymentIntentConfirmParamsPaymentMethodOptionCardPresent`, `PaymentIntentCreateParamsPaymentMethodOptionCardPresent`, and `PaymentIntentModifyParamsPaymentMethodOptionCardPresent` + ## 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` diff --git a/VERSION b/VERSION index 383738180..67aee2394 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.1.2 +13.2.0 diff --git a/pyproject.toml b/pyproject.toml index bee351afe..2bc90f62f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "stripe" -version = "13.1.2" +version = "13.2.0" readme = "README.md" description = "Python bindings for the Stripe API" authors = [{ name = "Stripe", email = "support@stripe.com" }] diff --git a/stripe/_version.py b/stripe/_version.py index 34ea198a5..1cdb1633c 100644 --- a/stripe/_version.py +++ b/stripe/_version.py @@ -1 +1 @@ -VERSION = "13.1.2" +VERSION = "13.2.0" From cac5dc933ac31dbec47a02a74c1075f3bd3695af Mon Sep 17 00:00:00 2001 From: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:42:29 -0800 Subject: [PATCH 7/7] Add min version for custom request support (#1668) * Add min version for custom request support * Use pytest <9.0.0 --- README.md | 2 ++ deps/test-requirements.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d0b346854..59d0e5dcf 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,8 @@ Stripe has features in the [private preview phase](https://docs.stripe.com/relea ### Custom requests +> This feature is only available from version 11 of this SDK. + If you would like to send a request to an undocumented API (for example you are in a private beta), or if you prefer to bypass the method definitions in the library and specify your request details directly, you can use the `raw_request` method on `StripeClient`. ```python diff --git a/deps/test-requirements.txt b/deps/test-requirements.txt index 840c71309..e8ab486b2 100644 --- a/deps/test-requirements.txt +++ b/deps/test-requirements.txt @@ -14,4 +14,4 @@ anyio[trio] == 4.11.0; python_version >= "3.13" pytest-mock >= 2.0.0 mock >= 4.0; python_version < "3.8" pytest-xdist >= 1.31.0 -pytest >= 6.0.0 +pytest >= 6.0.0,<9.0.0