From de20eeb9f480bde3db4a1e71b592dab76733991c Mon Sep 17 00:00:00 2001 From: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com> Date: Tue, 1 Oct 2024 09:36:24 -0700 Subject: [PATCH 01/11] Support for APIs in the new API version 2024-09-30.acacia (#1404) --- OPENAPI_VERSION | 2 +- examples/README.md | 11 + examples/meter_event_stream.py | 44 ++ examples/new_example.py | 8 + examples/stripe_webhook_handler.py | 40 ++ stripe/__init__.py | 55 +- stripe/_api_mode.py | 2 +- stripe/_api_requestor.py | 175 +++-- stripe/_api_resource.py | 3 +- stripe/_api_version.py | 2 +- stripe/_base_address.py | 3 +- stripe/_billing_service.py | 14 + stripe/_capability.py | 2 +- stripe/_credit_note.py | 25 + stripe/_credit_note_line_item.py | 25 + stripe/_customer.py | 5 +- stripe/_encode.py | 21 +- stripe/_error.py | 16 +- stripe/_http_client.py | 26 +- stripe/_invoice.py | 30 + stripe/_invoice_line_item.py | 30 + stripe/_margin.py | 50 ++ stripe/_multipart_data_generator.py | 2 +- stripe/_oauth.py | 2 +- stripe/_oauth_service.py | 2 +- stripe/_object_classes.py | 13 + stripe/_product.py | 26 +- stripe/_product_service.py | 26 +- stripe/_promotion_code.py | 6 +- stripe/_promotion_code_service.py | 4 +- stripe/_request_options.py | 5 + stripe/_requestor_options.py | 13 + stripe/_stripe_client.py | 98 ++- stripe/_stripe_object.py | 2 - stripe/_subscription.py | 48 +- stripe/_subscription_service.py | 12 +- stripe/_util.py | 35 +- stripe/_v2_services.py | 12 + stripe/_webhook_endpoint.py | 1 + stripe/_webhook_endpoint_service.py | 1 + stripe/api_resources/__init__.py | 1 + stripe/api_resources/billing/__init__.py | 7 + .../billing/credit_balance_summary.py | 21 + .../billing/credit_balance_transaction.py | 21 + stripe/api_resources/billing/credit_grant.py | 21 + stripe/api_resources/margin.py | 21 + stripe/billing/__init__.py | 16 + stripe/billing/_alert.py | 61 +- stripe/billing/_alert_service.py | 36 +- stripe/billing/_credit_balance_summary.py | 158 +++++ .../_credit_balance_summary_service.py | 83 +++ stripe/billing/_credit_balance_transaction.py | 242 +++++++ .../_credit_balance_transaction_service.py | 125 ++++ stripe/billing/_credit_grant.py | 599 ++++++++++++++++++ stripe/billing/_credit_grant_service.py | 381 +++++++++++ stripe/billing_portal/_configuration.py | 11 +- .../billing_portal/_configuration_service.py | 11 +- stripe/checkout/_session.py | 2 +- stripe/checkout/_session_service.py | 2 +- stripe/events/__init__.py | 8 + stripe/events/_event_classes.py | 14 + ...ling_meter_error_report_triggered_event.py | 122 ++++ .../_v1_billing_meter_no_meter_found_event.py | 88 +++ stripe/tax/_settings.py | 2 +- stripe/terminal/_reader.py | 10 +- stripe/terminal/_reader_service.py | 10 +- stripe/treasury/_received_credit.py | 7 +- stripe/v2/__init__.py | 10 + stripe/v2/_amount.py | 14 + stripe/v2/_billing_service.py | 24 + stripe/v2/_core_service.py | 10 + stripe/v2/_event.py | 124 ++++ stripe/v2/_list_object.py | 59 ++ stripe/v2/billing/__init__.py | 21 + stripe/v2/billing/_meter_event.py | 46 ++ stripe/v2/billing/_meter_event_adjustment.py | 51 ++ .../_meter_event_adjustment_service.py | 67 ++ stripe/v2/billing/_meter_event_service.py | 72 +++ stripe/v2/billing/_meter_event_session.py | 36 ++ .../billing/_meter_event_session_service.py | 50 ++ .../v2/billing/_meter_event_stream_service.py | 71 +++ stripe/v2/core/__init__.py | 3 + stripe/v2/core/_event_service.py | 102 +++ .../abstract/test_api_resource.py | 2 +- tests/api_resources/test_list_object.py | 6 +- tests/api_resources/test_list_object_v2.py | 147 +++++ .../test_search_result_object.py | 2 +- tests/fixtures/card.json | 26 - tests/http_client_mock.py | 2 + tests/test_api_requestor.py | 300 ++++++--- tests/test_generated_examples.py | 106 +--- tests/test_http_client.py | 28 +- tests/test_integration.py | 69 +- tests/test_raw_request.py | 225 +++++++ tests/test_request_options.py | 2 + tests/test_requestor_options.py | 13 + tests/test_stripe_client.py | 70 +- tests/test_util.py | 4 +- tests/test_v2_error.py | 141 +++++ tests/test_v2_event.py | 110 ++++ tests/test_webhook.py | 12 +- 101 files changed, 4575 insertions(+), 427 deletions(-) create mode 100644 examples/README.md create mode 100644 examples/meter_event_stream.py create mode 100644 examples/new_example.py create mode 100644 examples/stripe_webhook_handler.py create mode 100644 stripe/_margin.py create mode 100644 stripe/_v2_services.py create mode 100644 stripe/api_resources/billing/credit_balance_summary.py create mode 100644 stripe/api_resources/billing/credit_balance_transaction.py create mode 100644 stripe/api_resources/billing/credit_grant.py create mode 100644 stripe/api_resources/margin.py create mode 100644 stripe/billing/_credit_balance_summary.py create mode 100644 stripe/billing/_credit_balance_summary_service.py create mode 100644 stripe/billing/_credit_balance_transaction.py create mode 100644 stripe/billing/_credit_balance_transaction_service.py create mode 100644 stripe/billing/_credit_grant.py create mode 100644 stripe/billing/_credit_grant_service.py create mode 100644 stripe/events/__init__.py create mode 100644 stripe/events/_event_classes.py create mode 100644 stripe/events/_v1_billing_meter_error_report_triggered_event.py create mode 100644 stripe/events/_v1_billing_meter_no_meter_found_event.py create mode 100644 stripe/v2/__init__.py create mode 100644 stripe/v2/_amount.py create mode 100644 stripe/v2/_billing_service.py create mode 100644 stripe/v2/_core_service.py create mode 100644 stripe/v2/_event.py create mode 100644 stripe/v2/_list_object.py create mode 100644 stripe/v2/billing/__init__.py create mode 100644 stripe/v2/billing/_meter_event.py create mode 100644 stripe/v2/billing/_meter_event_adjustment.py create mode 100644 stripe/v2/billing/_meter_event_adjustment_service.py create mode 100644 stripe/v2/billing/_meter_event_service.py create mode 100644 stripe/v2/billing/_meter_event_session.py create mode 100644 stripe/v2/billing/_meter_event_session_service.py create mode 100644 stripe/v2/billing/_meter_event_stream_service.py create mode 100644 stripe/v2/core/__init__.py create mode 100644 stripe/v2/core/_event_service.py create mode 100644 tests/api_resources/test_list_object_v2.py delete mode 100644 tests/fixtures/card.json create mode 100644 tests/test_raw_request.py create mode 100644 tests/test_v2_error.py create mode 100644 tests/test_v2_event.py diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 5f5b31119..8f166ae2e 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1267 \ No newline at end of file +v1268 \ No newline at end of file diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000..c73c6149f --- /dev/null +++ b/examples/README.md @@ -0,0 +1,11 @@ +## Running an example + +From the examples folder, run: +`PYTHONPATH=../ python your_example.py` + +## Adding a new example + +1. Clone new_example.py +2. Implement your example +3. Run it (as per above) +4. 👍 diff --git a/examples/meter_event_stream.py b/examples/meter_event_stream.py new file mode 100644 index 000000000..0d02bb9d8 --- /dev/null +++ b/examples/meter_event_stream.py @@ -0,0 +1,44 @@ +from datetime import datetime, timezone +import stripe + +# Global variable for the meter event session +meter_event_session = None + + +def refresh_meter_event_session(api_key): + global meter_event_session + + # Check if the session is None or expired + if meter_event_session is None or datetime.fromisoformat( + meter_event_session["expires_at"] + ) <= datetime.now(timezone.utc): + # Create a new meter event session if the existing session has expired + client = stripe.StripeClient(api_key) + meter_event_session = client.v2.billing.meter_event_session.create() + + +def send_meter_event(meter_event, api_key): + # Refresh the meter event session if necessary + refresh_meter_event_session(api_key) + if not meter_event_session: + raise RuntimeError("Unable to refresh meter event session") + + # Create a meter event with the current session's authentication token + client = stripe.StripeClient(meter_event_session["authentication_token"]) + client.v2.billing.meter_event_stream.create( + params={"events": [meter_event]} + ) + + +# Set your API key here +api_key = "{{API_KEY}}" +customer_id = "{{CUSTOMER_ID}}" + +# Send meter event +send_meter_event( + { + "event_name": "alpaca_ai_tokens", + "payload": {"stripe_customer_id": customer_id, "value": "25"}, + }, + api_key, +) diff --git a/examples/new_example.py b/examples/new_example.py new file mode 100644 index 000000000..53a93e7e6 --- /dev/null +++ b/examples/new_example.py @@ -0,0 +1,8 @@ +import stripe + +# Set your API key here +api_key = "{{API_KEY}}" + +print("Hello world") +# client = stripe.StripeClient(api_key) +# client.v2.... diff --git a/examples/stripe_webhook_handler.py b/examples/stripe_webhook_handler.py new file mode 100644 index 000000000..e4452d9c7 --- /dev/null +++ b/examples/stripe_webhook_handler.py @@ -0,0 +1,40 @@ +import os +from stripe import StripeClient +from stripe.events import V1BillingMeterErrorReportTriggeredEvent + +from flask import Flask, request, jsonify + +app = Flask(__name__) +api_key = os.environ.get("STRIPE_API_KEY") +webhook_secret = os.environ.get("WEBHOOK_SECRET") + +client = StripeClient(api_key) + + +@app.route("/webhook", methods=["POST"]) +def webhook(): + webhook_body = request.data + sig_header = request.headers.get("Stripe-Signature") + + try: + thin_event = client.parse_thin_event( + webhook_body, sig_header, webhook_secret + ) + + # Fetch the event data to understand the failure + event = client.v2.core.events.retrieve(thin_event.id) + if isinstance(event, V1BillingMeterErrorReportTriggeredEvent): + meter = event.fetch_related_object() + meter_id = meter.id + print("Success! " + str(meter_id)) + + # Record the failures and alert your team + # Add your logic here + + return jsonify(success=True), 200 + except Exception as e: + return jsonify(error=str(e)), 400 + + +if __name__ == "__main__": + app.run(port=4242) diff --git a/stripe/__init__.py b/stripe/__init__.py index 9edd2b715..0300781a1 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -2,6 +2,7 @@ from typing import Optional import sys as _sys import os +import warnings # Stripe Python bindings # API docs at http://stripe.com/docs/api @@ -25,6 +26,7 @@ DEFAULT_API_BASE: str = "https://api.stripe.com" DEFAULT_CONNECT_API_BASE: str = "https://connect.stripe.com" DEFAULT_UPLOAD_API_BASE: str = "https://files.stripe.com" +DEFAULT_METER_EVENTS_API_BASE: str = "https://meter-events.stripe.com" api_key: Optional[str] = None @@ -32,22 +34,62 @@ api_base: str = DEFAULT_API_BASE connect_api_base: str = DEFAULT_CONNECT_API_BASE upload_api_base: str = DEFAULT_UPLOAD_API_BASE +meter_events_api_base: str = DEFAULT_METER_EVENTS_API_BASE api_version: str = _ApiVersion.CURRENT verify_ssl_certs: bool = True proxy: Optional[str] = None default_http_client: Optional["HTTPClient"] = None app_info: Optional[AppInfo] = None enable_telemetry: bool = True -max_network_retries: int = 0 +max_network_retries: int = 2 ca_bundle_path: str = os.path.join( os.path.dirname(__file__), "data", "ca-certificates.crt" ) +# Lazily initialized stripe.default_http_client +default_http_client = None +_default_proxy = None + + +def ensure_default_http_client(): + if default_http_client: + _warn_if_mismatched_proxy() + return + _init_default_http_client() + + +def _init_default_http_client(): + global _default_proxy + global default_http_client + + # If the stripe.default_http_client has not been set by the user + # yet, we'll set it here. This way, we aren't creating a new + # HttpClient for every request. + default_http_client = new_default_http_client( + verify_ssl_certs=verify_ssl_certs, proxy=proxy + ) + _default_proxy = proxy + + +def _warn_if_mismatched_proxy(): + global _default_proxy + from stripe import proxy + + if proxy != _default_proxy: + warnings.warn( + "stripe.proxy was updated after sending a " + "request - this is a no-op. To use a different proxy, " + "set stripe.default_http_client to a new client " + "configured with the proxy." + ) + + # Set to either 'debug' or 'info', controls console logging log: Optional[Literal["debug", "info"]] = None # OAuth from stripe._oauth import OAuth as OAuth +from stripe._oauth_service import OAuthService as OAuthService # Webhooks from stripe._webhook import ( @@ -58,6 +100,8 @@ # StripeClient from stripe._stripe_client import StripeClient as StripeClient # noqa +from stripe.v2._event import ThinEvent as ThinEvent # noqa + # Sets some basic information about the running application that's sent along # with API requests. Useful for plugin authors to identify their plugin when @@ -180,8 +224,6 @@ def set_app_info( from stripe import _request_metrics as request_metrics from stripe._file import File as FileUpload - import warnings - # Python 3.7+ supports module level __getattr__ that allows us to lazy load deprecated modules # this matters because if we pre-load all modules from api_resources while suppressing warning # users will never see those warnings @@ -218,6 +260,7 @@ def __getattr__(name): checkout as checkout, climate as climate, entitlements as entitlements, + events as events, financial_connections as financial_connections, forwarding as forwarding, identity as identity, @@ -229,6 +272,7 @@ def __getattr__(name): terminal as terminal, test_helpers as test_helpers, treasury as treasury, + v2 as v2, ) from stripe._account import Account as Account from stripe._account_capability_service import ( @@ -355,6 +399,9 @@ def __getattr__(name): from stripe._ephemeral_key_service import ( EphemeralKeyService as EphemeralKeyService, ) +from stripe._error import ( + TemporarySessionExpiredError as TemporarySessionExpiredError, +) from stripe._event import Event as Event from stripe._event_service import EventService as EventService from stripe._exchange_rate import ExchangeRate as ExchangeRate @@ -397,6 +444,7 @@ def __getattr__(name): from stripe._login_link import LoginLink as LoginLink from stripe._mandate import Mandate as Mandate from stripe._mandate_service import MandateService as MandateService +from stripe._margin import Margin as Margin from stripe._payment_intent import PaymentIntent as PaymentIntent from stripe._payment_intent_service import ( PaymentIntentService as PaymentIntentService, @@ -529,6 +577,7 @@ def __getattr__(name): from stripe._usage_record_summary import ( UsageRecordSummary as UsageRecordSummary, ) +from stripe._v2_services import V2Services as V2Services from stripe._webhook_endpoint import WebhookEndpoint as WebhookEndpoint from stripe._webhook_endpoint_service import ( WebhookEndpointService as WebhookEndpointService, diff --git a/stripe/_api_mode.py b/stripe/_api_mode.py index 1503e56e0..7290784d3 100644 --- a/stripe/_api_mode.py +++ b/stripe/_api_mode.py @@ -1,4 +1,4 @@ from typing_extensions import Literal -ApiMode = Literal["V1"] +ApiMode = Literal["V1", "V2"] diff --git a/stripe/_api_requestor.py b/stripe/_api_requestor.py index 61f3085eb..65bb449fe 100644 --- a/stripe/_api_requestor.py +++ b/stripe/_api_requestor.py @@ -29,15 +29,14 @@ log_info, dashboard_link, _convert_to_stripe_object, + get_api_mode, ) from stripe._version import VERSION import stripe._error as error import stripe.oauth_error as oauth_error from stripe._multipart_data_generator import MultipartDataGenerator from urllib.parse import urlencode -from stripe._encode import ( - _api_encode, -) +from stripe._encode import _api_encode, _json_encode_date_callback from stripe._stripe_response import ( StripeResponse, StripeStreamResponse, @@ -183,8 +182,8 @@ def request( base_address: BaseAddress, usage: Optional[List[str]] = None, ) -> "StripeObject": + api_mode = get_api_mode(url) requestor = self._replace_options(options) - api_mode = "V1" rbody, rcode, rheaders = requestor.request_raw( method.lower(), url, @@ -195,15 +194,17 @@ def request( options=options, usage=usage, ) - resp = requestor._interpret_response(rbody, rcode, rheaders) + resp = requestor._interpret_response(rbody, rcode, rheaders, api_mode) - return _convert_to_stripe_object( + obj = _convert_to_stripe_object( resp=resp, params=params, requestor=requestor, api_mode=api_mode, ) + return obj + async def request_async( self, method: str, @@ -214,7 +215,7 @@ async def request_async( base_address: BaseAddress, usage: Optional[List[str]] = None, ) -> "StripeObject": - api_mode = "V1" + api_mode = get_api_mode(url) requestor = self._replace_options(options) rbody, rcode, rheaders = await requestor.request_raw_async( method.lower(), @@ -226,15 +227,17 @@ async def request_async( options=options, usage=usage, ) - resp = requestor._interpret_response(rbody, rcode, rheaders) + resp = requestor._interpret_response(rbody, rcode, rheaders, api_mode) - return _convert_to_stripe_object( + obj = _convert_to_stripe_object( resp=resp, params=params, requestor=requestor, api_mode=api_mode, ) + return obj + def request_stream( self, method: str, @@ -245,7 +248,7 @@ def request_stream( base_address: BaseAddress, usage: Optional[List[str]] = None, ) -> StripeStreamResponse: - api_mode = "V1" + api_mode = get_api_mode(url) stream, rcode, rheaders = self.request_raw( method.lower(), url, @@ -262,6 +265,7 @@ def request_stream( cast(IOBase, stream), rcode, rheaders, + api_mode, ) return resp @@ -275,7 +279,7 @@ async def request_stream_async( base_address: BaseAddress, usage: Optional[List[str]] = None, ) -> StripeStreamResponseAsync: - api_mode = "V1" + api_mode = get_api_mode(url) stream, rcode, rheaders = await self.request_raw_async( method.lower(), url, @@ -290,10 +294,13 @@ async def request_stream_async( stream, rcode, rheaders, + api_mode, ) return resp - def handle_error_response(self, rbody, rcode, resp, rheaders) -> NoReturn: + def handle_error_response( + self, rbody, rcode, resp, rheaders, api_mode + ) -> NoReturn: try: error_data = resp["error"] except (KeyError, TypeError): @@ -316,15 +323,60 @@ def handle_error_response(self, rbody, rcode, resp, rheaders) -> NoReturn: ) if err is None: - err = self.specific_api_error( - rbody, rcode, resp, rheaders, error_data + err = ( + self.specific_v2_api_error( + rbody, rcode, resp, rheaders, error_data + ) + if api_mode == "V2" + else self.specific_v1_api_error( + rbody, rcode, resp, rheaders, error_data + ) ) raise err - def specific_api_error(self, rbody, rcode, resp, rheaders, error_data): + def specific_v2_api_error(self, rbody, rcode, resp, rheaders, error_data): + type = error_data.get("type") + code = error_data.get("code") + message = error_data.get("message") + error_args = { + "message": message, + "http_body": rbody, + "http_status": rcode, + "json_body": resp, + "headers": rheaders, + "code": code, + } + log_info( - "Stripe API error received", + "Stripe v2 API error received", + error_code=code, + error_type=error_data.get("type"), + error_message=message, + error_param=error_data.get("param"), + ) + + if type == "idempotency_error": + return error.IdempotencyError( + message, + rbody, + rcode, + resp, + rheaders, + code, + ) + # switchCases: The beginning of the section generated from our OpenAPI spec + elif type == "temporary_session_expired": + return error.TemporarySessionExpiredError(**error_args) + # switchCases: The end of the section generated from our OpenAPI spec + + return self.specific_v1_api_error( + rbody, rcode, resp, rheaders, error_data + ) + + def specific_v1_api_error(self, rbody, rcode, resp, rheaders, error_data): + log_info( + "Stripe v1 API error received", error_code=error_data.get("code"), error_type=error_data.get("type"), error_message=error_data.get("message"), @@ -402,8 +454,13 @@ def specific_oauth_error(self, rbody, rcode, resp, rheaders, error_code): return None - def request_headers(self, method, options: RequestOptions): - user_agent = "Stripe/v1 PythonBindings/%s" % (VERSION,) + def request_headers( + self, method: HttpVerb, api_mode: ApiMode, options: RequestOptions + ): + user_agent = "Stripe/%s PythonBindings/%s" % ( + api_mode.lower(), + VERSION, + ) if stripe.app_info: user_agent += " " + self._format_app_info(stripe.app_info) @@ -436,13 +493,23 @@ def request_headers(self, method, options: RequestOptions): if stripe_account: headers["Stripe-Account"] = stripe_account + stripe_context = options.get("stripe_context") + if stripe_context: + headers["Stripe-Context"] = stripe_context + idempotency_key = options.get("idempotency_key") if idempotency_key: headers["Idempotency-Key"] = idempotency_key - if method == "post": + # IKs should be set for all POST requests and v2 delete requests + if method == "post" or (api_mode == "V2" and method == "delete"): headers.setdefault("Idempotency-Key", str(uuid.uuid4())) - headers["Content-Type"] = "application/x-www-form-urlencoded" + + if method == "post": + if api_mode == "V2": + headers["Content-Type"] = "application/json" + else: + headers["Content-Type"] = "application/x-www-form-urlencoded" stripe_version = options.get("stripe_version") if stripe_version: @@ -462,10 +529,19 @@ def _args_for_request_with_retries( usage: Optional[List[str]] = None, ): """ - Mechanism for issuing an API call + Mechanism for issuing an API call. Used by request_raw and request_raw_async. """ request_options = merge_options(self._options, options) + # Special stripe_version handling for v2 requests: + if ( + options + and "stripe_version" in options + and (options["stripe_version"] is not None) + ): + # If user specified an API version, honor it + request_options["stripe_version"] = options["stripe_version"] + if request_options.get("api_key") is None: raise error.AuthenticationError( "No API key provided. (HINT: set your API key using " @@ -480,14 +556,19 @@ def _args_for_request_with_retries( url, ) - encoded_params = urlencode(list(_api_encode(params or {}))) + encoded_params = urlencode(list(_api_encode(params or {}, api_mode))) # Don't use strict form encoding by changing the square bracket control # characters back to their literals. This is fine by the server, and # makes these parameter strings easier to read. encoded_params = encoded_params.replace("%5B", "[").replace("%5D", "]") - encoded_body = encoded_params + if api_mode == "V2": + encoded_body = json.dumps( + params or {}, default=_json_encode_date_callback + ) + else: + encoded_body = encoded_params supplied_headers = None if ( @@ -496,7 +577,12 @@ def _args_for_request_with_retries( ): supplied_headers = dict(request_options["headers"]) - headers = self.request_headers(method, request_options) + headers = self.request_headers( + # this cast is safe because the blocks below validate that `method` is one of the allowed values + cast(HttpVerb, method), + api_mode, + request_options, + ) if method == "get" or method == "delete": if params: @@ -714,6 +800,7 @@ def _interpret_response( rbody: object, rcode: int, rheaders: Mapping[str, str], + api_mode: ApiMode, ) -> StripeResponse: try: if hasattr(rbody, "decode"): @@ -734,30 +821,17 @@ def _interpret_response( rheaders, ) if self._should_handle_code_as_error(rcode): - self.handle_error_response(rbody, rcode, resp.data, rheaders) - return resp - - async def _interpret_streaming_response_async( - self, - stream: AsyncIterable[bytes], - rcode: int, - rheaders: Mapping[str, str], - ) -> StripeStreamResponseAsync: - if self._should_handle_code_as_error(rcode): - json_content = b"".join([chunk async for chunk in stream]) - self._interpret_response(json_content, rcode, rheaders) - # _interpret_response is guaranteed to throw since we've checked self._should_handle_code_as_error - raise RuntimeError( - "_interpret_response should have raised an error" + self.handle_error_response( + rbody, rcode, resp.data, rheaders, api_mode ) - else: - return StripeStreamResponseAsync(stream, rcode, rheaders) + return resp def _interpret_streaming_response( self, stream: IOBase, rcode: int, rheaders: Mapping[str, str], + api_mode: ApiMode, ) -> StripeStreamResponse: # Streaming response are handled with minimal processing for the success # case (ie. we don't want to read the content). When an error is @@ -775,10 +849,27 @@ def _interpret_streaming_response( % self._get_http_client().name ) - self._interpret_response(json_content, rcode, rheaders) + self._interpret_response(json_content, rcode, rheaders, api_mode) # _interpret_response is guaranteed to throw since we've checked self._should_handle_code_as_error raise RuntimeError( "_interpret_response should have raised an error" ) else: return StripeStreamResponse(stream, rcode, rheaders) + + async def _interpret_streaming_response_async( + self, + stream: AsyncIterable[bytes], + rcode: int, + rheaders: Mapping[str, str], + api_mode: ApiMode, + ) -> StripeStreamResponseAsync: + if self._should_handle_code_as_error(rcode): + json_content = b"".join([chunk async for chunk in stream]) + self._interpret_response(json_content, rcode, rheaders, api_mode) + # _interpret_response is guaranteed to throw since we've checked self._should_handle_code_as_error + raise RuntimeError( + "_interpret_response should have raised an error" + ) + else: + return StripeStreamResponseAsync(stream, rcode, rheaders) diff --git a/stripe/_api_resource.py b/stripe/_api_resource.py index 1fb402ab8..2866b42c1 100644 --- a/stripe/_api_resource.py +++ b/stripe/_api_resource.py @@ -99,6 +99,7 @@ async def _request_async( params=None, *, base_address: BaseAddress = "api", + api_mode: ApiMode = "V1", ) -> StripeObject: obj = await StripeObject._request_async( self, @@ -109,7 +110,7 @@ async def _request_async( ) if type(self) is type(obj): - self._refresh_from(values=obj, api_mode="V1") + self._refresh_from(values=obj, api_mode=api_mode) return self else: return obj diff --git a/stripe/_api_version.py b/stripe/_api_version.py index 3e3f977ff..e23615373 100644 --- a/stripe/_api_version.py +++ b/stripe/_api_version.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec class _ApiVersion: - CURRENT = "2024-06-20" + CURRENT = "2024-09-30.acacia" diff --git a/stripe/_base_address.py b/stripe/_base_address.py index aa7a133e7..b45e6eda5 100644 --- a/stripe/_base_address.py +++ b/stripe/_base_address.py @@ -2,10 +2,11 @@ from typing_extensions import NotRequired, TypedDict, Literal -BaseAddress = Literal["api", "files", "connect"] +BaseAddress = Literal["api", "files", "connect", "meter_events"] class BaseAddresses(TypedDict): api: NotRequired[Optional[str]] connect: NotRequired[Optional[str]] files: NotRequired[Optional[str]] + meter_events: NotRequired[Optional[str]] diff --git a/stripe/_billing_service.py b/stripe/_billing_service.py index e30f30081..a94b4f57c 100644 --- a/stripe/_billing_service.py +++ b/stripe/_billing_service.py @@ -2,6 +2,13 @@ # File generated from our OpenAPI spec from stripe._stripe_service import StripeService from stripe.billing._alert_service import AlertService +from stripe.billing._credit_balance_summary_service import ( + CreditBalanceSummaryService, +) +from stripe.billing._credit_balance_transaction_service import ( + CreditBalanceTransactionService, +) +from stripe.billing._credit_grant_service import CreditGrantService from stripe.billing._meter_event_adjustment_service import ( MeterEventAdjustmentService, ) @@ -13,6 +20,13 @@ class BillingService(StripeService): def __init__(self, requestor): super().__init__(requestor) self.alerts = AlertService(self._requestor) + self.credit_balance_summary = CreditBalanceSummaryService( + self._requestor, + ) + self.credit_balance_transactions = CreditBalanceTransactionService( + self._requestor, + ) + self.credit_grants = CreditGrantService(self._requestor) self.meters = MeterService(self._requestor) self.meter_events = MeterEventService(self._requestor) self.meter_event_adjustments = MeterEventAdjustmentService( diff --git a/stripe/_capability.py b/stripe/_capability.py index 944236d60..d83ba3b62 100644 --- a/stripe/_capability.py +++ b/stripe/_capability.py @@ -368,7 +368,7 @@ class Error(StripeObject): requirements: Optional[Requirements] status: Literal["active", "disabled", "inactive", "pending", "unrequested"] """ - The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`. + The status of the capability. """ def instance_url(self): diff --git a/stripe/_credit_note.py b/stripe/_credit_note.py index 8054b28e5..6e5ae51ff 100644 --- a/stripe/_credit_note.py +++ b/stripe/_credit_note.py @@ -27,6 +27,9 @@ from stripe._refund import Refund from stripe._shipping_rate import ShippingRate from stripe._tax_rate import TaxRate + from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction, + ) @nested_resource_class_methods("line") @@ -53,6 +56,26 @@ class DiscountAmount(StripeObject): The discount that was applied to get this discount amount. """ + class PretaxCreditAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the pretax credit amount. + """ + credit_balance_transaction: Optional[ + ExpandableField["CreditBalanceTransaction"] + ] + """ + The credit balance transaction that was applied to get this pretax credit amount. + """ + discount: Optional[ExpandableField["Discount"]] + """ + The discount that was applied to get this pretax credit amount. + """ + type: Literal["credit_balance_transaction", "discount"] + """ + Type of the pretax credit amount referenced. + """ + class ShippingCost(StripeObject): class Tax(StripeObject): amount: int @@ -711,6 +734,7 @@ class VoidCreditNoteParams(RequestOptions): """ The link to download the PDF of the credit note. """ + pretax_credit_amounts: Optional[List[PretaxCreditAmount]] reason: Optional[ Literal[ "duplicate", "fraudulent", "order_change", "product_unsatisfactory" @@ -1122,6 +1146,7 @@ async def list_lines_async( _inner_class_types = { "discount_amounts": DiscountAmount, + "pretax_credit_amounts": PretaxCreditAmount, "shipping_cost": ShippingCost, "tax_amounts": TaxAmount, } diff --git a/stripe/_credit_note_line_item.py b/stripe/_credit_note_line_item.py index 40ebeb2df..04505cf83 100644 --- a/stripe/_credit_note_line_item.py +++ b/stripe/_credit_note_line_item.py @@ -8,6 +8,9 @@ if TYPE_CHECKING: from stripe._discount import Discount from stripe._tax_rate import TaxRate + from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction, + ) class CreditNoteLineItem(StripeObject): @@ -29,6 +32,26 @@ class DiscountAmount(StripeObject): The discount that was applied to get this discount amount. """ + class PretaxCreditAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the pretax credit amount. + """ + credit_balance_transaction: Optional[ + ExpandableField["CreditBalanceTransaction"] + ] + """ + The credit balance transaction that was applied to get this pretax credit amount. + """ + discount: Optional[ExpandableField["Discount"]] + """ + The discount that was applied to get this pretax credit amount. + """ + type: Literal["credit_balance_transaction", "discount"] + """ + Type of the pretax credit amount referenced. + """ + class TaxAmount(StripeObject): amount: int """ @@ -105,6 +128,7 @@ class TaxAmount(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ + pretax_credit_amounts: Optional[List[PretaxCreditAmount]] quantity: Optional[int] """ The number of units of product being credited. @@ -135,5 +159,6 @@ class TaxAmount(StripeObject): """ _inner_class_types = { "discount_amounts": DiscountAmount, + "pretax_credit_amounts": PretaxCreditAmount, "tax_amounts": TaxAmount, } diff --git a/stripe/_customer.py b/stripe/_customer.py index b163859fc..001126339 100644 --- a/stripe/_customer.py +++ b/stripe/_customer.py @@ -63,9 +63,8 @@ class Customer( UpdateableAPIResource["Customer"], ): """ - This object represents a customer of your business. Use it to create recurring charges and track payments that belong to the same customer. - - Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment) + This object represents a customer of your business. Use it to [create recurring charges](https://stripe.com/docs/invoicing/customer), [save payment](https://stripe.com/docs/payments/save-during-payment) and contact information, + and track payments that belong to the same customer. """ OBJECT_NAME: ClassVar[Literal["customer"]] = "customer" diff --git a/stripe/_encode.py b/stripe/_encode.py index 9552a739e..181038ef0 100644 --- a/stripe/_encode.py +++ b/stripe/_encode.py @@ -2,7 +2,7 @@ import datetime import time from collections import OrderedDict -from typing import Generator, Tuple, Any +from typing import Generator, Optional, Tuple, Any def _encode_datetime(dttime: datetime.datetime): @@ -21,7 +21,15 @@ def _encode_nested_dict(key, data, fmt="%s[%s]"): return d -def _api_encode(data) -> Generator[Tuple[str, Any], None, None]: +def _json_encode_date_callback(value): + if isinstance(value, datetime.datetime): + return _encode_datetime(value) + return value + + +def _api_encode( + data, api_mode: Optional[str] +) -> Generator[Tuple[str, Any], None, None]: for key, value in data.items(): if value is None: continue @@ -29,15 +37,16 @@ def _api_encode(data) -> Generator[Tuple[str, Any], None, None]: yield (key, value.stripe_id) elif isinstance(value, list) or isinstance(value, tuple): for i, sv in enumerate(value): + encoded_key = key if api_mode == "V2" else "%s[%d]" % (key, i) if isinstance(sv, dict): - subdict = _encode_nested_dict("%s[%d]" % (key, i), sv) - for k, v in _api_encode(subdict): + subdict = _encode_nested_dict(encoded_key, sv) + for k, v in _api_encode(subdict, api_mode): yield (k, v) else: - yield ("%s[%d]" % (key, i), sv) + yield (encoded_key, sv) elif isinstance(value, dict): subdict = _encode_nested_dict(key, value) - for subkey, subvalue in _api_encode(subdict): + for subkey, subvalue in _api_encode(subdict, api_mode): yield (subkey, subvalue) elif isinstance(value, datetime.datetime): yield (key, _encode_datetime(value)) diff --git a/stripe/_error.py b/stripe/_error.py index aba72701d..3b486ee79 100644 --- a/stripe/_error.py +++ b/stripe/_error.py @@ -1,7 +1,6 @@ from typing import Dict, Optional, Union, cast -# Used for global variable -import stripe # noqa: IMP101 +import stripe # noqa from stripe._error_object import ErrorObject @@ -13,7 +12,7 @@ class StripeError(Exception): headers: Optional[Dict[str, str]] code: Optional[str] request_id: Optional[str] - error: Optional[ErrorObject] + error: Optional["ErrorObject"] def __init__( self, @@ -76,10 +75,13 @@ def _construct_error_object(self) -> Optional[ErrorObject]: or not isinstance(self.json_body["error"], dict) ): return None + from stripe._error_object import ErrorObject return ErrorObject._construct_from( values=self.json_body["error"], requestor=stripe._APIRequestor._global_instance(), + # We pass in API mode as "V1" here because it's required, + # but ErrorObject is reused for both V1 and V2 errors. api_mode="V1", ) @@ -177,3 +179,11 @@ class SignatureVerificationError(StripeError): def __init__(self, message, sig_header, http_body=None): super(SignatureVerificationError, self).__init__(message, http_body) self.sig_header = sig_header + + +# classDefinitions: The beginning of the section generated from our OpenAPI spec +class TemporarySessionExpiredError(StripeError): + pass + + +# classDefinitions: The end of the section generated from our OpenAPI spec diff --git a/stripe/_http_client.py b/stripe/_http_client.py index 459b40ae5..0db2ef3f5 100644 --- a/stripe/_http_client.py +++ b/stripe/_http_client.py @@ -148,7 +148,7 @@ class _Proxy(TypedDict): http: Optional[str] https: Optional[str] - MAX_DELAY = 2 + MAX_DELAY = 5 INITIAL_DELAY = 0.5 MAX_RETRY_AFTER = 60 _proxy: Optional[_Proxy] @@ -242,10 +242,11 @@ def _sleep_time_seconds( self, num_retries: int, response: Optional[Tuple[Any, Any, Mapping[str, str]]] = None, - ): - # Apply exponential backoff with initial_network_retry_delay on the - # number of num_retries so far as inputs. - # Do not allow the number to exceed max_network_retry_delay. + ) -> float: + """ + Apply exponential backoff with initial_network_retry_delay on the number of num_retries so far as inputs. + Do not allow the number to exceed `max_network_retry_delay`. + """ sleep_seconds = min( HTTPClient.INITIAL_DELAY * (2 ** (num_retries - 1)), HTTPClient.MAX_DELAY, @@ -263,9 +264,11 @@ def _sleep_time_seconds( return sleep_seconds - def _add_jitter_time(self, sleep_seconds: float): - # Randomize the value in [(sleep_seconds/ 2) to (sleep_seconds)] - # Also separated method here to isolate randomness for tests + def _add_jitter_time(self, sleep_seconds: float) -> float: + """ + Randomize the value in `[(sleep_seconds/ 2) to (sleep_seconds)]`. + Also separated method here to isolate randomness for tests + """ sleep_seconds *= 0.5 * (1 + random.uniform(0, 1)) return sleep_seconds @@ -900,6 +903,11 @@ def close(self): pass +class _Proxy(TypedDict): + http: Optional[ParseResult] + https: Optional[ParseResult] + + class PycurlClient(HTTPClient): class _ParsedProxy(TypedDict, total=False): http: Optional[ParseResult] @@ -1025,7 +1033,7 @@ def _request_internal( self._curl.setopt(self.pycurl.TIMEOUT, 80) self._curl.setopt( self.pycurl.HTTPHEADER, - ["%s: %s" % (k, v) for k, v in iter(dict(headers).items())], + ["%s: %s" % (k, v) for k, v in dict(headers).items()], ) if self._verify_ssl_certs: self._curl.setopt(self.pycurl.CAINFO, stripe.ca_bundle_path) diff --git a/stripe/_invoice.py b/stripe/_invoice.py index 07f217f9e..db9966044 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -40,6 +40,7 @@ from stripe._customer import Customer from stripe._discount import Discount from stripe._invoice_line_item import InvoiceLineItem + from stripe._margin import Margin from stripe._payment_intent import PaymentIntent from stripe._payment_method import PaymentMethod from stripe._quote import Quote @@ -49,6 +50,9 @@ from stripe._subscription import Subscription from stripe._tax_id import TaxId from stripe._tax_rate import TaxRate + from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction, + ) from stripe.test_helpers._test_clock import TestClock @@ -965,6 +969,30 @@ class TotalDiscountAmount(StripeObject): The discount that was applied to get this discount amount. """ + class TotalPretaxCreditAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the pretax credit amount. + """ + credit_balance_transaction: Optional[ + ExpandableField["CreditBalanceTransaction"] + ] + """ + The credit balance transaction that was applied to get this pretax credit amount. + """ + discount: Optional[ExpandableField["Discount"]] + """ + The discount that was applied to get this pretax credit amount. + """ + margin: Optional[ExpandableField["Margin"]] + """ + The margin that was applied to get this pretax credit amount. + """ + type: Literal["credit_balance_transaction", "discount"] + """ + Type of the pretax credit amount referenced. + """ + class TotalTaxAmount(StripeObject): amount: int """ @@ -6445,6 +6473,7 @@ class VoidInvoiceParams(RequestOptions): """ The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax. """ + total_pretax_credit_amounts: Optional[List[TotalPretaxCreditAmount]] total_tax_amounts: List[TotalTaxAmount] """ The aggregate amounts calculated per tax rate for all line items. @@ -7811,6 +7840,7 @@ async def list_lines_async( "subscription_details": SubscriptionDetails, "threshold_reason": ThresholdReason, "total_discount_amounts": TotalDiscountAmount, + "total_pretax_credit_amounts": TotalPretaxCreditAmount, "total_tax_amounts": TotalTaxAmount, "transfer_data": TransferData, } diff --git a/stripe/_invoice_line_item.py b/stripe/_invoice_line_item.py index 0985834a8..c81defb72 100644 --- a/stripe/_invoice_line_item.py +++ b/stripe/_invoice_line_item.py @@ -17,11 +17,15 @@ if TYPE_CHECKING: from stripe._discount import Discount from stripe._invoice_item import InvoiceItem + from stripe._margin import Margin from stripe._plan import Plan from stripe._price import Price from stripe._subscription import Subscription from stripe._subscription_item import SubscriptionItem from stripe._tax_rate import TaxRate + from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction, + ) class InvoiceLineItem(UpdateableAPIResource["InvoiceLineItem"]): @@ -53,6 +57,30 @@ class Period(StripeObject): The start of the period. This value is inclusive. """ + class PretaxCreditAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the pretax credit amount. + """ + credit_balance_transaction: Optional[ + ExpandableField["CreditBalanceTransaction"] + ] + """ + The credit balance transaction that was applied to get this pretax credit amount. + """ + discount: Optional[ExpandableField["Discount"]] + """ + The discount that was applied to get this pretax credit amount. + """ + margin: Optional[ExpandableField["Margin"]] + """ + The margin that was applied to get this pretax credit amount. + """ + type: Literal["credit_balance_transaction", "discount"] + """ + Type of the pretax credit amount referenced. + """ + class ProrationDetails(StripeObject): class CreditedItems(StripeObject): invoice: str @@ -362,6 +390,7 @@ class ModifyParamsTaxAmountTaxRateData(TypedDict): """ The plan of the subscription, if the line item is a subscription or a proration. """ + pretax_credit_amounts: Optional[List[PretaxCreditAmount]] price: Optional["Price"] """ The price of the line item. @@ -446,6 +475,7 @@ async def modify_async( _inner_class_types = { "discount_amounts": DiscountAmount, "period": Period, + "pretax_credit_amounts": PretaxCreditAmount, "proration_details": ProrationDetails, "tax_amounts": TaxAmount, } diff --git a/stripe/_margin.py b/stripe/_margin.py new file mode 100644 index 000000000..949e35f9b --- /dev/null +++ b/stripe/_margin.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar, Dict, Optional +from typing_extensions import Literal + + +class Margin(StripeObject): + """ + A (partner) margin represents a specific discount distributed in partner reseller programs to business partners who + resell products and services and earn a discount (margin) for doing so. + """ + + OBJECT_NAME: ClassVar[Literal["margin"]] = "margin" + active: bool + """ + Whether the margin can be applied to invoices, invoice items, or invoice line items. Defaults to `true`. + """ + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + id: str + """ + Unique identifier for the object. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + metadata: Optional[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + """ + name: Optional[str] + """ + Name of the margin that's displayed on, for example, invoices. + """ + object: Literal["margin"] + """ + String representing the object's type. Objects of the same type share the same value. + """ + percent_off: float + """ + Percent that will be taken off the subtotal before tax (after all other discounts and promotions) of any invoice to which the margin is applied. + """ + updated: int + """ + Time at which the object was last updated. Measured in seconds since the Unix epoch. + """ diff --git a/stripe/_multipart_data_generator.py b/stripe/_multipart_data_generator.py index 3151df83e..1e0be2ba1 100644 --- a/stripe/_multipart_data_generator.py +++ b/stripe/_multipart_data_generator.py @@ -19,7 +19,7 @@ def __init__(self, chunk_size: int = 1028): def add_params(self, params): # Flatten parameters first - params = dict(_api_encode(params)) + params = dict(_api_encode(params, "V1")) for key, value in params.items(): if value is None: diff --git a/stripe/_oauth.py b/stripe/_oauth.py index c2bd478b0..9940bd3ed 100644 --- a/stripe/_oauth.py +++ b/stripe/_oauth.py @@ -315,7 +315,7 @@ def authorize_url( OAuth._set_client_id(params) if "response_type" not in params: params["response_type"] = "code" - query = urlencode(list(_api_encode(params))) + query = urlencode(list(_api_encode(params, "V1"))) url = connect_api_base + path + "?" + query return url diff --git a/stripe/_oauth_service.py b/stripe/_oauth_service.py index 7c24269f5..2a1edc83c 100644 --- a/stripe/_oauth_service.py +++ b/stripe/_oauth_service.py @@ -57,7 +57,7 @@ def authorize_url( self._set_client_id(params) if "response_type" not in params: params["response_type"] = "code" - query = urlencode(list(_api_encode(params))) + query = urlencode(list(_api_encode(params, "V1"))) # connect_api_base will be always set to stripe.DEFAULT_CONNECT_API_BASE # if it is not overridden on the client explicitly. diff --git a/stripe/_object_classes.py b/stripe/_object_classes.py index 083d02566..fb0a0ba5b 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -22,6 +22,9 @@ stripe.billing_portal.Session.OBJECT_NAME: stripe.billing_portal.Session, stripe.billing.Alert.OBJECT_NAME: stripe.billing.Alert, stripe.billing.AlertTriggered.OBJECT_NAME: stripe.billing.AlertTriggered, + stripe.billing.CreditBalanceSummary.OBJECT_NAME: stripe.billing.CreditBalanceSummary, + stripe.billing.CreditBalanceTransaction.OBJECT_NAME: stripe.billing.CreditBalanceTransaction, + stripe.billing.CreditGrant.OBJECT_NAME: stripe.billing.CreditGrant, stripe.billing.Meter.OBJECT_NAME: stripe.billing.Meter, stripe.billing.MeterEvent.OBJECT_NAME: stripe.billing.MeterEvent, stripe.billing.MeterEventAdjustment.OBJECT_NAME: stripe.billing.MeterEventAdjustment, @@ -78,6 +81,7 @@ stripe.LineItem.OBJECT_NAME: stripe.LineItem, stripe.LoginLink.OBJECT_NAME: stripe.LoginLink, stripe.Mandate.OBJECT_NAME: stripe.Mandate, + stripe.Margin.OBJECT_NAME: stripe.Margin, stripe.PaymentIntent.OBJECT_NAME: stripe.PaymentIntent, stripe.PaymentLink.OBJECT_NAME: stripe.PaymentLink, stripe.PaymentMethod.OBJECT_NAME: stripe.PaymentMethod, @@ -144,3 +148,12 @@ stripe.WebhookEndpoint.OBJECT_NAME: stripe.WebhookEndpoint, # Object classes: The end of the section generated from our OpenAPI spec } + +V2_OBJECT_CLASSES = { + # V2 Object classes: The beginning of the section generated from our OpenAPI spec + stripe.v2.billing.MeterEvent.OBJECT_NAME: stripe.v2.billing.MeterEvent, + stripe.v2.billing.MeterEventAdjustment.OBJECT_NAME: stripe.v2.billing.MeterEventAdjustment, + stripe.v2.billing.MeterEventSession.OBJECT_NAME: stripe.v2.billing.MeterEventSession, + stripe.v2.Event.OBJECT_NAME: stripe.v2.Event, + # V2 Object classes: The end of the section generated from our OpenAPI spec +} diff --git a/stripe/_product.py b/stripe/_product.py index ea3cda794..4bda6d1ca 100644 --- a/stripe/_product.py +++ b/stripe/_product.py @@ -176,6 +176,12 @@ class CreateParamsDefaultPriceData(TypedDict): """ Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). """ + custom_unit_amount: NotRequired[ + "Product.CreateParamsDefaultPriceDataCustomUnitAmount" + ] + """ + When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. + """ recurring: NotRequired["Product.CreateParamsDefaultPriceDataRecurring"] """ The recurring components of a price such as `interval` and `interval_count`. @@ -188,7 +194,7 @@ class CreateParamsDefaultPriceData(TypedDict): """ unit_amount: NotRequired[int] """ - A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. + A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount`, `unit_amount_decimal`, or `custom_unit_amount` is required. """ unit_amount_decimal: NotRequired[str] """ @@ -265,6 +271,24 @@ class CreateParamsDefaultPriceDataCurrencyOptionsTier(TypedDict): Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use `inf` to define a fallback tier. """ + class CreateParamsDefaultPriceDataCustomUnitAmount(TypedDict): + enabled: bool + """ + Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. + """ + maximum: NotRequired[int] + """ + The maximum unit amount the customer can specify for this item. + """ + minimum: NotRequired[int] + """ + The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. + """ + preset: NotRequired[int] + """ + The starting unit amount which can be updated by the customer. + """ + class CreateParamsDefaultPriceDataRecurring(TypedDict): interval: Literal["day", "month", "week", "year"] """ diff --git a/stripe/_product_service.py b/stripe/_product_service.py index 817c190b6..3e1b632c2 100644 --- a/stripe/_product_service.py +++ b/stripe/_product_service.py @@ -105,6 +105,12 @@ class CreateParamsDefaultPriceData(TypedDict): """ Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). """ + custom_unit_amount: NotRequired[ + "ProductService.CreateParamsDefaultPriceDataCustomUnitAmount" + ] + """ + When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. + """ recurring: NotRequired[ "ProductService.CreateParamsDefaultPriceDataRecurring" ] @@ -119,7 +125,7 @@ class CreateParamsDefaultPriceData(TypedDict): """ unit_amount: NotRequired[int] """ - A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. + A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount`, `unit_amount_decimal`, or `custom_unit_amount` is required. """ unit_amount_decimal: NotRequired[str] """ @@ -198,6 +204,24 @@ class CreateParamsDefaultPriceDataCurrencyOptionsTier(TypedDict): Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use `inf` to define a fallback tier. """ + class CreateParamsDefaultPriceDataCustomUnitAmount(TypedDict): + enabled: bool + """ + Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. + """ + maximum: NotRequired[int] + """ + The maximum unit amount the customer can specify for this item. + """ + minimum: NotRequired[int] + """ + The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. + """ + preset: NotRequired[int] + """ + The starting unit amount which can be updated by the customer. + """ + class CreateParamsDefaultPriceDataRecurring(TypedDict): interval: Literal["day", "month", "week", "year"] """ diff --git a/stripe/_promotion_code.py b/stripe/_promotion_code.py index 13fb3c528..e11786c09 100644 --- a/stripe/_promotion_code.py +++ b/stripe/_promotion_code.py @@ -67,7 +67,9 @@ class CreateParams(RequestOptions): """ code: NotRequired[str] """ - The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically. + The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), and digits (0-9). + + If left blank, we will generate one automatically. """ coupon: str """ @@ -224,7 +226,7 @@ class RetrieveParams(RequestOptions): """ code: str """ - The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. + The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), and digits (0-9). """ coupon: "Coupon" """ diff --git a/stripe/_promotion_code_service.py b/stripe/_promotion_code_service.py index b3eeed7b3..4da95a810 100644 --- a/stripe/_promotion_code_service.py +++ b/stripe/_promotion_code_service.py @@ -17,7 +17,9 @@ class CreateParams(TypedDict): """ code: NotRequired[str] """ - The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically. + The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), and digits (0-9). + + If left blank, we will generate one automatically. """ coupon: str """ diff --git a/stripe/_request_options.py b/stripe/_request_options.py index caa26fa50..e97cf1e1c 100644 --- a/stripe/_request_options.py +++ b/stripe/_request_options.py @@ -7,6 +7,7 @@ class RequestOptions(TypedDict): api_key: NotRequired["str|None"] stripe_version: NotRequired["str|None"] stripe_account: NotRequired["str|None"] + stripe_context: NotRequired["str|None"] max_network_retries: NotRequired["int|None"] idempotency_key: NotRequired["str|None"] content_type: NotRequired["str|None"] @@ -25,6 +26,7 @@ def merge_options( return { "api_key": requestor.api_key, "stripe_account": requestor.stripe_account, + "stripe_context": requestor.stripe_context, "stripe_version": requestor.stripe_version, "max_network_retries": requestor.max_network_retries, "idempotency_key": None, @@ -36,6 +38,8 @@ def merge_options( "api_key": request.get("api_key") or requestor.api_key, "stripe_account": request.get("stripe_account") or requestor.stripe_account, + "stripe_context": request.get("stripe_context") + or requestor.stripe_context, "stripe_version": request.get("stripe_version") or requestor.stripe_version, "max_network_retries": request.get("max_network_retries") @@ -62,6 +66,7 @@ def extract_options_from_dict( "api_key", "stripe_version", "stripe_account", + "stripe_context", "max_network_retries", "idempotency_key", "content_type", diff --git a/stripe/_requestor_options.py b/stripe/_requestor_options.py index 1314a8a71..6f8ebb328 100644 --- a/stripe/_requestor_options.py +++ b/stripe/_requestor_options.py @@ -8,6 +8,7 @@ class RequestorOptions(object): api_key: Optional[str] stripe_account: Optional[str] + stripe_context: Optional[str] stripe_version: Optional[str] base_addresses: BaseAddresses max_network_retries: Optional[int] @@ -16,12 +17,14 @@ def __init__( self, api_key: Optional[str] = None, stripe_account: Optional[str] = None, + stripe_context: Optional[str] = None, stripe_version: Optional[str] = None, base_addresses: BaseAddresses = {}, max_network_retries: Optional[int] = None, ): self.api_key = api_key self.stripe_account = stripe_account + self.stripe_context = stripe_context self.stripe_version = stripe_version self.base_addresses = {} @@ -33,6 +36,10 @@ def __init__( self.base_addresses["connect"] = base_addresses.get("connect") if base_addresses.get("files") is not None: self.base_addresses["files"] = base_addresses.get("files") + if base_addresses.get("meter_events") is not None: + self.base_addresses["meter_events"] = base_addresses.get( + "meter_events" + ) self.max_network_retries = max_network_retries @@ -43,6 +50,7 @@ def to_dict(self): return { "api_key": self.api_key, "stripe_account": self.stripe_account, + "stripe_context": self.stripe_context, "stripe_version": self.stripe_version, "base_addresses": self.base_addresses, "max_network_retries": self.max_network_retries, @@ -59,6 +67,7 @@ def base_addresses(self): "api": stripe.api_base, "connect": stripe.connect_api_base, "files": stripe.upload_api_base, + "meter_events": stripe.meter_events_api_base, } @property @@ -73,6 +82,10 @@ def stripe_version(self): def stripe_account(self): return None + @property + def stripe_context(self): + return None + @property def max_network_retries(self): return stripe.max_network_retries diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index 8f52c2da8..661c018b1 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -7,10 +7,13 @@ DEFAULT_API_BASE, DEFAULT_CONNECT_API_BASE, DEFAULT_UPLOAD_API_BASE, + DEFAULT_METER_EVENTS_API_BASE, ) +from stripe._api_mode import ApiMode from stripe._error import AuthenticationError from stripe._api_requestor import _APIRequestor +from stripe._request_options import extract_options_from_dict from stripe._requestor_options import RequestorOptions, BaseAddresses from stripe._client_options import _ClientOptions from stripe._http_client import ( @@ -19,10 +22,14 @@ new_http_client_async_fallback, ) from stripe._api_version import _ApiVersion +from stripe._stripe_object import StripeObject +from stripe._stripe_response import StripeResponse +from stripe._util import _convert_to_stripe_object, get_api_mode from stripe._webhook import Webhook, WebhookSignature from stripe._event import Event +from stripe.v2._event import ThinEvent -from typing import Optional, Union, cast +from typing import Any, Dict, Optional, Union, cast # Non-generated services from stripe._oauth_service import OAuthService @@ -100,6 +107,7 @@ from stripe._transfer_service import TransferService from stripe._treasury_service import TreasuryService from stripe._webhook_endpoint_service import WebhookEndpointService +from stripe._v2_services import V2Services # services: The end of the section generated from our OpenAPI spec @@ -109,6 +117,7 @@ def __init__( api_key: str, *, stripe_account: Optional[str] = None, + stripe_context: Optional[str] = None, stripe_version: Optional[str] = None, base_addresses: BaseAddresses = {}, client_id: Optional[str] = None, @@ -140,12 +149,14 @@ def __init__( "api": DEFAULT_API_BASE, "connect": DEFAULT_CONNECT_API_BASE, "files": DEFAULT_UPLOAD_API_BASE, + "meter_events": DEFAULT_METER_EVENTS_API_BASE, **base_addresses, } requestor_options = RequestorOptions( api_key=api_key, stripe_account=stripe_account, + stripe_context=stripe_context, stripe_version=stripe_version or _ApiVersion.CURRENT, base_addresses=base_addresses, max_network_retries=max_network_retries, @@ -252,9 +263,27 @@ def __init__( self.transfers = TransferService(self._requestor) self.treasury = TreasuryService(self._requestor) self.webhook_endpoints = WebhookEndpointService(self._requestor) + self.v2 = V2Services(self._requestor) # top-level services: The end of the section generated from our OpenAPI spec - def construct_event( + def parse_thin_event( + self, + raw: Union[bytes, str, bytearray], + sig_header: str, + secret: str, + tolerance: int = Webhook.DEFAULT_TOLERANCE, + ) -> ThinEvent: + payload = ( + cast(Union[bytes, bytearray], raw).decode("utf-8") + if hasattr(raw, "decode") + else cast(str, raw) + ) + + WebhookSignature.verify_header(payload, sig_header, secret, tolerance) + + return ThinEvent(payload) + + def parse_snapshot_event( self, payload: Union[bytes, str], sig_header: str, @@ -274,3 +303,68 @@ def construct_event( ) return event + + def raw_request(self, method_: str, url_: str, **params): + params = params.copy() + options, params = extract_options_from_dict(params) + api_mode = get_api_mode(url_) + base_address = params.pop("base", "api") + + stripe_context = params.pop("stripe_context", None) + + # stripe-context goes *here* and not in api_requestor. Properties + # go on api_requestor when you want them to persist onto requests + # made when you call instance methods on APIResources that come from + # the first request. No need for that here, as we aren't deserializing APIResources + if stripe_context is not None: + options["headers"] = options.get("headers", {}) + assert isinstance(options["headers"], dict) + options["headers"].update({"Stripe-Context": stripe_context}) + + rbody, rcode, rheaders = self._requestor.request_raw( + method_, + url_, + params=params, + options=options, + base_address=base_address, + api_mode=api_mode, + usage=["raw_request"], + ) + + return self._requestor._interpret_response( + rbody, rcode, rheaders, api_mode + ) + + async def raw_request_async(self, method_: str, url_: str, **params): + params = params.copy() + options, params = extract_options_from_dict(params) + api_mode = get_api_mode(url_) + base_address = params.pop("base", "api") + + rbody, rcode, rheaders = await self._requestor.request_raw_async( + method_, + url_, + params=params, + options=options, + base_address=base_address, + api_mode=api_mode, + usage=["raw_request"], + ) + + return self._requestor._interpret_response( + rbody, rcode, rheaders, api_mode + ) + + def deserialize( + self, + resp: Union[StripeResponse, Dict[str, Any]], + params: Optional[Dict[str, Any]] = None, + *, + api_mode: ApiMode, + ) -> StripeObject: + return _convert_to_stripe_object( + resp=resp, + params=params, + requestor=self._requestor, + api_mode=api_mode, + ) diff --git a/stripe/_stripe_object.py b/stripe/_stripe_object.py index 2cc00104d..e8fd042e6 100644 --- a/stripe/_stripe_object.py +++ b/stripe/_stripe_object.py @@ -81,8 +81,6 @@ class StripeObject(Dict[str, Any]): class _ReprJSONEncoder(json.JSONEncoder): def default(self, o: Any) -> Any: if isinstance(o, datetime.datetime): - # pyright complains that _encode_datetime is "private", but it's - # private to outsiders, not to stripe_object return _encode_datetime(o) return super(StripeObject._ReprJSONEncoder, self).default(o) diff --git a/stripe/_subscription.py b/stripe/_subscription.py index ad418161e..93c9edeb6 100644 --- a/stripe/_subscription.py +++ b/stripe/_subscription.py @@ -2270,11 +2270,11 @@ def _cls_cancel( **params: Unpack["Subscription.CancelParams"], ) -> "Subscription": """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ return cast( "Subscription", @@ -2296,11 +2296,11 @@ def cancel( **params: Unpack["Subscription.CancelParams"], ) -> "Subscription": """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ ... @@ -2309,11 +2309,11 @@ def cancel( self, **params: Unpack["Subscription.CancelParams"] ) -> "Subscription": """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ ... @@ -2322,11 +2322,11 @@ def cancel( # pyright: ignore[reportGeneralTypeIssues] self, **params: Unpack["Subscription.CancelParams"] ) -> "Subscription": """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ return cast( "Subscription", @@ -2346,11 +2346,11 @@ async def _cls_cancel_async( **params: Unpack["Subscription.CancelParams"], ) -> "Subscription": """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ return cast( "Subscription", @@ -2372,11 +2372,11 @@ async def cancel_async( **params: Unpack["Subscription.CancelParams"], ) -> "Subscription": """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ ... @@ -2385,11 +2385,11 @@ async def cancel_async( self, **params: Unpack["Subscription.CancelParams"] ) -> "Subscription": """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ ... @@ -2398,11 +2398,11 @@ async def cancel_async( # pyright: ignore[reportGeneralTypeIssues] self, **params: Unpack["Subscription.CancelParams"] ) -> "Subscription": """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ return cast( "Subscription", diff --git a/stripe/_subscription_service.py b/stripe/_subscription_service.py index e034f9751..adad3f820 100644 --- a/stripe/_subscription_service.py +++ b/stripe/_subscription_service.py @@ -1647,11 +1647,11 @@ def cancel( options: RequestOptions = {}, ) -> Subscription: """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ return cast( Subscription, @@ -1675,11 +1675,11 @@ async def cancel_async( options: RequestOptions = {}, ) -> Subscription: """ - Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). - Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. - By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. """ return cast( Subscription, diff --git a/stripe/_util.py b/stripe/_util.py index 6458d70a7..2ef97e7c2 100644 --- a/stripe/_util.py +++ b/stripe/_util.py @@ -192,8 +192,19 @@ def secure_compare(val1, val2): return result == 0 -def get_object_classes(): +def get_thin_event_classes(): + from stripe.events._event_classes import THIN_EVENT_CLASSES + + return THIN_EVENT_CLASSES + + +def get_object_classes(api_mode): # This is here to avoid a circular dependency + if api_mode == "V2": + from stripe._object_classes import V2_OBJECT_CLASSES + + return V2_OBJECT_CLASSES + from stripe._object_classes import OBJECT_CLASSES return OBJECT_CLASSES @@ -310,7 +321,20 @@ def _convert_to_stripe_object( resp = resp.copy() klass_name = resp.get("object") if isinstance(klass_name, str): - klass = get_object_classes().get(klass_name, StripeObject) + if api_mode == "V2" and klass_name == "v2.core.event": + event_name = resp.get("type", "") + klass = get_thin_event_classes().get( + event_name, stripe.StripeObject + ) + else: + klass = get_object_classes(api_mode).get( + klass_name, stripe.StripeObject + ) + # TODO: this is a horrible hack. The API needs + # to return something for `object` here. + + elif "data" in resp and "next_page_url" in resp: + klass = stripe.v2.ListObject elif klass_ is not None: klass = klass_ else: @@ -393,6 +417,13 @@ def sanitize_id(id): return quotedId +def get_api_mode(url): + if url.startswith("/v2"): + return "V2" + else: + return "V1" + + class class_method_variant(object): def __init__(self, class_method_name): self.class_method_name = class_method_name diff --git a/stripe/_v2_services.py b/stripe/_v2_services.py new file mode 100644 index 000000000..93e3e7064 --- /dev/null +++ b/stripe/_v2_services.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_service import StripeService +from stripe.v2._billing_service import BillingService +from stripe.v2._core_service import CoreService + + +class V2Services(StripeService): + def __init__(self, requestor): + super().__init__(requestor) + self.billing = BillingService(self._requestor) + self.core = CoreService(self._requestor) diff --git a/stripe/_webhook_endpoint.py b/stripe/_webhook_endpoint.py index 9fc7bcb79..bd4140848 100644 --- a/stripe/_webhook_endpoint.py +++ b/stripe/_webhook_endpoint.py @@ -134,6 +134,7 @@ class CreateParams(RequestOptions): "2023-10-16", "2024-04-10", "2024-06-20", + "2024-09-30.acacia", ] ] """ diff --git a/stripe/_webhook_endpoint_service.py b/stripe/_webhook_endpoint_service.py index 2acb57b8c..c29a6db8c 100644 --- a/stripe/_webhook_endpoint_service.py +++ b/stripe/_webhook_endpoint_service.py @@ -115,6 +115,7 @@ class CreateParams(TypedDict): "2023-10-16", "2024-04-10", "2024-06-20", + "2024-09-30.acacia", ] ] """ diff --git a/stripe/api_resources/__init__.py b/stripe/api_resources/__init__.py index 99bf65826..d142b58af 100644 --- a/stripe/api_resources/__init__.py +++ b/stripe/api_resources/__init__.py @@ -85,6 +85,7 @@ from stripe.api_resources.list_object import ListObject from stripe.api_resources.login_link import LoginLink from stripe.api_resources.mandate import Mandate + from stripe.api_resources.margin import Margin from stripe.api_resources.payment_intent import PaymentIntent from stripe.api_resources.payment_link import PaymentLink from stripe.api_resources.payment_method import PaymentMethod diff --git a/stripe/api_resources/billing/__init__.py b/stripe/api_resources/billing/__init__.py index e469ff8d7..3375658a4 100644 --- a/stripe/api_resources/billing/__init__.py +++ b/stripe/api_resources/billing/__init__.py @@ -18,6 +18,13 @@ if not TYPE_CHECKING: from stripe.api_resources.billing.alert import Alert from stripe.api_resources.billing.alert_triggered import AlertTriggered + from stripe.api_resources.billing.credit_balance_summary import ( + CreditBalanceSummary, + ) + from stripe.api_resources.billing.credit_balance_transaction import ( + CreditBalanceTransaction, + ) + from stripe.api_resources.billing.credit_grant import CreditGrant from stripe.api_resources.billing.meter import Meter from stripe.api_resources.billing.meter_event import MeterEvent from stripe.api_resources.billing.meter_event_adjustment import ( diff --git a/stripe/api_resources/billing/credit_balance_summary.py b/stripe/api_resources/billing/credit_balance_summary.py new file mode 100644 index 000000000..48e8754c2 --- /dev/null +++ b/stripe/api_resources/billing/credit_balance_summary.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TYPE_CHECKING +from warnings import warn + +warn( + """ + The stripe.api_resources.billing.credit_balance_summary package is deprecated, please change your + imports to import from stripe.billing directly. + From: + from stripe.api_resources.billing.credit_balance_summary import CreditBalanceSummary + To: + from stripe.billing import CreditBalanceSummary + """, + DeprecationWarning, + stacklevel=2, +) +if not TYPE_CHECKING: + from stripe.billing._credit_balance_summary import ( # noqa + CreditBalanceSummary, + ) diff --git a/stripe/api_resources/billing/credit_balance_transaction.py b/stripe/api_resources/billing/credit_balance_transaction.py new file mode 100644 index 000000000..8797820ad --- /dev/null +++ b/stripe/api_resources/billing/credit_balance_transaction.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TYPE_CHECKING +from warnings import warn + +warn( + """ + The stripe.api_resources.billing.credit_balance_transaction package is deprecated, please change your + imports to import from stripe.billing directly. + From: + from stripe.api_resources.billing.credit_balance_transaction import CreditBalanceTransaction + To: + from stripe.billing import CreditBalanceTransaction + """, + DeprecationWarning, + stacklevel=2, +) +if not TYPE_CHECKING: + from stripe.billing._credit_balance_transaction import ( # noqa + CreditBalanceTransaction, + ) diff --git a/stripe/api_resources/billing/credit_grant.py b/stripe/api_resources/billing/credit_grant.py new file mode 100644 index 000000000..4d50815d7 --- /dev/null +++ b/stripe/api_resources/billing/credit_grant.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TYPE_CHECKING +from warnings import warn + +warn( + """ + The stripe.api_resources.billing.credit_grant package is deprecated, please change your + imports to import from stripe.billing directly. + From: + from stripe.api_resources.billing.credit_grant import CreditGrant + To: + from stripe.billing import CreditGrant + """, + DeprecationWarning, + stacklevel=2, +) +if not TYPE_CHECKING: + from stripe.billing._credit_grant import ( # noqa + CreditGrant, + ) diff --git a/stripe/api_resources/margin.py b/stripe/api_resources/margin.py new file mode 100644 index 000000000..2a94240be --- /dev/null +++ b/stripe/api_resources/margin.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TYPE_CHECKING +from warnings import warn + +warn( + """ + The stripe.api_resources.margin package is deprecated, please change your + imports to import from stripe directly. + From: + from stripe.api_resources.margin import Margin + To: + from stripe import Margin + """, + DeprecationWarning, + stacklevel=2, +) +if not TYPE_CHECKING: + from stripe._margin import ( # noqa + Margin, + ) diff --git a/stripe/billing/__init__.py b/stripe/billing/__init__.py index a6aea1532..29a9770a6 100644 --- a/stripe/billing/__init__.py +++ b/stripe/billing/__init__.py @@ -3,6 +3,22 @@ from stripe.billing._alert import Alert as Alert from stripe.billing._alert_service import AlertService as AlertService from stripe.billing._alert_triggered import AlertTriggered as AlertTriggered +from stripe.billing._credit_balance_summary import ( + CreditBalanceSummary as CreditBalanceSummary, +) +from stripe.billing._credit_balance_summary_service import ( + CreditBalanceSummaryService as CreditBalanceSummaryService, +) +from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction as CreditBalanceTransaction, +) +from stripe.billing._credit_balance_transaction_service import ( + CreditBalanceTransactionService as CreditBalanceTransactionService, +) +from stripe.billing._credit_grant import CreditGrant as CreditGrant +from stripe.billing._credit_grant_service import ( + CreditGrantService as CreditGrantService, +) from stripe.billing._meter import Meter as Meter from stripe.billing._meter_event import MeterEvent as MeterEvent from stripe.billing._meter_event_adjustment import ( diff --git a/stripe/billing/_alert.py b/stripe/billing/_alert.py index 02aecb7da..0141ba0e7 100644 --- a/stripe/billing/_alert.py +++ b/stripe/billing/_alert.py @@ -28,13 +28,18 @@ class Alert(CreateableAPIResource["Alert"], ListableAPIResource["Alert"]): OBJECT_NAME: ClassVar[Literal["billing.alert"]] = "billing.alert" - class Filter(StripeObject): - customer: Optional[ExpandableField["Customer"]] + class UsageThreshold(StripeObject): + class Filter(StripeObject): + customer: Optional[ExpandableField["Customer"]] + """ + Limit the scope of the alert to this customer ID + """ + type: Literal["customer"] + + filters: Optional[List[Filter]] """ - Limit the scope of the alert to this customer ID + The filters allow limiting the scope of this usage alert. You can only specify up to one filter at this time. """ - - class UsageThresholdConfig(StripeObject): gte: int """ The value at which this alert will trigger. @@ -47,6 +52,7 @@ class UsageThresholdConfig(StripeObject): """ Defines how the alert will behave. """ + _inner_class_types = {"filters": Filter} class ActivateParams(RequestOptions): expand: NotRequired[List[str]] @@ -69,36 +75,20 @@ class CreateParams(RequestOptions): """ Specifies which fields in the response should be expanded. """ - filter: NotRequired["Alert.CreateParamsFilter"] - """ - Filters to limit the scope of an alert. - """ title: str """ The title of the alert. """ - usage_threshold_config: NotRequired[ - "Alert.CreateParamsUsageThresholdConfig" - ] + usage_threshold: NotRequired["Alert.CreateParamsUsageThreshold"] """ The configuration of the usage threshold. """ - class CreateParamsFilter(TypedDict): - customer: NotRequired[str] - """ - Limit the scope to this alert only to this customer. - """ - subscription: NotRequired[str] - """ - Limit the scope of this rated usage alert to this subscription. - """ - subscription_item: NotRequired[str] + class CreateParamsUsageThreshold(TypedDict): + filters: NotRequired[List["Alert.CreateParamsUsageThresholdFilter"]] """ - Limit the scope of this rated usage alert to this subscription item. + The filters allows limiting the scope of this usage alert. You can only specify up to one filter at this time. """ - - class CreateParamsUsageThresholdConfig(TypedDict): gte: int """ Defines at which value the alert will fire. @@ -112,6 +102,16 @@ class CreateParamsUsageThresholdConfig(TypedDict): Whether the alert should only fire only once, or once per billing cycle. """ + class CreateParamsUsageThresholdFilter(TypedDict): + customer: NotRequired[str] + """ + Limit the scope to this usage alert only to this customer. + """ + type: Literal["customer"] + """ + What type of filter is being applied to this usage alert. + """ + class DeactivateParams(RequestOptions): expand: NotRequired[List[str]] """ @@ -154,10 +154,6 @@ class RetrieveParams(RequestOptions): """ Defines the type of the alert. """ - filter: Optional[Filter] - """ - Limits the scope of the alert to a specific [customer](https://stripe.com/docs/api/customers). - """ id: str """ Unique identifier for the object. @@ -178,7 +174,7 @@ class RetrieveParams(RequestOptions): """ Title of the alert. """ - usage_threshold_config: Optional[UsageThresholdConfig] + usage_threshold: Optional[UsageThreshold] """ Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](https://stripe.com/docs/api/billing/meter). """ @@ -587,7 +583,4 @@ async def retrieve_async( await instance.refresh_async() return instance - _inner_class_types = { - "filter": Filter, - "usage_threshold_config": UsageThresholdConfig, - } + _inner_class_types = {"usage_threshold": UsageThreshold} diff --git a/stripe/billing/_alert_service.py b/stripe/billing/_alert_service.py index 39649a26a..457fefda8 100644 --- a/stripe/billing/_alert_service.py +++ b/stripe/billing/_alert_service.py @@ -31,36 +31,22 @@ class CreateParams(TypedDict): """ Specifies which fields in the response should be expanded. """ - filter: NotRequired["AlertService.CreateParamsFilter"] - """ - Filters to limit the scope of an alert. - """ title: str """ The title of the alert. """ - usage_threshold_config: NotRequired[ - "AlertService.CreateParamsUsageThresholdConfig" - ] + usage_threshold: NotRequired["AlertService.CreateParamsUsageThreshold"] """ The configuration of the usage threshold. """ - class CreateParamsFilter(TypedDict): - customer: NotRequired[str] - """ - Limit the scope to this alert only to this customer. - """ - subscription: NotRequired[str] - """ - Limit the scope of this rated usage alert to this subscription. - """ - subscription_item: NotRequired[str] + class CreateParamsUsageThreshold(TypedDict): + filters: NotRequired[ + List["AlertService.CreateParamsUsageThresholdFilter"] + ] """ - Limit the scope of this rated usage alert to this subscription item. + The filters allows limiting the scope of this usage alert. You can only specify up to one filter at this time. """ - - class CreateParamsUsageThresholdConfig(TypedDict): gte: int """ Defines at which value the alert will fire. @@ -74,6 +60,16 @@ class CreateParamsUsageThresholdConfig(TypedDict): Whether the alert should only fire only once, or once per billing cycle. """ + class CreateParamsUsageThresholdFilter(TypedDict): + customer: NotRequired[str] + """ + Limit the scope to this usage alert only to this customer. + """ + type: Literal["customer"] + """ + What type of filter is being applied to this usage alert. + """ + class DeactivateParams(TypedDict): expand: NotRequired[List[str]] """ diff --git a/stripe/billing/_credit_balance_summary.py b/stripe/billing/_credit_balance_summary.py new file mode 100644 index 000000000..d91252dbf --- /dev/null +++ b/stripe/billing/_credit_balance_summary.py @@ -0,0 +1,158 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._expandable_field import ExpandableField +from stripe._request_options import RequestOptions +from stripe._singleton_api_resource import SingletonAPIResource +from stripe._stripe_object import StripeObject +from typing import ClassVar, List, Optional +from typing_extensions import ( + Literal, + NotRequired, + TypedDict, + Unpack, + TYPE_CHECKING, +) + +if TYPE_CHECKING: + from stripe._customer import Customer + + +class CreditBalanceSummary(SingletonAPIResource["CreditBalanceSummary"]): + """ + Indicates the credit balance for credits granted to a customer. + """ + + OBJECT_NAME: ClassVar[Literal["billing.credit_balance_summary"]] = ( + "billing.credit_balance_summary" + ) + + class Balance(StripeObject): + class AvailableBalance(StripeObject): + class Monetary(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount. + """ + + monetary: Optional[Monetary] + """ + The monetary amount. + """ + type: Literal["monetary"] + """ + The type of this amount. We currently only support `monetary` credits. + """ + _inner_class_types = {"monetary": Monetary} + + class LedgerBalance(StripeObject): + class Monetary(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount. + """ + + monetary: Optional[Monetary] + """ + The monetary amount. + """ + type: Literal["monetary"] + """ + The type of this amount. We currently only support `monetary` credits. + """ + _inner_class_types = {"monetary": Monetary} + + available_balance: AvailableBalance + ledger_balance: LedgerBalance + _inner_class_types = { + "available_balance": AvailableBalance, + "ledger_balance": LedgerBalance, + } + + class RetrieveParams(RequestOptions): + customer: str + """ + The customer for which to fetch credit balance summary. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + filter: "CreditBalanceSummary.RetrieveParamsFilter" + """ + The filter criteria for the credit balance summary. + """ + + class RetrieveParamsFilter(TypedDict): + applicability_scope: NotRequired[ + "CreditBalanceSummary.RetrieveParamsFilterApplicabilityScope" + ] + """ + The credit applicability scope for which to fetch balance summary. + """ + credit_grant: NotRequired[str] + """ + The credit grant for which to fetch balance summary. + """ + type: Literal["applicability_scope", "credit_grant"] + """ + Specify the type of this filter. + """ + + class RetrieveParamsFilterApplicabilityScope(TypedDict): + price_type: Literal["metered"] + """ + The price type to which credit grants can apply to. We currently only support `metered` price type. + """ + + balances: List[Balance] + """ + The credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry. + """ + customer: ExpandableField["Customer"] + """ + The customer the balance is for. + """ + 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["billing.credit_balance_summary"] + """ + String representing the object's type. Objects of the same type share the same value. + """ + + @classmethod + def retrieve( + cls, **params: Unpack["CreditBalanceSummary.RetrieveParams"] + ) -> "CreditBalanceSummary": + """ + Retrieves the credit balance summary for a customer + """ + instance = cls(None, **params) + instance.refresh() + return instance + + @classmethod + async def retrieve_async( + cls, **params: Unpack["CreditBalanceSummary.RetrieveParams"] + ) -> "CreditBalanceSummary": + """ + Retrieves the credit balance summary for a customer + """ + instance = cls(None, **params) + await instance.refresh_async() + return instance + + @classmethod + def class_url(cls): + return "/v1/billing/credit_balance_summary" + + _inner_class_types = {"balances": Balance} diff --git a/stripe/billing/_credit_balance_summary_service.py b/stripe/billing/_credit_balance_summary_service.py new file mode 100644 index 000000000..045e093b0 --- /dev/null +++ b/stripe/billing/_credit_balance_summary_service.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from stripe.billing._credit_balance_summary import CreditBalanceSummary +from typing import List, cast +from typing_extensions import Literal, NotRequired, TypedDict + + +class CreditBalanceSummaryService(StripeService): + class RetrieveParams(TypedDict): + customer: str + """ + The customer for which to fetch credit balance summary. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + filter: "CreditBalanceSummaryService.RetrieveParamsFilter" + """ + The filter criteria for the credit balance summary. + """ + + class RetrieveParamsFilter(TypedDict): + applicability_scope: NotRequired[ + "CreditBalanceSummaryService.RetrieveParamsFilterApplicabilityScope" + ] + """ + The credit applicability scope for which to fetch balance summary. + """ + credit_grant: NotRequired[str] + """ + The credit grant for which to fetch balance summary. + """ + type: Literal["applicability_scope", "credit_grant"] + """ + Specify the type of this filter. + """ + + class RetrieveParamsFilterApplicabilityScope(TypedDict): + price_type: Literal["metered"] + """ + The price type to which credit grants can apply to. We currently only support `metered` price type. + """ + + def retrieve( + self, + params: "CreditBalanceSummaryService.RetrieveParams", + options: RequestOptions = {}, + ) -> CreditBalanceSummary: + """ + Retrieves the credit balance summary for a customer + """ + return cast( + CreditBalanceSummary, + self._request( + "get", + "/v1/billing/credit_balance_summary", + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + params: "CreditBalanceSummaryService.RetrieveParams", + options: RequestOptions = {}, + ) -> CreditBalanceSummary: + """ + Retrieves the credit balance summary for a customer + """ + return cast( + CreditBalanceSummary, + await self._request_async( + "get", + "/v1/billing/credit_balance_summary", + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/billing/_credit_balance_transaction.py b/stripe/billing/_credit_balance_transaction.py new file mode 100644 index 000000000..ff8de6bad --- /dev/null +++ b/stripe/billing/_credit_balance_transaction.py @@ -0,0 +1,242 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._expandable_field import ExpandableField +from stripe._list_object import ListObject +from stripe._listable_api_resource import ListableAPIResource +from stripe._request_options import RequestOptions +from stripe._stripe_object import StripeObject +from typing import ClassVar, List, Optional +from typing_extensions import Literal, NotRequired, Unpack, TYPE_CHECKING + +if TYPE_CHECKING: + from stripe._invoice import Invoice + from stripe.billing._credit_grant import CreditGrant + from stripe.test_helpers._test_clock import TestClock + + +class CreditBalanceTransaction( + ListableAPIResource["CreditBalanceTransaction"] +): + """ + A credit balance transaction is a resource representing a transaction (either a credit or a debit) against an existing credit grant. + """ + + OBJECT_NAME: ClassVar[Literal["billing.credit_balance_transaction"]] = ( + "billing.credit_balance_transaction" + ) + + class Credit(StripeObject): + class Amount(StripeObject): + class Monetary(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount. + """ + + monetary: Optional[Monetary] + """ + The monetary amount. + """ + type: Literal["monetary"] + """ + The type of this amount. We currently only support `monetary` credits. + """ + _inner_class_types = {"monetary": Monetary} + + amount: Amount + type: Literal["credits_granted"] + """ + The type of credit transaction. + """ + _inner_class_types = {"amount": Amount} + + class Debit(StripeObject): + class Amount(StripeObject): + class Monetary(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount. + """ + + monetary: Optional[Monetary] + """ + The monetary amount. + """ + type: Literal["monetary"] + """ + The type of this amount. We currently only support `monetary` credits. + """ + _inner_class_types = {"monetary": Monetary} + + class CreditsApplied(StripeObject): + invoice: ExpandableField["Invoice"] + """ + The invoice to which the credits were applied. + """ + invoice_line_item: str + """ + The invoice line item to which the credits were applied. + """ + + amount: Amount + credits_applied: Optional[CreditsApplied] + """ + Details of how the credits were applied to an invoice. Only present if `type` is `credits_applied`. + """ + type: Literal["credits_applied", "credits_expired", "credits_voided"] + """ + The type of debit transaction. + """ + _inner_class_types = { + "amount": Amount, + "credits_applied": CreditsApplied, + } + + class ListParams(RequestOptions): + credit_grant: NotRequired[str] + """ + The credit grant for which to fetch credit balance transactions. + """ + customer: str + """ + The customer for which to fetch credit balance transactions. + """ + ending_before: NotRequired[str] + """ + A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + limit: NotRequired[int] + """ + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + """ + starting_after: NotRequired[str] + """ + A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + """ + + class RetrieveParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + credit: Optional[Credit] + """ + Credit details for this balance transaction. Only present if type is `credit`. + """ + credit_grant: ExpandableField["CreditGrant"] + """ + The credit grant associated with this balance transaction. + """ + debit: Optional[Debit] + """ + Debit details for this balance transaction. Only present if type is `debit`. + """ + effective_at: int + """ + The effective time of this balance transaction. + """ + id: str + """ + Unique identifier for the object. + """ + 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["billing.credit_balance_transaction"] + """ + String representing the object's type. Objects of the same type share the same value. + """ + test_clock: Optional[ExpandableField["TestClock"]] + """ + ID of the test clock this credit balance transaction belongs to. + """ + type: Optional[Literal["credit", "debit"]] + """ + The type of balance transaction (credit or debit). + """ + + @classmethod + def list( + cls, **params: Unpack["CreditBalanceTransaction.ListParams"] + ) -> ListObject["CreditBalanceTransaction"]: + """ + Retrieve a list of credit balance transactions + """ + result = cls._static_request( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + async def list_async( + cls, **params: Unpack["CreditBalanceTransaction.ListParams"] + ) -> ListObject["CreditBalanceTransaction"]: + """ + Retrieve a list of credit balance transactions + """ + result = await cls._static_request_async( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + def retrieve( + cls, + id: str, + **params: Unpack["CreditBalanceTransaction.RetrieveParams"], + ) -> "CreditBalanceTransaction": + """ + Retrieves a credit balance transaction + """ + instance = cls(id, **params) + instance.refresh() + return instance + + @classmethod + async def retrieve_async( + cls, + id: str, + **params: Unpack["CreditBalanceTransaction.RetrieveParams"], + ) -> "CreditBalanceTransaction": + """ + Retrieves a credit balance transaction + """ + instance = cls(id, **params) + await instance.refresh_async() + return instance + + _inner_class_types = {"credit": Credit, "debit": Debit} diff --git a/stripe/billing/_credit_balance_transaction_service.py b/stripe/billing/_credit_balance_transaction_service.py new file mode 100644 index 000000000..102258473 --- /dev/null +++ b/stripe/billing/_credit_balance_transaction_service.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._list_object import ListObject +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from stripe._util import sanitize_id +from stripe.billing._credit_balance_transaction import CreditBalanceTransaction +from typing import List, cast +from typing_extensions import NotRequired, TypedDict + + +class CreditBalanceTransactionService(StripeService): + class ListParams(TypedDict): + credit_grant: NotRequired[str] + """ + The credit grant for which to fetch credit balance transactions. + """ + customer: str + """ + The customer for which to fetch credit balance transactions. + """ + ending_before: NotRequired[str] + """ + A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + limit: NotRequired[int] + """ + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + """ + starting_after: NotRequired[str] + """ + A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + """ + + class RetrieveParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + def list( + self, + params: "CreditBalanceTransactionService.ListParams", + options: RequestOptions = {}, + ) -> ListObject[CreditBalanceTransaction]: + """ + Retrieve a list of credit balance transactions + """ + return cast( + ListObject[CreditBalanceTransaction], + self._request( + "get", + "/v1/billing/credit_balance_transactions", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + params: "CreditBalanceTransactionService.ListParams", + options: RequestOptions = {}, + ) -> ListObject[CreditBalanceTransaction]: + """ + Retrieve a list of credit balance transactions + """ + return cast( + ListObject[CreditBalanceTransaction], + await self._request_async( + "get", + "/v1/billing/credit_balance_transactions", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + id: str, + params: "CreditBalanceTransactionService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> CreditBalanceTransaction: + """ + Retrieves a credit balance transaction + """ + return cast( + CreditBalanceTransaction, + self._request( + "get", + "/v1/billing/credit_balance_transactions/{id}".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + id: str, + params: "CreditBalanceTransactionService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> CreditBalanceTransaction: + """ + Retrieves a credit balance transaction + """ + return cast( + CreditBalanceTransaction, + await self._request_async( + "get", + "/v1/billing/credit_balance_transactions/{id}".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/billing/_credit_grant.py b/stripe/billing/_credit_grant.py new file mode 100644 index 000000000..51858796d --- /dev/null +++ b/stripe/billing/_credit_grant.py @@ -0,0 +1,599 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._createable_api_resource import CreateableAPIResource +from stripe._expandable_field import ExpandableField +from stripe._list_object import ListObject +from stripe._listable_api_resource import ListableAPIResource +from stripe._request_options import RequestOptions +from stripe._stripe_object import StripeObject +from stripe._updateable_api_resource import UpdateableAPIResource +from stripe._util import class_method_variant, sanitize_id +from typing import ClassVar, Dict, List, Optional, cast, overload +from typing_extensions import ( + Literal, + NotRequired, + TypedDict, + Unpack, + TYPE_CHECKING, +) + +if TYPE_CHECKING: + from stripe._customer import Customer + from stripe.test_helpers._test_clock import TestClock + + +class CreditGrant( + CreateableAPIResource["CreditGrant"], + ListableAPIResource["CreditGrant"], + UpdateableAPIResource["CreditGrant"], +): + """ + A credit grant is a resource that records a grant of some credit to a customer. + """ + + OBJECT_NAME: ClassVar[Literal["billing.credit_grant"]] = ( + "billing.credit_grant" + ) + + class Amount(StripeObject): + class Monetary(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount. + """ + + monetary: Optional[Monetary] + """ + The monetary amount. + """ + type: Literal["monetary"] + """ + The type of this amount. We currently only support `monetary` credits. + """ + _inner_class_types = {"monetary": Monetary} + + class ApplicabilityConfig(StripeObject): + class Scope(StripeObject): + price_type: Literal["metered"] + """ + The price type to which credit grants can apply to. We currently only support `metered` price type. + """ + + scope: Scope + _inner_class_types = {"scope": Scope} + + class CreateParams(RequestOptions): + amount: "CreditGrant.CreateParamsAmount" + """ + Amount of this credit grant. + """ + applicability_config: "CreditGrant.CreateParamsApplicabilityConfig" + """ + Configuration specifying what this credit grant applies to. + """ + category: Literal["paid", "promotional"] + """ + The category of this credit grant. + """ + customer: str + """ + Id of the customer to whom the credit should be granted. + """ + effective_at: NotRequired[int] + """ + The time when the credit becomes effective i.e when it is eligible to be used. Defaults to the current timestamp if not specified. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + expires_at: NotRequired[int] + """ + The time when the credit will expire. If not specified, the credit will never expire. + """ + metadata: NotRequired[Dict[str, str]] + """ + Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object (ex: cost basis) in a structured format. + """ + name: NotRequired[str] + """ + A descriptive name shown in dashboard and on invoices. + """ + + class CreateParamsAmount(TypedDict): + monetary: NotRequired["CreditGrant.CreateParamsAmountMonetary"] + """ + The monetary amount. + """ + type: Literal["monetary"] + """ + Specify the type of this amount. We currently only support `monetary` credits. + """ + + class CreateParamsAmountMonetary(TypedDict): + currency: str + """ + Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `value` parameter. + """ + value: int + """ + A positive integer representing the amount of the credit grant. + """ + + class CreateParamsApplicabilityConfig(TypedDict): + scope: "CreditGrant.CreateParamsApplicabilityConfigScope" + """ + Specify the scope of this applicability config. + """ + + class CreateParamsApplicabilityConfigScope(TypedDict): + price_type: Literal["metered"] + """ + The price type to which credit grants can apply to. We currently only support `metered` price type. + """ + + class ExpireParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + class ListParams(RequestOptions): + customer: NotRequired[str] + """ + Only return credit grants for this customer. + """ + ending_before: NotRequired[str] + """ + A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + limit: NotRequired[int] + """ + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + """ + starting_after: NotRequired[str] + """ + A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + """ + + class ModifyParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + expires_at: NotRequired["Literal['']|int"] + """ + The time when the credit created by this credit grant will expire. If set to empty, the credit will never expire. + """ + metadata: NotRequired[Dict[str, str]] + """ + Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object (ex: cost basis) in a structured format. + """ + + class RetrieveParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + class VoidGrantParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + amount: Amount + applicability_config: ApplicabilityConfig + category: Literal["paid", "promotional"] + """ + The category of this credit grant. + """ + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + customer: ExpandableField["Customer"] + """ + Id of the customer to whom the credit was granted. + """ + effective_at: Optional[int] + """ + The time when the credit becomes effective i.e when it is eligible to be used. + """ + expires_at: Optional[int] + """ + The time when the credit will expire. If not present, the credit will never expire. + """ + id: str + """ + Unique identifier for the object. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + metadata: Dict[str, str] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + """ + name: Optional[str] + """ + A descriptive name shown in dashboard and on invoices. + """ + object: Literal["billing.credit_grant"] + """ + String representing the object's type. Objects of the same type share the same value. + """ + test_clock: Optional[ExpandableField["TestClock"]] + """ + ID of the test clock this credit grant belongs to. + """ + updated: int + """ + Time at which the object was last updated. Measured in seconds since the Unix epoch. + """ + voided_at: Optional[int] + """ + The time when this credit grant was voided. If not present, the credit grant hasn't been voided. + """ + + @classmethod + def create( + cls, **params: Unpack["CreditGrant.CreateParams"] + ) -> "CreditGrant": + """ + Creates a credit grant + """ + return cast( + "CreditGrant", + cls._static_request( + "post", + cls.class_url(), + params=params, + ), + ) + + @classmethod + async def create_async( + cls, **params: Unpack["CreditGrant.CreateParams"] + ) -> "CreditGrant": + """ + Creates a credit grant + """ + return cast( + "CreditGrant", + await cls._static_request_async( + "post", + cls.class_url(), + params=params, + ), + ) + + @classmethod + def _cls_expire( + cls, id: str, **params: Unpack["CreditGrant.ExpireParams"] + ) -> "CreditGrant": + """ + Expires a credit grant + """ + return cast( + "CreditGrant", + cls._static_request( + "post", + "/v1/billing/credit_grants/{id}/expire".format( + id=sanitize_id(id) + ), + params=params, + ), + ) + + @overload + @staticmethod + def expire( + id: str, **params: Unpack["CreditGrant.ExpireParams"] + ) -> "CreditGrant": + """ + Expires a credit grant + """ + ... + + @overload + def expire( + self, **params: Unpack["CreditGrant.ExpireParams"] + ) -> "CreditGrant": + """ + Expires a credit grant + """ + ... + + @class_method_variant("_cls_expire") + def expire( # pyright: ignore[reportGeneralTypeIssues] + self, **params: Unpack["CreditGrant.ExpireParams"] + ) -> "CreditGrant": + """ + Expires a credit grant + """ + return cast( + "CreditGrant", + self._request( + "post", + "/v1/billing/credit_grants/{id}/expire".format( + id=sanitize_id(self.get("id")) + ), + params=params, + ), + ) + + @classmethod + async def _cls_expire_async( + cls, id: str, **params: Unpack["CreditGrant.ExpireParams"] + ) -> "CreditGrant": + """ + Expires a credit grant + """ + return cast( + "CreditGrant", + await cls._static_request_async( + "post", + "/v1/billing/credit_grants/{id}/expire".format( + id=sanitize_id(id) + ), + params=params, + ), + ) + + @overload + @staticmethod + async def expire_async( + id: str, **params: Unpack["CreditGrant.ExpireParams"] + ) -> "CreditGrant": + """ + Expires a credit grant + """ + ... + + @overload + async def expire_async( + self, **params: Unpack["CreditGrant.ExpireParams"] + ) -> "CreditGrant": + """ + Expires a credit grant + """ + ... + + @class_method_variant("_cls_expire_async") + async def expire_async( # pyright: ignore[reportGeneralTypeIssues] + self, **params: Unpack["CreditGrant.ExpireParams"] + ) -> "CreditGrant": + """ + Expires a credit grant + """ + return cast( + "CreditGrant", + await self._request_async( + "post", + "/v1/billing/credit_grants/{id}/expire".format( + id=sanitize_id(self.get("id")) + ), + params=params, + ), + ) + + @classmethod + def list( + cls, **params: Unpack["CreditGrant.ListParams"] + ) -> ListObject["CreditGrant"]: + """ + Retrieve a list of credit grants + """ + result = cls._static_request( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + async def list_async( + cls, **params: Unpack["CreditGrant.ListParams"] + ) -> ListObject["CreditGrant"]: + """ + Retrieve a list of credit grants + """ + result = await cls._static_request_async( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + def modify( + cls, id: str, **params: Unpack["CreditGrant.ModifyParams"] + ) -> "CreditGrant": + """ + Updates a credit grant + """ + url = "%s/%s" % (cls.class_url(), sanitize_id(id)) + return cast( + "CreditGrant", + cls._static_request( + "post", + url, + params=params, + ), + ) + + @classmethod + async def modify_async( + cls, id: str, **params: Unpack["CreditGrant.ModifyParams"] + ) -> "CreditGrant": + """ + Updates a credit grant + """ + url = "%s/%s" % (cls.class_url(), sanitize_id(id)) + return cast( + "CreditGrant", + await cls._static_request_async( + "post", + url, + params=params, + ), + ) + + @classmethod + def retrieve( + cls, id: str, **params: Unpack["CreditGrant.RetrieveParams"] + ) -> "CreditGrant": + """ + Retrieves a credit grant + """ + instance = cls(id, **params) + instance.refresh() + return instance + + @classmethod + async def retrieve_async( + cls, id: str, **params: Unpack["CreditGrant.RetrieveParams"] + ) -> "CreditGrant": + """ + Retrieves a credit grant + """ + instance = cls(id, **params) + await instance.refresh_async() + return instance + + @classmethod + def _cls_void_grant( + cls, id: str, **params: Unpack["CreditGrant.VoidGrantParams"] + ) -> "CreditGrant": + """ + Voids a credit grant + """ + return cast( + "CreditGrant", + cls._static_request( + "post", + "/v1/billing/credit_grants/{id}/void".format( + id=sanitize_id(id) + ), + params=params, + ), + ) + + @overload + @staticmethod + def void_grant( + id: str, **params: Unpack["CreditGrant.VoidGrantParams"] + ) -> "CreditGrant": + """ + Voids a credit grant + """ + ... + + @overload + def void_grant( + self, **params: Unpack["CreditGrant.VoidGrantParams"] + ) -> "CreditGrant": + """ + Voids a credit grant + """ + ... + + @class_method_variant("_cls_void_grant") + def void_grant( # pyright: ignore[reportGeneralTypeIssues] + self, **params: Unpack["CreditGrant.VoidGrantParams"] + ) -> "CreditGrant": + """ + Voids a credit grant + """ + return cast( + "CreditGrant", + self._request( + "post", + "/v1/billing/credit_grants/{id}/void".format( + id=sanitize_id(self.get("id")) + ), + params=params, + ), + ) + + @classmethod + async def _cls_void_grant_async( + cls, id: str, **params: Unpack["CreditGrant.VoidGrantParams"] + ) -> "CreditGrant": + """ + Voids a credit grant + """ + return cast( + "CreditGrant", + await cls._static_request_async( + "post", + "/v1/billing/credit_grants/{id}/void".format( + id=sanitize_id(id) + ), + params=params, + ), + ) + + @overload + @staticmethod + async def void_grant_async( + id: str, **params: Unpack["CreditGrant.VoidGrantParams"] + ) -> "CreditGrant": + """ + Voids a credit grant + """ + ... + + @overload + async def void_grant_async( + self, **params: Unpack["CreditGrant.VoidGrantParams"] + ) -> "CreditGrant": + """ + Voids a credit grant + """ + ... + + @class_method_variant("_cls_void_grant_async") + async def void_grant_async( # pyright: ignore[reportGeneralTypeIssues] + self, **params: Unpack["CreditGrant.VoidGrantParams"] + ) -> "CreditGrant": + """ + Voids a credit grant + """ + return cast( + "CreditGrant", + await self._request_async( + "post", + "/v1/billing/credit_grants/{id}/void".format( + id=sanitize_id(self.get("id")) + ), + params=params, + ), + ) + + _inner_class_types = { + "amount": Amount, + "applicability_config": ApplicabilityConfig, + } diff --git a/stripe/billing/_credit_grant_service.py b/stripe/billing/_credit_grant_service.py new file mode 100644 index 000000000..011a189fb --- /dev/null +++ b/stripe/billing/_credit_grant_service.py @@ -0,0 +1,381 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._list_object import ListObject +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from stripe._util import sanitize_id +from stripe.billing._credit_grant import CreditGrant +from typing import Dict, List, cast +from typing_extensions import Literal, NotRequired, TypedDict + + +class CreditGrantService(StripeService): + class CreateParams(TypedDict): + amount: "CreditGrantService.CreateParamsAmount" + """ + Amount of this credit grant. + """ + applicability_config: ( + "CreditGrantService.CreateParamsApplicabilityConfig" + ) + """ + Configuration specifying what this credit grant applies to. + """ + category: Literal["paid", "promotional"] + """ + The category of this credit grant. + """ + customer: str + """ + Id of the customer to whom the credit should be granted. + """ + effective_at: NotRequired[int] + """ + The time when the credit becomes effective i.e when it is eligible to be used. Defaults to the current timestamp if not specified. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + expires_at: NotRequired[int] + """ + The time when the credit will expire. If not specified, the credit will never expire. + """ + metadata: NotRequired[Dict[str, str]] + """ + Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object (ex: cost basis) in a structured format. + """ + name: NotRequired[str] + """ + A descriptive name shown in dashboard and on invoices. + """ + + class CreateParamsAmount(TypedDict): + monetary: NotRequired["CreditGrantService.CreateParamsAmountMonetary"] + """ + The monetary amount. + """ + type: Literal["monetary"] + """ + Specify the type of this amount. We currently only support `monetary` credits. + """ + + class CreateParamsAmountMonetary(TypedDict): + currency: str + """ + Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `value` parameter. + """ + value: int + """ + A positive integer representing the amount of the credit grant. + """ + + class CreateParamsApplicabilityConfig(TypedDict): + scope: "CreditGrantService.CreateParamsApplicabilityConfigScope" + """ + Specify the scope of this applicability config. + """ + + class CreateParamsApplicabilityConfigScope(TypedDict): + price_type: Literal["metered"] + """ + The price type to which credit grants can apply to. We currently only support `metered` price type. + """ + + class ExpireParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + class ListParams(TypedDict): + customer: NotRequired[str] + """ + Only return credit grants for this customer. + """ + ending_before: NotRequired[str] + """ + A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + limit: NotRequired[int] + """ + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + """ + starting_after: NotRequired[str] + """ + A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + """ + + class RetrieveParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + class UpdateParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + expires_at: NotRequired["Literal['']|int"] + """ + The time when the credit created by this credit grant will expire. If set to empty, the credit will never expire. + """ + metadata: NotRequired[Dict[str, str]] + """ + Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object (ex: cost basis) in a structured format. + """ + + class VoidGrantParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + def list( + self, + params: "CreditGrantService.ListParams" = {}, + options: RequestOptions = {}, + ) -> ListObject[CreditGrant]: + """ + Retrieve a list of credit grants + """ + return cast( + ListObject[CreditGrant], + self._request( + "get", + "/v1/billing/credit_grants", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + params: "CreditGrantService.ListParams" = {}, + options: RequestOptions = {}, + ) -> ListObject[CreditGrant]: + """ + Retrieve a list of credit grants + """ + return cast( + ListObject[CreditGrant], + await self._request_async( + "get", + "/v1/billing/credit_grants", + base_address="api", + params=params, + options=options, + ), + ) + + def create( + self, + params: "CreditGrantService.CreateParams", + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Creates a credit grant + """ + return cast( + CreditGrant, + self._request( + "post", + "/v1/billing/credit_grants", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "CreditGrantService.CreateParams", + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Creates a credit grant + """ + return cast( + CreditGrant, + await self._request_async( + "post", + "/v1/billing/credit_grants", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + id: str, + params: "CreditGrantService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Retrieves a credit grant + """ + return cast( + CreditGrant, + self._request( + "get", + "/v1/billing/credit_grants/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + id: str, + params: "CreditGrantService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Retrieves a credit grant + """ + return cast( + CreditGrant, + await self._request_async( + "get", + "/v1/billing/credit_grants/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + def update( + self, + id: str, + params: "CreditGrantService.UpdateParams" = {}, + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Updates a credit grant + """ + return cast( + CreditGrant, + self._request( + "post", + "/v1/billing/credit_grants/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + async def update_async( + self, + id: str, + params: "CreditGrantService.UpdateParams" = {}, + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Updates a credit grant + """ + return cast( + CreditGrant, + await self._request_async( + "post", + "/v1/billing/credit_grants/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + def expire( + self, + id: str, + params: "CreditGrantService.ExpireParams" = {}, + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Expires a credit grant + """ + return cast( + CreditGrant, + self._request( + "post", + "/v1/billing/credit_grants/{id}/expire".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def expire_async( + self, + id: str, + params: "CreditGrantService.ExpireParams" = {}, + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Expires a credit grant + """ + return cast( + CreditGrant, + await self._request_async( + "post", + "/v1/billing/credit_grants/{id}/expire".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def void_grant( + self, + id: str, + params: "CreditGrantService.VoidGrantParams" = {}, + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Voids a credit grant + """ + return cast( + CreditGrant, + self._request( + "post", + "/v1/billing/credit_grants/{id}/void".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def void_grant_async( + self, + id: str, + params: "CreditGrantService.VoidGrantParams" = {}, + options: RequestOptions = {}, + ) -> CreditGrant: + """ + Voids a credit grant + """ + return cast( + CreditGrant, + await self._request_async( + "post", + "/v1/billing/credit_grants/{id}/void".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/billing_portal/_configuration.py b/stripe/billing_portal/_configuration.py index 90bc5fbd2..41dd41f34 100644 --- a/stripe/billing_portal/_configuration.py +++ b/stripe/billing_portal/_configuration.py @@ -315,8 +315,8 @@ class CreateParamsFeaturesSubscriptionCancelCancellationReason(TypedDict): """ class CreateParamsFeaturesSubscriptionUpdate(TypedDict): - default_allowed_updates: Union[ - Literal[""], List[Literal["price", "promotion_code", "quantity"]] + default_allowed_updates: NotRequired[ + "Literal['']|List[Literal['price', 'promotion_code', 'quantity']]" ] """ The types of subscription updates that are supported. When empty, subscriptions are not updateable. @@ -325,11 +325,8 @@ class CreateParamsFeaturesSubscriptionUpdate(TypedDict): """ Whether the feature is enabled. """ - products: Union[ - Literal[""], - List[ - "Configuration.CreateParamsFeaturesSubscriptionUpdateProduct" - ], + products: NotRequired[ + "Literal['']|List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]" ] """ The list of up to 10 products that support subscription updates. diff --git a/stripe/billing_portal/_configuration_service.py b/stripe/billing_portal/_configuration_service.py index 7cbc97444..9edf1db04 100644 --- a/stripe/billing_portal/_configuration_service.py +++ b/stripe/billing_portal/_configuration_service.py @@ -153,8 +153,8 @@ class CreateParamsFeaturesSubscriptionCancelCancellationReason(TypedDict): """ class CreateParamsFeaturesSubscriptionUpdate(TypedDict): - default_allowed_updates: Union[ - Literal[""], List[Literal["price", "promotion_code", "quantity"]] + default_allowed_updates: NotRequired[ + "Literal['']|List[Literal['price', 'promotion_code', 'quantity']]" ] """ The types of subscription updates that are supported. When empty, subscriptions are not updateable. @@ -163,11 +163,8 @@ class CreateParamsFeaturesSubscriptionUpdate(TypedDict): """ Whether the feature is enabled. """ - products: Union[ - Literal[""], - List[ - "ConfigurationService.CreateParamsFeaturesSubscriptionUpdateProduct" - ], + products: NotRequired[ + "Literal['']|List[ConfigurationService.CreateParamsFeaturesSubscriptionUpdateProduct]" ] """ The list of up to 10 products that support subscription updates. diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index e6f7ba017..66bbac645 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -2280,7 +2280,7 @@ class CreateParamsLineItem(TypedDict): class CreateParamsLineItemAdjustableQuantity(TypedDict): enabled: bool """ - Set to true if the quantity can be adjusted to any non-negative integer. By default customers will be able to remove the line item by setting the quantity to 0. + Set to true if the quantity can be adjusted to any non-negative integer. """ maximum: NotRequired[int] """ diff --git a/stripe/checkout/_session_service.py b/stripe/checkout/_session_service.py index e1010120d..82d78f1be 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -690,7 +690,7 @@ class CreateParamsLineItem(TypedDict): class CreateParamsLineItemAdjustableQuantity(TypedDict): enabled: bool """ - Set to true if the quantity can be adjusted to any non-negative integer. By default customers will be able to remove the line item by setting the quantity to 0. + Set to true if the quantity can be adjusted to any non-negative integer. """ maximum: NotRequired[int] """ diff --git a/stripe/events/__init__.py b/stripe/events/__init__.py new file mode 100644 index 000000000..bcf79de80 --- /dev/null +++ b/stripe/events/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe.events._v1_billing_meter_error_report_triggered_event import ( + V1BillingMeterErrorReportTriggeredEvent as V1BillingMeterErrorReportTriggeredEvent, +) +from stripe.events._v1_billing_meter_no_meter_found_event import ( + V1BillingMeterNoMeterFoundEvent as V1BillingMeterNoMeterFoundEvent, +) diff --git a/stripe/events/_event_classes.py b/stripe/events/_event_classes.py new file mode 100644 index 000000000..cfbfe23ba --- /dev/null +++ b/stripe/events/_event_classes.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe.events._v1_billing_meter_error_report_triggered_event import ( + V1BillingMeterErrorReportTriggeredEvent, +) +from stripe.events._v1_billing_meter_no_meter_found_event import ( + V1BillingMeterNoMeterFoundEvent, +) + + +THIN_EVENT_CLASSES = { + V1BillingMeterErrorReportTriggeredEvent.LOOKUP_TYPE: V1BillingMeterErrorReportTriggeredEvent, + V1BillingMeterNoMeterFoundEvent.LOOKUP_TYPE: V1BillingMeterNoMeterFoundEvent, +} diff --git a/stripe/events/_v1_billing_meter_error_report_triggered_event.py b/stripe/events/_v1_billing_meter_error_report_triggered_event.py new file mode 100644 index 000000000..f20157177 --- /dev/null +++ b/stripe/events/_v1_billing_meter_error_report_triggered_event.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe.billing._meter import Meter +from stripe.v2._event import Event +from typing import List, cast +from typing_extensions import Literal + + +class V1BillingMeterErrorReportTriggeredEvent(Event): + LOOKUP_TYPE = "v1.billing.meter.error_report_triggered" + type: Literal["v1.billing.meter.error_report_triggered"] + + class V1BillingMeterErrorReportTriggeredEventData(StripeObject): + class Reason(StripeObject): + class ErrorType(StripeObject): + class SampleError(StripeObject): + class Request(StripeObject): + identifier: str + """ + The request idempotency key. + """ + + error_message: str + """ + The error message. + """ + request: Request + """ + The request causes the error. + """ + _inner_class_types = {"request": Request} + + code: Literal[ + "archived_meter", + "meter_event_customer_not_found", + "meter_event_dimension_count_too_high", + "meter_event_invalid_value", + "meter_event_no_customer_defined", + "missing_dimension_payload_keys", + "no_meter", + "timestamp_in_future", + "timestamp_too_far_in_past", + ] + """ + Open Enum. + """ + error_count: int + """ + The number of errors of this type. + """ + sample_errors: List[SampleError] + """ + A list of sample errors of this type. + """ + _inner_class_types = {"sample_errors": SampleError} + + error_count: int + """ + The total error count within this window. + """ + error_types: List[ErrorType] + """ + The error details. + """ + _inner_class_types = {"error_types": ErrorType} + + developer_message_summary: str + """ + Extra field included in the event's `data` when fetched from /v2/events. + """ + reason: Reason + """ + This contains information about why meter error happens. + """ + validation_end: str + """ + The end of the window that is encapsulated by this summary. + """ + validation_start: str + """ + The start of the window that is encapsulated by this summary. + """ + _inner_class_types = {"reason": Reason} + + data: V1BillingMeterErrorReportTriggeredEventData + """ + Data for the v1.billing.meter.error_report_triggered event + """ + + 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) -> Meter: + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + Meter, + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={"stripe_account": self.context}, + ), + ) diff --git a/stripe/events/_v1_billing_meter_no_meter_found_event.py b/stripe/events/_v1_billing_meter_no_meter_found_event.py new file mode 100644 index 000000000..680c094aa --- /dev/null +++ b/stripe/events/_v1_billing_meter_no_meter_found_event.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe.v2._event import Event +from typing import List +from typing_extensions import Literal + + +class V1BillingMeterNoMeterFoundEvent(Event): + LOOKUP_TYPE = "v1.billing.meter.no_meter_found" + type: Literal["v1.billing.meter.no_meter_found"] + + class V1BillingMeterNoMeterFoundEventData(StripeObject): + class Reason(StripeObject): + class ErrorType(StripeObject): + class SampleError(StripeObject): + class Request(StripeObject): + identifier: str + """ + The request idempotency key. + """ + + error_message: str + """ + The error message. + """ + request: Request + """ + The request causes the error. + """ + _inner_class_types = {"request": Request} + + code: Literal[ + "archived_meter", + "meter_event_customer_not_found", + "meter_event_dimension_count_too_high", + "meter_event_invalid_value", + "meter_event_no_customer_defined", + "missing_dimension_payload_keys", + "no_meter", + "timestamp_in_future", + "timestamp_too_far_in_past", + ] + """ + Open Enum. + """ + error_count: int + """ + The number of errors of this type. + """ + sample_errors: List[SampleError] + """ + A list of sample errors of this type. + """ + _inner_class_types = {"sample_errors": SampleError} + + error_count: int + """ + The total error count within this window. + """ + error_types: List[ErrorType] + """ + The error details. + """ + _inner_class_types = {"error_types": ErrorType} + + developer_message_summary: str + """ + Extra field included in the event's `data` when fetched from /v2/events. + """ + reason: Reason + """ + This contains information about why meter error happens. + """ + validation_end: str + """ + The end of the window that is encapsulated by this summary. + """ + validation_start: str + """ + The start of the window that is encapsulated by this summary. + """ + _inner_class_types = {"reason": Reason} + + data: V1BillingMeterNoMeterFoundEventData + """ + Data for the v1.billing.meter.no_meter_found event + """ diff --git a/stripe/tax/_settings.py b/stripe/tax/_settings.py index c8454342a..c8e64bdd4 100644 --- a/stripe/tax/_settings.py +++ b/stripe/tax/_settings.py @@ -155,7 +155,7 @@ class RetrieveParams(RequestOptions): """ status: Literal["active", "pending"] """ - The `active` status indicates you have all required settings to calculate tax. A status can transition out of `active` when new required settings are introduced. + The status of the Tax `Settings`. """ status_details: StatusDetails diff --git a/stripe/terminal/_reader.py b/stripe/terminal/_reader.py index 6d7553865..c8bcaf97a 100644 --- a/stripe/terminal/_reader.py +++ b/stripe/terminal/_reader.py @@ -376,6 +376,12 @@ class ProcessPaymentIntentParams(RequestOptions): """ class ProcessPaymentIntentParamsProcessConfig(TypedDict): + allow_redisplay: NotRequired[ + Literal["always", "limited", "unspecified"] + ] + """ + This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. + """ enable_customer_cancellation: NotRequired[bool] """ Enables cancel button on transaction screens. @@ -398,9 +404,9 @@ class ProcessPaymentIntentParamsProcessConfigTipping(TypedDict): """ class ProcessSetupIntentParams(RequestOptions): - customer_consent_collected: NotRequired[bool] + allow_redisplay: Literal["always", "limited", "unspecified"] """ - Customer Consent Collected + This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. """ expand: NotRequired[List[str]] """ diff --git a/stripe/terminal/_reader_service.py b/stripe/terminal/_reader_service.py index 362d89162..271a9701f 100644 --- a/stripe/terminal/_reader_service.py +++ b/stripe/terminal/_reader_service.py @@ -103,6 +103,12 @@ class ProcessPaymentIntentParams(TypedDict): """ class ProcessPaymentIntentParamsProcessConfig(TypedDict): + allow_redisplay: NotRequired[ + Literal["always", "limited", "unspecified"] + ] + """ + This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. + """ enable_customer_cancellation: NotRequired[bool] """ Enables cancel button on transaction screens. @@ -125,9 +131,9 @@ class ProcessPaymentIntentParamsProcessConfigTipping(TypedDict): """ class ProcessSetupIntentParams(TypedDict): - customer_consent_collected: NotRequired[bool] + allow_redisplay: Literal["always", "limited", "unspecified"] """ - Customer Consent Collected + This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. """ expand: NotRequired[List[str]] """ diff --git a/stripe/treasury/_received_credit.py b/stripe/treasury/_received_credit.py index 2e67c2832..702c42b91 100644 --- a/stripe/treasury/_received_credit.py +++ b/stripe/treasury/_received_credit.py @@ -317,7 +317,12 @@ class RetrieveParams(RequestOptions): An arbitrary string attached to the object. Often useful for displaying to users. """ failure_code: Optional[ - Literal["account_closed", "account_frozen", "other"] + Literal[ + "account_closed", + "account_frozen", + "international_transaction", + "other", + ] ] """ Reason for the failure. A ReceivedCredit might fail because the receiving FinancialAccount is closed or frozen. diff --git a/stripe/v2/__init__.py b/stripe/v2/__init__.py new file mode 100644 index 000000000..d8a2170e1 --- /dev/null +++ b/stripe/v2/__init__.py @@ -0,0 +1,10 @@ +from stripe.v2._list_object import ListObject as ListObject +from stripe.v2._amount import Amount as Amount, AmountParam as AmountParam + + +# The beginning of the section generated from our OpenAPI spec +from stripe.v2 import billing as billing, core as core +from stripe.v2._billing_service import BillingService as BillingService +from stripe.v2._core_service import CoreService as CoreService +from stripe.v2._event import Event as Event +# The end of the section generated from our OpenAPI spec diff --git a/stripe/v2/_amount.py b/stripe/v2/_amount.py new file mode 100644 index 000000000..97a6bf63a --- /dev/null +++ b/stripe/v2/_amount.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# NOT codegenned +from typing_extensions import TypedDict +from stripe._stripe_object import StripeObject + + +class Amount(StripeObject): + value: int + currency: str + + +class AmountParam(TypedDict): + value: int + currency: str diff --git a/stripe/v2/_billing_service.py b/stripe/v2/_billing_service.py new file mode 100644 index 000000000..77d36d39a --- /dev/null +++ b/stripe/v2/_billing_service.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_service import StripeService +from stripe.v2.billing._meter_event_adjustment_service import ( + MeterEventAdjustmentService, +) +from stripe.v2.billing._meter_event_service import MeterEventService +from stripe.v2.billing._meter_event_session_service import ( + MeterEventSessionService, +) +from stripe.v2.billing._meter_event_stream_service import ( + MeterEventStreamService, +) + + +class BillingService(StripeService): + def __init__(self, requestor): + super().__init__(requestor) + self.meter_event_session = MeterEventSessionService(self._requestor) + self.meter_event_adjustments = MeterEventAdjustmentService( + self._requestor, + ) + self.meter_event_stream = MeterEventStreamService(self._requestor) + self.meter_events = MeterEventService(self._requestor) diff --git a/stripe/v2/_core_service.py b/stripe/v2/_core_service.py new file mode 100644 index 000000000..96c4a6f2e --- /dev/null +++ b/stripe/v2/_core_service.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_service import StripeService +from stripe.v2.core._event_service import EventService + + +class CoreService(StripeService): + def __init__(self, requestor): + super().__init__(requestor) + self.events = EventService(self._requestor) diff --git a/stripe/v2/_event.py b/stripe/v2/_event.py new file mode 100644 index 000000000..04c95ca8d --- /dev/null +++ b/stripe/v2/_event.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- + +import json +from typing import ClassVar, Optional + +from typing_extensions import Literal + +from stripe._stripe_object import StripeObject + +# This describes the common format for the pull payload of a V2 ThinEvent +# more specific classes will add `data` and `fetch_related_objects()` as needed + + +# The beginning of the section generated from our OpenAPI spec +class Event(StripeObject): + OBJECT_NAME: ClassVar[Literal["v2.core.event"]] = "v2.core.event" + + class Reason(StripeObject): + class Request(StripeObject): + id: str + """ + ID of the API request that caused the event. + """ + idempotency_key: str + """ + The idempotency key transmitted during the request. + """ + + type: Literal["request"] + """ + Event reason type. + """ + request: Optional[Request] + """ + Information on the API request that instigated the event. + """ + _inner_class_types = {"request": Request} + + context: Optional[str] + """ + Authentication context needed to fetch the event or related object. + """ + created: str + """ + Time at which the object was created. + """ + id: str + """ + Unique identifier for the event. + """ + 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.core.event"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + reason: Optional[Reason] + """ + Reason for the event. + """ + type: str + """ + The type of the event. + """ + _inner_class_types = {"reason": Reason} + + +# The end of the section generated from our OpenAPI spec + + +class Reason: + id: str + idempotency_key: str + + def __init__(self, d) -> None: + self.id = d["id"] + self.idempotency_key = d["idempotency_key"] + + def __repr__(self) -> str: + return f"" + + +class RelatedObject: + id: str + type: str + url: str + + def __init__(self, d) -> None: + self.id = d["id"] + self.type_ = d["type"] + self.url = d["url"] + + def __repr__(self) -> str: + return f"" + + +class ThinEvent: + """ + ThinEvent represents the json that's delivered from an Event Destination. It's a basic `dict` with no additional methods or properties. Use it to check basic information about a delivered event. If you want more details, use `stripe.v2.Event.retrieve(thin_event.id)` to fetch the full event object. + """ + + id: str + type: str + created: str + context: Optional[str] = None + related_object: Optional[RelatedObject] = None + reason: Optional[Reason] = None + + def __init__(self, payload: str) -> None: + parsed = json.loads(payload) + + self.id = parsed["id"] + self.type = parsed["type"] + self.created = parsed["created"] + self.context = parsed.get("context") + if parsed.get("related_object"): + self.related_object = RelatedObject(parsed["related_object"]) + if parsed.get("reason"): + self.reason = Reason(parsed["reason"]) + + def __repr__(self) -> str: + return f"" diff --git a/stripe/v2/_list_object.py b/stripe/v2/_list_object.py new file mode 100644 index 000000000..a9d73546c --- /dev/null +++ b/stripe/v2/_list_object.py @@ -0,0 +1,59 @@ +from stripe._stripe_object import StripeObject +from typing import List, Optional, TypeVar, Generic + + +T = TypeVar("T", bound=StripeObject) + + +class ListObject(StripeObject, Generic[T]): + """ + Represents one page of a list of V2 Stripe objects. Use `.data` to access + the objects on this page, or use + + for item in list_object.auto_paging_iter(): + # do something with item + + to iterate over this and all following pages. + """ + + OBJECT_NAME = "list" + data: List[StripeObject] + next_page_url: Optional[str] + + def __getitem__(self, k): + if isinstance(k, str): # type: ignore + return super(ListObject, self).__getitem__(k) + else: + raise KeyError( + "You tried to access the %s index, but ListObjectV2 types only " + "support string keys. (HINT: List calls return an object with " + "a 'data' (which is the data array). You likely want to call " + ".data[%s])" % (repr(k), repr(k)) + ) + + def __iter__(self): + return getattr(self, "data", []).__iter__() + + def __len__(self): + return getattr(self, "data", []).__len__() + + def __reversed__(self): + return getattr(self, "data", []).__reversed__() + + def auto_paging_iter(self): + page = self.data + next_page_url = self.next_page_url + while True: + for item in page: + yield item + if next_page_url is None: + break + + result = self._request( + "get", + next_page_url, + base_address="api", + ) + assert isinstance(result, ListObject) + page = result.data + next_page_url = result.next_page_url diff --git a/stripe/v2/billing/__init__.py b/stripe/v2/billing/__init__.py new file mode 100644 index 000000000..ff5fd91c6 --- /dev/null +++ b/stripe/v2/billing/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe.v2.billing._meter_event import MeterEvent as MeterEvent +from stripe.v2.billing._meter_event_adjustment import ( + MeterEventAdjustment as MeterEventAdjustment, +) +from stripe.v2.billing._meter_event_adjustment_service import ( + MeterEventAdjustmentService as MeterEventAdjustmentService, +) +from stripe.v2.billing._meter_event_service import ( + MeterEventService as MeterEventService, +) +from stripe.v2.billing._meter_event_session import ( + MeterEventSession as MeterEventSession, +) +from stripe.v2.billing._meter_event_session_service import ( + MeterEventSessionService as MeterEventSessionService, +) +from stripe.v2.billing._meter_event_stream_service import ( + MeterEventStreamService as MeterEventStreamService, +) diff --git a/stripe/v2/billing/_meter_event.py b/stripe/v2/billing/_meter_event.py new file mode 100644 index 000000000..ce33c36cd --- /dev/null +++ b/stripe/v2/billing/_meter_event.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar, Dict +from typing_extensions import Literal + + +class MeterEvent(StripeObject): + """ + Fix me empty_doc_string. + """ + + OBJECT_NAME: ClassVar[Literal["billing.meter_event"]] = ( + "billing.meter_event" + ) + created: str + """ + The creation time of this meter event. + """ + event_name: str + """ + The name of the meter event. Corresponds with the `event_name` field on a meter. + """ + identifier: str + """ + A unique identifier for the event. If not provided, one will be generated. We recommend using a globally unique identifier for this. We'll enforce uniqueness within a rolling 24 hour period. + """ + 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["billing.meter_event"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + payload: Dict[str, str] + """ + 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. + """ + timestamp: str + """ + The time of the event. Must be within the past 35 calendar days or up to + 5 minutes in the future. Defaults to current timestamp if not specified. + """ diff --git a/stripe/v2/billing/_meter_event_adjustment.py b/stripe/v2/billing/_meter_event_adjustment.py new file mode 100644 index 000000000..7561e67ba --- /dev/null +++ b/stripe/v2/billing/_meter_event_adjustment.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar +from typing_extensions import Literal + + +class MeterEventAdjustment(StripeObject): + OBJECT_NAME: ClassVar[Literal["billing.meter_event_adjustment"]] = ( + "billing.meter_event_adjustment" + ) + + class Cancel(StripeObject): + identifier: str + """ + Unique identifier for the event. You can only cancel events within 24 hours of Stripe receiving them. + """ + + cancel: Cancel + """ + Specifies which event to cancel. + """ + created: str + """ + The time the adjustment was created. + """ + event_name: str + """ + The name of the meter event. Corresponds with the `event_name` field on a meter. + """ + id: str + """ + The unique id of this meter event adjustment. + """ + 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["billing.meter_event_adjustment"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + status: Literal["complete", "pending"] + """ + Open Enum. The meter event adjustment's status. + """ + type: Literal["cancel"] + """ + Open Enum. Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet. + """ + _inner_class_types = {"cancel": Cancel} diff --git a/stripe/v2/billing/_meter_event_adjustment_service.py b/stripe/v2/billing/_meter_event_adjustment_service.py new file mode 100644 index 000000000..9533243f8 --- /dev/null +++ b/stripe/v2/billing/_meter_event_adjustment_service.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from stripe.v2.billing._meter_event_adjustment import MeterEventAdjustment +from typing import cast +from typing_extensions import Literal, TypedDict + + +class MeterEventAdjustmentService(StripeService): + class CreateParams(TypedDict): + cancel: "MeterEventAdjustmentService.CreateParamsCancel" + """ + Specifies which event to cancel. + """ + event_name: str + """ + The name of the meter event. Corresponds with the `event_name` field on a meter. + """ + type: Literal["cancel"] + """ + Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet. + """ + + class CreateParamsCancel(TypedDict): + identifier: str + """ + Unique identifier for the event. You can only cancel events within 24 hours of Stripe receiving them. + """ + + def create( + self, + params: "MeterEventAdjustmentService.CreateParams", + options: RequestOptions = {}, + ) -> MeterEventAdjustment: + """ + Creates a meter event adjustment to cancel a previously sent meter event. + """ + return cast( + MeterEventAdjustment, + self._request( + "post", + "/v2/billing/meter_event_adjustments", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "MeterEventAdjustmentService.CreateParams", + options: RequestOptions = {}, + ) -> MeterEventAdjustment: + """ + Creates a meter event adjustment to cancel a previously sent meter event. + """ + return cast( + MeterEventAdjustment, + await self._request_async( + "post", + "/v2/billing/meter_event_adjustments", + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/billing/_meter_event_service.py b/stripe/v2/billing/_meter_event_service.py new file mode 100644 index 000000000..50eb75009 --- /dev/null +++ b/stripe/v2/billing/_meter_event_service.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from stripe.v2.billing._meter_event import MeterEvent +from typing import Dict, cast +from typing_extensions import NotRequired, TypedDict + + +class MeterEventService(StripeService): + class CreateParams(TypedDict): + event_name: str + """ + The name of the meter event. Corresponds with the `event_name` field on a meter. + """ + identifier: NotRequired[str] + """ + A unique identifier for the event. If not provided, one will be generated. + We recommend using a globally unique identifier for this. We'll enforce + uniqueness within a rolling 24 hour period. + """ + payload: Dict[str, str] + """ + 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](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides). + """ + timestamp: NotRequired[str] + """ + The time of the event. Must be within the past 35 calendar days or up to + 5 minutes in the future. Defaults to current timestamp if not specified. + """ + + def create( + self, + params: "MeterEventService.CreateParams", + options: RequestOptions = {}, + ) -> MeterEvent: + """ + Creates a meter event. Events are validated synchronously, but are processed asynchronously. Supports up to 1,000 events per second in livemode. For higher rate-limits, please use meter event streams instead. + """ + return cast( + MeterEvent, + self._request( + "post", + "/v2/billing/meter_events", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "MeterEventService.CreateParams", + options: RequestOptions = {}, + ) -> MeterEvent: + """ + Creates a meter event. Events are validated synchronously, but are processed asynchronously. Supports up to 1,000 events per second in livemode. For higher rate-limits, please use meter event streams instead. + """ + return cast( + MeterEvent, + await self._request_async( + "post", + "/v2/billing/meter_events", + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/billing/_meter_event_session.py b/stripe/v2/billing/_meter_event_session.py new file mode 100644 index 000000000..f1d96650e --- /dev/null +++ b/stripe/v2/billing/_meter_event_session.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar +from typing_extensions import Literal + + +class MeterEventSession(StripeObject): + OBJECT_NAME: ClassVar[Literal["billing.meter_event_session"]] = ( + "billing.meter_event_session" + ) + authentication_token: str + """ + The authentication token for this session. Use this token when calling the + high-throughput meter event API. + """ + created: str + """ + The creation time of this session. + """ + expires_at: str + """ + The time at which this session will expire. + """ + id: str + """ + The unique id of this auth session. + """ + 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["billing.meter_event_session"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ diff --git a/stripe/v2/billing/_meter_event_session_service.py b/stripe/v2/billing/_meter_event_session_service.py new file mode 100644 index 000000000..600c80362 --- /dev/null +++ b/stripe/v2/billing/_meter_event_session_service.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from stripe.v2.billing._meter_event_session import MeterEventSession +from typing import cast +from typing_extensions import TypedDict + + +class MeterEventSessionService(StripeService): + class CreateParams(TypedDict): + pass + + def create( + self, + params: "MeterEventSessionService.CreateParams" = {}, + options: RequestOptions = {}, + ) -> MeterEventSession: + """ + Creates a meter event session to send usage on the high-throughput meter event stream. Authentication tokens are only valid for 15 minutes, so you will need to create a new meter event session when your token expires. + """ + return cast( + MeterEventSession, + self._request( + "post", + "/v2/billing/meter_event_session", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "MeterEventSessionService.CreateParams" = {}, + options: RequestOptions = {}, + ) -> MeterEventSession: + """ + Creates a meter event session to send usage on the high-throughput meter event stream. Authentication tokens are only valid for 15 minutes, so you will need to create a new meter event session when your token expires. + """ + return cast( + MeterEventSession, + await self._request_async( + "post", + "/v2/billing/meter_event_session", + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/billing/_meter_event_stream_service.py b/stripe/v2/billing/_meter_event_stream_service.py new file mode 100644 index 000000000..84e6908e5 --- /dev/null +++ b/stripe/v2/billing/_meter_event_stream_service.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from typing import Dict, List +from typing_extensions import NotRequired, TypedDict + + +class MeterEventStreamService(StripeService): + class CreateParams(TypedDict): + events: List["MeterEventStreamService.CreateParamsEvent"] + """ + List of meter events to include in the request. + """ + + class CreateParamsEvent(TypedDict): + event_name: str + """ + The name of the meter event. Corresponds with the `event_name` field on a meter. + """ + identifier: NotRequired[str] + """ + A unique identifier for the event. If not provided, one will be generated. + We recommend using a globally unique identifier for this. We'll enforce + uniqueness within a rolling 24 hour period. + """ + payload: Dict[str, str] + """ + 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](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides). + """ + timestamp: NotRequired[str] + """ + The time of the event. Must be within the past 35 calendar days or up to + 5 minutes in the future. Defaults to current timestamp if not specified. + """ + + def create( + self, + params: "MeterEventStreamService.CreateParams", + options: RequestOptions = {}, + ) -> None: + """ + Creates meter events. Events are processed asynchronously, including validation. Requires a meter event session for authentication. Supports up to 10,000 requests per second in livemode. For even higher rate-limits, contact sales. + """ + self._request( + "post", + "/v2/billing/meter_event_stream", + base_address="meter_events", + params=params, + options=options, + ) + + async def create_async( + self, + params: "MeterEventStreamService.CreateParams", + options: RequestOptions = {}, + ) -> None: + """ + Creates meter events. Events are processed asynchronously, including validation. Requires a meter event session for authentication. Supports up to 10,000 requests per second in livemode. For even higher rate-limits, contact sales. + """ + await self._request_async( + "post", + "/v2/billing/meter_event_stream", + base_address="meter_events", + params=params, + options=options, + ) diff --git a/stripe/v2/core/__init__.py b/stripe/v2/core/__init__.py new file mode 100644 index 000000000..5879a6c60 --- /dev/null +++ b/stripe/v2/core/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe.v2.core._event_service import EventService as EventService diff --git a/stripe/v2/core/_event_service.py b/stripe/v2/core/_event_service.py new file mode 100644 index 000000000..999fe8471 --- /dev/null +++ b/stripe/v2/core/_event_service.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from stripe._util import sanitize_id +from stripe.v2._event import Event +from stripe.v2._list_object import ListObject +from typing import cast +from typing_extensions import NotRequired, TypedDict + + +class EventService(StripeService): + class ListParams(TypedDict): + limit: NotRequired[int] + """ + The page size. + """ + object_id: str + """ + Primary object ID used to retrieve related events. + """ + page: NotRequired[str] + """ + The requested page number. + """ + + class RetrieveParams(TypedDict): + pass + + def list( + self, params: "EventService.ListParams", options: RequestOptions = {} + ) -> ListObject[Event]: + """ + List events, going back up to 30 days. + """ + return cast( + ListObject[Event], + self._request( + "get", + "/v2/core/events", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, params: "EventService.ListParams", options: RequestOptions = {} + ) -> ListObject[Event]: + """ + List events, going back up to 30 days. + """ + return cast( + ListObject[Event], + await self._request_async( + "get", + "/v2/core/events", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + id: str, + params: "EventService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> Event: + """ + Retrieves the details of an event. + """ + return cast( + Event, + self._request( + "get", + "/v2/core/events/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + id: str, + params: "EventService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> Event: + """ + Retrieves the details of an event. + """ + return cast( + Event, + await self._request_async( + "get", + "/v2/core/events/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/tests/api_resources/abstract/test_api_resource.py b/tests/api_resources/abstract/test_api_resource.py index ebb533c9f..005309f20 100644 --- a/tests/api_resources/abstract/test_api_resource.py +++ b/tests/api_resources/abstract/test_api_resource.py @@ -95,7 +95,7 @@ def test_convert_to_stripe_object(self): } converted = stripe.util.convert_to_stripe_object( - sample, "akey", None, None + sample, "akey", None, None, api_mode="V1" ) # Types diff --git a/tests/api_resources/test_list_object.py b/tests/api_resources/test_list_object.py index 98a4e72ce..fe6340a14 100644 --- a/tests/api_resources/test_list_object.py +++ b/tests/api_resources/test_list_object.py @@ -95,13 +95,15 @@ def test_empty_list(self): def test_iter(self): arr = [{"id": 1}, {"id": 2}, {"id": 3}] - expected = stripe.util.convert_to_stripe_object(arr) + expected = stripe.util.convert_to_stripe_object(arr, api_mode="V1") lo = stripe.ListObject.construct_from({"data": arr}, None) assert list(lo) == expected def test_iter_reversed(self): arr = [{"id": 1}, {"id": 2}, {"id": 3}] - expected = stripe.util.convert_to_stripe_object(list(reversed(arr))) + expected = stripe.util.convert_to_stripe_object( + list(reversed(arr)), api_mode="V1" + ) lo = stripe.ListObject.construct_from({"data": arr}, None) assert list(reversed(lo)) == expected diff --git a/tests/api_resources/test_list_object_v2.py b/tests/api_resources/test_list_object_v2.py new file mode 100644 index 000000000..d86ed54c5 --- /dev/null +++ b/tests/api_resources/test_list_object_v2.py @@ -0,0 +1,147 @@ +from __future__ import absolute_import, division, print_function + +import json + +import pytest + +import stripe +from stripe.v2._list_object import ListObject +from tests.http_client_mock import HTTPClientMock + + +class TestListObjectV2(object): + @pytest.fixture + def list_object(self): + return ListObject.construct_from( + { + "data": ["a", "b", "c"], + "next_page_url": None, + "previous_page_url": None, + }, + "mykey", + ) + + def test_iter(self): + arr = ["a", "b", "c"] + expected = stripe.util.convert_to_stripe_object(arr, api_mode="V2") + lo = ListObject.construct_from({"data": arr}, None) + assert list(lo) == expected + + @staticmethod + def pageable_model_response(ids, next_page_url): + return { + "data": [{"id": id, "object": "pageablemodel"} for id in ids], + "next_page_url": next_page_url, + } + + def test_iter_one_page(self, http_client_mock): + lo = ListObject.construct_from( + self.pageable_model_response(["pm_123", "pm_124"], None), "mykey" + ) + + http_client_mock.assert_no_request() + + seen = [item["id"] for item in lo.auto_paging_iter()] + + assert seen == ["pm_123", "pm_124"] + + def test_iter_two_pages(self, http_client_mock): + method = "get" + path = "/v2/pageablemodels" + + lo = ListObject.construct_from( + self.pageable_model_response( + ["pm_123", "pm_124"], "/v2/pageablemodels?foo=bar&page=page_2" + ), + None, + ) + + http_client_mock.stub_request( + method, + path=path, + query_string="foo=bar&page=page_3", + rbody=json.dumps( + self.pageable_model_response(["pm_127", "pm_128"], None) + ), + ) + + http_client_mock.stub_request( + method, + path=path, + query_string="foo=bar&page=page_2", + rbody=json.dumps( + self.pageable_model_response( + ["pm_125", "pm_126"], + "/v2/pageablemodels?foo=bar&page=page_3", + ) + ), + ) + + seen = [item["id"] for item in lo.auto_paging_iter()] + + http_client_mock.assert_requested( + method, path=path, query_string="foo=bar&page=page_2" + ) + + http_client_mock.assert_requested( + method, path=path, query_string="foo=bar&page=page_3" + ) + + assert seen == [ + "pm_123", + "pm_124", + "pm_125", + "pm_126", + "pm_127", + "pm_128", + ] + + def test_iter_forwards_api_key(self, http_client_mock: HTTPClientMock): + client = stripe.StripeClient( + http_client=http_client_mock.get_mock_http_client(), + api_key="sk_test_xyz", + ) + + method = "get" + query_string_1 = "object_id=obj_123" + query_string_2 = "object_id=obj_123&page=page_2" + path = "/v2/core/events" + + http_client_mock.stub_request( + method, + path=path, + query_string=query_string_1, + rbody='{"data": [{"id": "x"}], "next_page_url": "/v2/core/events?object_id=obj_123&page=page_2"}', + rcode=200, + rheaders={}, + ) + + http_client_mock.stub_request( + method, + path=path, + query_string=query_string_2, + rbody='{"data": [{"id": "y"}, {"id": "z"}], "next_page_url": null}', + rcode=200, + rheaders={}, + ) + + lo = client.v2.core.events.list( + params={"object_id": "obj_123"}, + options={"api_key": "sk_test_iter_forwards_options"}, + ) + + seen = [item["id"] for item in lo.auto_paging_iter()] + + assert seen == ["x", "y", "z"] + http_client_mock.assert_requested( + method, + path=path, + query_string=query_string_1, + api_key="sk_test_iter_forwards_options", + ) + http_client_mock.assert_requested( + method, + path=path, + query_string=query_string_2, + api_key="sk_test_iter_forwards_options", + ) diff --git a/tests/api_resources/test_search_result_object.py b/tests/api_resources/test_search_result_object.py index 6e4d3f535..83266f0b9 100644 --- a/tests/api_resources/test_search_result_object.py +++ b/tests/api_resources/test_search_result_object.py @@ -82,7 +82,7 @@ def test_empty_search_result(self): def test_iter(self): arr = [{"id": 1}, {"id": 2}, {"id": 3}] - expected = stripe.util.convert_to_stripe_object(arr) + expected = stripe.util.convert_to_stripe_object(arr, api_mode="V1") sro = stripe.SearchResultObject.construct_from({"data": arr}, None) assert list(sro) == expected diff --git a/tests/fixtures/card.json b/tests/fixtures/card.json deleted file mode 100644 index 97a40a318..000000000 --- a/tests/fixtures/card.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "id": "card_123", - "object": "payment_methods.card", - "address_city": null, - "address_country": null, - "address_line1": null, - "address_line1_check": null, - "address_line2": null, - "address_state": null, - "address_zip": null, - "address_zip_check": null, - "brand": "Visa", - "country": "US", - "customer": "cus_123", - "cvc_check": null, - "dynamic_last4": null, - "exp_month": 8, - "exp_year": 2019, - "fingerprint": "Xt5EWLLDS7FJjR1c", - "funding": "credit", - "last4": "4242", - "metadata": { - }, - "name": null, - "tokenization_method": null -} diff --git a/tests/http_client_mock.py b/tests/http_client_mock.py index 0e2ea588a..db13f432c 100644 --- a/tests/http_client_mock.py +++ b/tests/http_client_mock.py @@ -336,6 +336,7 @@ def assert_requested( api_key=None, stripe_version=None, stripe_account=None, + stripe_context=None, content_type=None, idempotency_key=None, user_agent=None, @@ -366,6 +367,7 @@ def assert_requested( api_key=api_key, stripe_version=stripe_version, stripe_account=stripe_account, + stripe_context=stripe_context, content_type=content_type, idempotency_key=idempotency_key, user_agent=user_agent, diff --git a/tests/test_api_requestor.py b/tests/test_api_requestor.py index 8acb0e87d..82f10e5a3 100644 --- a/tests/test_api_requestor.py +++ b/tests/test_api_requestor.py @@ -3,25 +3,25 @@ import tempfile import uuid from collections import OrderedDict +from urllib.parse import urlencode, urlsplit import pytest +import urllib3 import stripe from stripe import util +from stripe._api_requestor import _api_encode, _APIRequestor +from stripe._request_options import RequestOptions +from stripe._requestor_options import ( + RequestorOptions, + _GlobalRequestorOptions, +) +from stripe._stripe_object import StripeObject from stripe._stripe_response import ( StripeStreamResponse, StripeStreamResponseAsync, ) -from stripe._api_requestor import _APIRequestor, _api_encode -from stripe._stripe_object import StripeObject -from stripe._requestor_options import ( - _GlobalRequestorOptions, -) -from stripe._request_options import RequestOptions - -from urllib.parse import urlencode, urlsplit - -import urllib3 +from tests.http_client_mock import HTTPClientMock VALID_API_METHODS = ("get", "post", "delete") @@ -49,6 +49,19 @@ def __repr__(self): return "AnyUUID4Matcher()" +class IsNoneMatcher: + """ + Matcher to make assertions against None because `assert_requested` doesn't + run checks if you pass `None` as the expected value. + """ + + def __eq__(self, other): + return other is None + + def __repr__(self): + return "None (from IsNoneMatcher())" + + class TestAPIRequestor(object): ENCODE_INPUTS = { "dict": { @@ -113,8 +126,12 @@ def requestor(self, http_client_mock): return requestor @property - def valid_path(self): - return "/foo" + def v1_path(self): + return "/v1/foo" + + @property + def v2_path(self): + return "/v2/foo" def encoder_check(self, key): stk_key = "my%s" % (key,) @@ -162,9 +179,46 @@ def test_param_encoding(self, requestor, http_client_mock): http_client_mock.assert_requested("get", query_string=query_string) + def test_param_api_mode_preview(self, requestor, http_client_mock): + http_client_mock.stub_request( + "post", path=self.v2_path, rbody="{}", rcode=200 + ) + + requestor.request( + "post", self.v2_path, self.ENCODE_INPUTS, base_address="api" + ) + + expectation = '{"dict": {"astring": "bar", "anint": 5, "anull": null, "adatetime": 1356994800, "atuple": [1, 2], "adict": {"foo": "bar", "boz": 5}, "alist": ["foo", "bar"]}, "list": [1, "foo", "baz"], "string": "boo", "unicode": "\\u1234", "datetime": 1356994801, "none": null}' + + http_client_mock.assert_requested( + "post", + content_type="application/json", + post_data=expectation, + is_json=True, + ) + + def test_encodes_null_values_preview(self, requestor, http_client_mock): + http_client_mock.stub_request( + "post", path=self.v2_path, rbody="{}", rcode=200 + ) + + requestor.request( + "post", + self.v2_path, + {"foo": None}, + base_address="api", + ) + + http_client_mock.assert_requested( + "post", + content_type="application/json", + post_data='{"foo": null}', + is_json=True, + ) + def test_dictionary_list_encoding(self): params = {"foo": {"0": {"bar": "bat"}}} - encoded = list(_api_encode(params)) + encoded = list(_api_encode(params, "V1")) key, value = encoded[0] assert key == "foo[0][bar]" @@ -181,7 +235,7 @@ def test_ordereddict_encoding(self): ] ) } - encoded = list(_api_encode(params)) + encoded = list(_api_encode(params, "V1")) assert encoded[0][0] == "ordered[one]" assert encoded[1][0] == "ordered[two]" @@ -224,11 +278,11 @@ def test_url_construction(self, requestor, http_client_mock): def test_empty_methods(self, requestor, http_client_mock): for meth in VALID_API_METHODS: http_client_mock.stub_request( - meth, path=self.valid_path, rbody="{}", rcode=200 + meth, path=self.v1_path, rbody="{}", rcode=200 ) resp = requestor.request( - meth, self.valid_path, {}, base_address="api" + meth, self.v1_path, {}, base_address="api" ) if meth == "post": @@ -246,13 +300,13 @@ async def test_empty_methods_async(self, requestor, http_client_mock): for meth in VALID_API_METHODS: http_client_mock.stub_request( meth, - path=self.valid_path, + path=self.v1_path, rbody="{}", rcode=200, ) resp = await requestor.request_async( - meth, self.valid_path, {}, base_address="api" + meth, self.v1_path, {}, base_address="api" ) if meth == "post": @@ -277,14 +331,14 @@ async def async_iter(): for meth in VALID_API_METHODS: http_client_mock.stub_request( meth, - path=self.valid_path, + path=self.v1_path, rbody=async_iter(), rcode=200, ) resp = await requestor.request_stream_async( meth, - self.valid_path, + self.v1_path, {}, base_address="api", ) @@ -305,14 +359,14 @@ def test_empty_methods_streaming_response( for meth in VALID_API_METHODS: http_client_mock.stub_request( meth, - path=self.valid_path, + path=self.v1_path, rbody=util.io.BytesIO(b"thisisdata"), rcode=200, ) resp = requestor.request_stream( meth, - self.valid_path, + self.v1_path, {}, base_address="api", ) @@ -338,7 +392,7 @@ def test_methods_with_params_and_response( http_client_mock.stub_request( method, - path=self.valid_path, + path=self.v1_path, query_string=encoded if method != "post" else "", rbody='{"foo": "bar", "baz": 6}', rcode=200, @@ -352,7 +406,7 @@ def test_methods_with_params_and_response( resp = requestor.request( method, - self.valid_path, + self.v1_path, params, base_address="api", ) @@ -368,7 +422,7 @@ def test_methods_with_params_and_response( else: abs_url = "%s%s?%s" % ( stripe.api_base, - self.valid_path, + self.v1_path, encoded, ) http_client_mock.assert_requested(method, abs_url=abs_url) @@ -384,7 +438,7 @@ def test_methods_with_params_and_streaming_response( http_client_mock.stub_request( method, - path=self.valid_path, + path=self.v1_path, query_string=encoded if method != "post" else "", rbody=util.io.BytesIO(b'{"foo": "bar", "baz": 6}'), rcode=200, @@ -398,7 +452,7 @@ def test_methods_with_params_and_streaming_response( resp = requestor.request_stream( method, - self.valid_path, + self.v1_path, params, base_address="api", ) @@ -411,19 +465,19 @@ def test_methods_with_params_and_streaming_response( else: abs_url = "%s%s?%s" % ( stripe.api_base, - self.valid_path, + self.v1_path, encoded, ) http_client_mock.assert_requested(method, abs_url=abs_url) def test_uses_headers(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody="{}", rcode=200 + "get", path=self.v1_path, rbody="{}", rcode=200 ) request_options: RequestOptions = {"headers": {"foo": "bar"}} requestor.request( "get", - self.valid_path, + self.v1_path, {}, options=request_options, base_address="api", @@ -432,12 +486,12 @@ def test_uses_headers(self, requestor, http_client_mock): def test_uses_api_version(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody="{}", rcode=200 + "get", path=self.v1_path, rbody="{}", rcode=200 ) request_options: RequestOptions = {"stripe_version": "fooversion"} requestor.request( "get", - self.valid_path, + self.v1_path, options=request_options, base_address="api", ) @@ -448,7 +502,7 @@ def test_uses_api_version(self, requestor, http_client_mock): def test_prefers_headers_api_version(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody="{}", rcode=200 + "get", path=self.v1_path, rbody="{}", rcode=200 ) request_options: RequestOptions = { "stripe_version": "fooversion", @@ -456,7 +510,7 @@ def test_prefers_headers_api_version(self, requestor, http_client_mock): } requestor.request( "get", - self.valid_path, + self.v1_path, {}, options=request_options, base_address="api", @@ -471,10 +525,10 @@ def test_uses_instance_key(self, requestor, http_client_mock): requestor = requestor._replace_options(RequestOptions(api_key=key)) http_client_mock.stub_request( - "get", path=self.valid_path, rbody="{}", rcode=200 + "get", path=self.v1_path, rbody="{}", rcode=200 ) - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") http_client_mock.assert_requested("get", api_key=key) assert requestor.api_key == key @@ -486,16 +540,66 @@ def test_uses_instance_account(self, requestor, http_client_mock): ) http_client_mock.stub_request( - "get", path=self.valid_path, rbody="{}", rcode=200 + "get", path=self.v1_path, rbody="{}", rcode=200 ) - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") http_client_mock.assert_requested( "get", stripe_account=account, ) + def test_removes_None_account( + self, requestor, http_client_mock: HTTPClientMock + ): + """ + important test! + + If there's no context on a retrieved event, it's important that passing `stripe-account: None` + in the generated fetch_related_object doesn't actually send the null header + """ + account = None + requestor = requestor._replace_options( + RequestOptions(stripe_account=account) + ) + + http_client_mock.stub_request( + "get", path=self.v1_path, rbody="{}", rcode=200 + ) + + requestor.request("get", self.v1_path, {}, base_address="api") + + assert len(http_client_mock.get_all_calls()) == 1 + call = http_client_mock.get_last_call() + assert call.headers is not None + + assert "Stripe-Account" not in call.headers + + def test_uses_instance_context(self, http_client_mock): + context = "acct_bar" + + requestor = _APIRequestor( + options=RequestorOptions( + **{ + **_GlobalRequestorOptions().to_dict(), + "stripe_context": context, + } + ), + client=http_client_mock.get_mock_http_client(), + ) + + 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=context, + ) + def test_sets_default_http_client(self, mocker): assert not stripe.default_http_client @@ -528,9 +632,9 @@ def test_uses_app_info(self, requestor, http_client_mock): ) http_client_mock.stub_request( - "get", path=self.valid_path, rbody="{}", rcode=200 + "get", path=self.v1_path, rbody="{}", rcode=200 ) - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") ua = "Stripe/v1 PythonBindings/%s" % (stripe.VERSION,) ua += " MyAwesomePlugin/1.2.34 (https://myawesomeplugin.info)" @@ -557,7 +661,7 @@ def test_handles_failed_platform_call( self, requestor, mocker, http_client_mock ): http_client_mock.stub_request( - "get", path=self.valid_path, rbody="{}", rcode=200 + "get", path=self.v1_path, rbody="{}", rcode=200 ) def fail(): @@ -565,7 +669,7 @@ def fail(): mocker.patch("platform.platform", side_effect=fail) - requestor.request("get", self.valid_path, {}, {}, base_address="api") + requestor.request("get", self.v1_path, {}, {}, base_address="api") last_call = http_client_mock.get_last_call() last_call.assert_method("get") @@ -577,104 +681,130 @@ def fail(): ) def test_uses_given_idempotency_key(self, requestor, http_client_mock): - meth = "post" + method = "post" http_client_mock.stub_request( - meth, path=self.valid_path, rbody="{}", rcode=200 + method, path=self.v1_path, rbody="{}", rcode=200 ) request_options: RequestOptions = {"idempotency_key": "123abc"} requestor.request( - meth, - self.valid_path, + method, + self.v1_path, {}, options=request_options, base_address="api", ) http_client_mock.assert_requested( - meth, idempotency_key="123abc", post_data="" + method, idempotency_key="123abc", post_data="" ) def test_uuid4_idempotency_key_when_not_given( self, requestor, http_client_mock ): - meth = "post" + method = "post" + http_client_mock.stub_request( + method, path=self.v1_path, rbody="{}", rcode=200 + ) + requestor.request(method, self.v1_path, {}, base_address="api") + + http_client_mock.assert_requested( + method, idempotency_key=AnyUUID4Matcher(), post_data="" + ) + + def test_generates_default_idempotency_key_for_v2_delete( + self, requestor, http_client_mock + ): + method = "delete" + http_client_mock.stub_request( + method, path=self.v2_path, rbody="{}", rcode=200 + ) + requestor.request(method, self.v2_path, {}, base_address="api") + + http_client_mock.assert_requested( + method, idempotency_key=AnyUUID4Matcher() + ) + + def test_skips_generates_default_idempotency_key_for_v1_delete( + self, requestor, http_client_mock + ): + method = "delete" http_client_mock.stub_request( - meth, path=self.valid_path, rbody="{}", rcode=200 + method, path=self.v1_path, rbody="{}", rcode=200 ) - requestor.request(meth, self.valid_path, {}, base_address="api") + requestor.request(method, self.v1_path, {}, base_address="api") http_client_mock.assert_requested( - meth, idempotency_key=AnyUUID4Matcher(), post_data="" + method, idempotency_key=IsNoneMatcher() ) def test_fails_without_api_key(self, requestor): stripe.api_key = None with pytest.raises(stripe.error.AuthenticationError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_request_error_404(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody='{"error": {}}', rcode=404 + "get", path=self.v1_path, rbody='{"error": {}}', rcode=404 ) with pytest.raises(stripe.error.InvalidRequestError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_request_error_400(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody='{"error": {}}', rcode=400 + "get", path=self.v1_path, rbody='{"error": {}}', rcode=400 ) with pytest.raises(stripe.error.InvalidRequestError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_idempotency_error(self, requestor, http_client_mock): http_client_mock.stub_request( "get", - path=self.valid_path, + path=self.v1_path, rbody='{"error": {"type": "idempotency_error"}}', rcode=400, ) with pytest.raises(stripe.error.IdempotencyError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_authentication_error(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody='{"error": {}}', rcode=401 + "get", path=self.v1_path, rbody='{"error": {}}', rcode=401 ) with pytest.raises(stripe.error.AuthenticationError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_permissions_error(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody='{"error": {}}', rcode=403 + "get", path=self.v1_path, rbody='{"error": {}}', rcode=403 ) with pytest.raises(stripe.error.PermissionError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_card_error(self, requestor, http_client_mock): http_client_mock.stub_request( "get", - path=self.valid_path, + path=self.v1_path, rbody='{"error": {"code": "invalid_expiry_year"}}', rcode=402, ) with pytest.raises(stripe.error.CardError) as excinfo: - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") assert excinfo.value.code == "invalid_expiry_year" def test_rate_limit_error(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody='{"error": {}}', rcode=429 + "get", path=self.v1_path, rbody='{"error": {}}', rcode=429 ) with pytest.raises(stripe.error.RateLimitError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_old_rate_limit_error(self, requestor, http_client_mock): """ @@ -682,29 +812,29 @@ def test_old_rate_limit_error(self, requestor, http_client_mock): """ http_client_mock.stub_request( "get", - path=self.valid_path, + path=self.v1_path, rbody='{"error": {"code":"rate_limit"}}', rcode=400, ) with pytest.raises(stripe.error.RateLimitError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_server_error(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody='{"error": {}}', rcode=500 + "get", path=self.v1_path, rbody='{"error": {}}', rcode=500 ) with pytest.raises(stripe.error.APIError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_json(self, requestor, http_client_mock): http_client_mock.stub_request( - "get", path=self.valid_path, rbody="{", rcode=200 + "get", path=self.v1_path, rbody="{", rcode=200 ) with pytest.raises(stripe.error.APIError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_method(self, requestor): with pytest.raises(stripe.error.APIConnectionError): @@ -713,49 +843,49 @@ def test_invalid_method(self, requestor): def test_oauth_invalid_requestor_error(self, requestor, http_client_mock): http_client_mock.stub_request( "get", - path=self.valid_path, + path=self.v1_path, rbody='{"error": "invalid_request"}', rcode=400, ) with pytest.raises(stripe.oauth_error.InvalidRequestError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_client_error(self, requestor, http_client_mock): http_client_mock.stub_request( "get", - path=self.valid_path, + path=self.v1_path, rbody='{"error": "invalid_client"}', rcode=401, ) with pytest.raises(stripe.oauth_error.InvalidClientError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_grant_error(self, requestor, http_client_mock): http_client_mock.stub_request( "get", - path=self.valid_path, + path=self.v1_path, rbody='{"error": "invalid_grant"}', rcode=400, ) with pytest.raises(stripe.oauth_error.InvalidGrantError): - requestor.request("get", self.valid_path, {}, base_address="api") + requestor.request("get", self.v1_path, {}, base_address="api") def test_extract_error_from_stream_request_for_bytes( self, requestor, http_client_mock ): http_client_mock.stub_request( "get", - path=self.valid_path, + path=self.v1_path, rbody=util.io.BytesIO(b'{"error": "invalid_grant"}'), rcode=400, ) with pytest.raises(stripe.oauth_error.InvalidGrantError): requestor.request_stream( - "get", self.valid_path, {}, base_address="api" + "get", self.v1_path, {}, base_address="api" ) def test_extract_error_from_stream_request_for_response( @@ -764,7 +894,7 @@ def test_extract_error_from_stream_request_for_response( # Responses don't have getvalue, they only have a read method. http_client_mock.stub_request( "get", - path=self.valid_path, + path=self.v1_path, rbody=urllib3.response.HTTPResponse( body=util.io.BytesIO(b'{"error": "invalid_grant"}'), preload_content=False, @@ -774,20 +904,20 @@ def test_extract_error_from_stream_request_for_response( with pytest.raises(stripe.oauth_error.InvalidGrantError): requestor.request_stream( - "get", self.valid_path, {}, base_address="api" + "get", self.v1_path, {}, base_address="api" ) def test_raw_request_with_file_param(self, requestor, http_client_mock): test_file = tempfile.NamedTemporaryFile() test_file.write("\u263a".encode("utf-16")) test_file.seek(0) - meth = "post" + method = "post" path = "/v1/files" params = {"file": test_file, "purpose": "dispute_evidence"} supplied_headers = {"Content-Type": "multipart/form-data"} - http_client_mock.stub_request(meth, path=path, rbody="{}", rcode=200) + http_client_mock.stub_request(method, path=path, rbody="{}", rcode=200) requestor.request( - meth, + method, path, params, supplied_headers, diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 64b304971..3676af8ab 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -4460,6 +4460,26 @@ async def test_checkout_sessions_post_2_service_async( post_data="success_url=https%3A%2F%2Fexample.com%2Fsuccess&line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=2&mode=payment", ) + def test_core_events_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/core/events/ll_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.events.retrieve("ll_123") + http_client_mock.assert_requested( + "get", + path="/v2/core/events/ll_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_country_specs_get(self, http_client_mock: HTTPClientMock) -> None: stripe.CountrySpec.list(limit=3) http_client_mock.assert_requested( @@ -25845,92 +25865,6 @@ async def test_terminal_readers_process_payment_intent_post_service_async( post_data="payment_intent=pi_xxxxxxxxxxxxx", ) - def test_terminal_readers_process_setup_intent_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.terminal.Reader.process_setup_intent( - "tmr_xxxxxxxxxxxxx", - setup_intent="seti_xxxxxxxxxxxxx", - customer_consent_collected=True, - ) - http_client_mock.assert_requested( - "post", - path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - query_string="", - post_data="setup_intent=seti_xxxxxxxxxxxxx&customer_consent_collected=True", - ) - - def test_terminal_readers_process_setup_intent_post_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.terminal.readers.process_setup_intent( - "tmr_xxxxxxxxxxxxx", - { - "setup_intent": "seti_xxxxxxxxxxxxx", - "customer_consent_collected": True, - }, - ) - http_client_mock.assert_requested( - "post", - path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - query_string="", - api_base="https://api.stripe.com", - post_data="setup_intent=seti_xxxxxxxxxxxxx&customer_consent_collected=True", - ) - - @pytest.mark.anyio - async def test_terminal_readers_process_setup_intent_post_async( - self, http_client_mock: HTTPClientMock - ) -> None: - await stripe.terminal.Reader.process_setup_intent_async( - "tmr_xxxxxxxxxxxxx", - setup_intent="seti_xxxxxxxxxxxxx", - customer_consent_collected=True, - ) - http_client_mock.assert_requested( - "post", - path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - query_string="", - post_data="setup_intent=seti_xxxxxxxxxxxxx&customer_consent_collected=True", - ) - - @pytest.mark.anyio - async def test_terminal_readers_process_setup_intent_post_service_async( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - await client.terminal.readers.process_setup_intent_async( - "tmr_xxxxxxxxxxxxx", - { - "setup_intent": "seti_xxxxxxxxxxxxx", - "customer_consent_collected": True, - }, - ) - http_client_mock.assert_requested( - "post", - path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - query_string="", - api_base="https://api.stripe.com", - post_data="setup_intent=seti_xxxxxxxxxxxxx&customer_consent_collected=True", - ) - def test_test_helpers_customers_fund_cash_balance_post( self, http_client_mock: HTTPClientMock ) -> None: diff --git a/tests/test_http_client.py b/tests/test_http_client.py index d6cbbbdf5..b671b1e7a 100644 --- a/tests/test_http_client.py +++ b/tests/test_http_client.py @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, List from typing_extensions import Type from unittest.mock import call import pytest @@ -96,11 +96,13 @@ def test_new_http_client_async_fallback_no_import_found( class TestRetrySleepTimeDefaultHttpClient(StripeClientTestCase): from contextlib import contextmanager - def assert_sleep_times(self, client, expected): - until = len(expected) - actual = list( - map(lambda i: client._sleep_time_seconds(i + 1), range(until)) - ) + def assert_sleep_times( + self, client: _http_client.HTTPClient, expected: List[float] + ): + # the sleep duration for a request after N retries + actual = [ + client._sleep_time_seconds(i + 1) for i in range(len(expected)) + ] assert expected == actual @contextmanager @@ -128,7 +130,7 @@ def test_maximum_delay(self): client = _http_client.new_default_http_client() client._add_jitter_time = lambda sleep_seconds: sleep_seconds max_delay = _http_client.HTTPClient.MAX_DELAY - expected = [0.5, 1.0, max_delay, max_delay, max_delay] + expected = [0.5, 1.0, 2.0, 4.0, max_delay, max_delay, max_delay] self.assert_sleep_times(client, expected) def test_retry_after_header(self): @@ -1090,7 +1092,7 @@ class TestAPIEncode(StripeClientTestCase): def test_encode_dict(self): body = {"foo": {"dob": {"month": 1}, "name": "bat"}} - values = [t for t in _api_encode(body)] + values = [t for t in _api_encode(body, "V1")] assert ("foo[dob][month]", 1) in values assert ("foo[name]", "bat") in values @@ -1098,11 +1100,19 @@ def test_encode_dict(self): def test_encode_array(self): body = {"foo": [{"dob": {"month": 1}, "name": "bat"}]} - values = [t for t in _api_encode(body)] + values = [t for t in _api_encode(body, "V1")] assert ("foo[0][dob][month]", 1) in values assert ("foo[0][name]", "bat") in values + def test_encode_v2_array(self): + body = {"foo": [{"dob": {"month": 1}, "name": "bat"}]} + + values = [t for t in _api_encode(body, "V2")] + + assert ("foo[dob][month]", 1) in values + assert ("foo[name]", "bat") in values + class TestHTTPXClient(StripeClientTestCase, ClientTestBase): REQUEST_CLIENT: Type[_http_client.HTTPXClient] = _http_client.HTTPXClient diff --git a/tests/test_integration.py b/tests/test_integration.py index a96f9b533..843937541 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -13,6 +13,8 @@ from collections import defaultdict from typing import List, Dict, Tuple, Optional +from stripe._stripe_client import StripeClient + if platform.python_implementation() == "PyPy": pytest.skip("skip integration tests with PyPy", allow_module_level=True) @@ -101,7 +103,6 @@ def setup_stripe(self): stripe._default_proxy = None stripe.enable_telemetry = False stripe.max_network_retries = 3 - stripe.proxy = None yield stripe.api_base = orig_attrs["api_base"] stripe.upload_api_base = orig_attrs["api_base"] @@ -348,7 +349,9 @@ async def async_http_client(self, request, anyio_backend): async def set_global_async_http_client(self, async_http_client): stripe.default_http_client = async_http_client - async def test_async_success(self, set_global_async_http_client): + async def test_async_raw_request_success( + self, set_global_async_http_client + ): class MockServerRequestHandler(MyTestHandler): default_body = '{"id": "cus_123", "object": "customer"}'.encode( "utf-8" @@ -357,11 +360,16 @@ class MockServerRequestHandler(MyTestHandler): self.setup_mock_server(MockServerRequestHandler) - stripe.api_base = "http://localhost:%s" % self.mock_server_port - - cus = await stripe.Customer.create_async( - description="My test customer" + client = StripeClient( + "sk_test_123", + base_addresses={ + "api": "http://localhost:%s" % self.mock_server_port + }, + ) + resp = await client.raw_request_async( + "post", "/v1/customers", description="My test customer" ) + cus = client.deserialize(resp.data, api_mode="V1") reqs = MockServerRequestHandler.get_requests(1) req = reqs[0] @@ -370,14 +378,15 @@ class MockServerRequestHandler(MyTestHandler): assert req.command == "POST" assert isinstance(cus, stripe.Customer) - async def test_async_timeout(self, set_global_async_http_client): + async def test_async_raw_request_timeout( + self, set_global_async_http_client + ): class MockServerRequestHandler(MyTestHandler): def do_request(self, n): time.sleep(0.02) return super().do_request(n) self.setup_mock_server(MockServerRequestHandler) - stripe.api_base = "http://localhost:%s" % self.mock_server_port # If we set HTTPX's generic timeout the test is flaky (sometimes it's a ReadTimeout, sometimes its a ConnectTimeout) # so we set only the read timeout specifically. hc = stripe.default_http_client @@ -391,11 +400,20 @@ def do_request(self, n): expected_message = "A ServerTimeoutError was raised" else: raise ValueError(f"Unknown http client: {hc.name}") - stripe.max_network_retries = 0 exception = None try: - await stripe.Customer.create_async(description="My test customer") + client = StripeClient( + "sk_test_123", + http_client=hc, + base_addresses={ + "api": "http://localhost:%s" % self.mock_server_port + }, + max_network_retries=0, + ) + await client.raw_request_async( + "post", "/v1/customers", description="My test customer" + ) except stripe.APIConnectionError as e: exception = e @@ -403,7 +421,9 @@ def do_request(self, n): assert expected_message in str(exception.user_message) - async def test_async_retries(self, set_global_async_http_client): + async def test_async_raw_request_retries( + self, set_global_async_http_client + ): class MockServerRequestHandler(MyTestHandler): def do_request(self, n): if n == 0: @@ -417,16 +437,26 @@ def do_request(self, n): pass self.setup_mock_server(MockServerRequestHandler) - stripe.api_base = "http://localhost:%s" % self.mock_server_port - await stripe.Customer.create_async(description="My test customer") + client = StripeClient( + "sk_test_123", + base_addresses={ + "api": "http://localhost:%s" % self.mock_server_port + }, + max_network_retries=stripe.max_network_retries, + ) + await client.raw_request_async( + "post", "/v1/customers", description="My test customer" + ) reqs = MockServerRequestHandler.get_requests(2) req = reqs[0] assert req.path == "/v1/customers" - async def test_async_unretryable(self, set_global_async_http_client): + async def test_async_raw_request_unretryable( + self, set_global_async_http_client + ): class MockServerRequestHandler(MyTestHandler): def do_request(self, n): return ( @@ -438,11 +468,18 @@ def do_request(self, n): pass self.setup_mock_server(MockServerRequestHandler) - stripe.api_base = "http://localhost:%s" % self.mock_server_port exception = None try: - await stripe.Customer.create_async(description="My test customer") + client = StripeClient( + "sk_test_123", + base_addresses={ + "api": "http://localhost:%s" % self.mock_server_port + }, + ) + await client.raw_request_async( + "post", "/v1/customers", description="My test customer" + ) except stripe.AuthenticationError as e: exception = e diff --git a/tests/test_raw_request.py b/tests/test_raw_request.py new file mode 100644 index 000000000..459b0d98b --- /dev/null +++ b/tests/test_raw_request.py @@ -0,0 +1,225 @@ +from __future__ import absolute_import, division, print_function + +import datetime + +import stripe + +from tests.test_api_requestor import GMT1 + + +class TestRawRequest(object): + ENCODE_INPUTS = { + "type": "standard", + "int": 123, + "datetime": datetime.datetime(2013, 1, 1, second=1, tzinfo=GMT1()), + } + POST_REL_URL = "/v1/accounts" + GET_REL_URL = "/v1/accounts/acct_123" + POST_REL_URL_V2 = "/v2/billing/meter_event_session" + GET_REL_URL_V2 = "/v2/accounts/acct_123" + + def test_form_request_get( + self, http_client_mock, stripe_mock_stripe_client + ): + http_client_mock.stub_request( + "get", + path=self.GET_REL_URL, + rbody='{"id": "acct_123", "object": "account"}', + rcode=200, + rheaders={}, + ) + + resp = stripe_mock_stripe_client.raw_request("get", self.GET_REL_URL) + http_client_mock.assert_requested("get", path=self.GET_REL_URL) + + deserialized = stripe_mock_stripe_client.deserialize( + resp, api_mode="V1" + ) + assert isinstance(deserialized, stripe.Account) + + def test_form_request_post( + self, http_client_mock, stripe_mock_stripe_client + ): + http_client_mock.stub_request( + "post", + path=self.POST_REL_URL, + rbody='{"id": "acct_123", "object": "account"}', + rcode=200, + rheaders={}, + ) + + expectation = "type=standard&int=123&datetime=1356994801" + + resp = stripe_mock_stripe_client.raw_request( + "post", self.POST_REL_URL, **self.ENCODE_INPUTS + ) + + http_client_mock.assert_requested( + "post", + path=self.POST_REL_URL, + content_type="application/x-www-form-urlencoded", + post_data=expectation, + ) + + deserialized = stripe_mock_stripe_client.deserialize( + resp, api_mode="V1" + ) + assert isinstance(deserialized, stripe.Account) + + def test_preview_request_post( + self, http_client_mock, stripe_mock_stripe_client + ): + http_client_mock.stub_request( + "post", + path=self.POST_REL_URL_V2, + rbody='{"id": "bmes_123", "object": "billing.meter_event_session"}', + rcode=200, + rheaders={}, + ) + + params = dict({}, **self.ENCODE_INPUTS) + expectation = ( + '{"type": "standard", "int": 123, "datetime": 1356994801}' + ) + + resp = stripe_mock_stripe_client.raw_request( + "post", self.POST_REL_URL_V2, **params + ) + + http_client_mock.assert_requested( + "post", + path=self.POST_REL_URL_V2, + content_type="application/json", + post_data=expectation, + is_json=True, + ) + + deserialized = stripe_mock_stripe_client.deserialize( + resp, api_mode="V2" + ) + assert isinstance(deserialized, stripe.v2.billing.MeterEventSession) + + def test_form_request_with_extra_headers( + self, http_client_mock, stripe_mock_stripe_client + ): + http_client_mock.stub_request( + "get", + path=self.GET_REL_URL, + rbody='{"id": "acct_123", "object": "account"}', + rcode=200, + rheaders={}, + ) + + extra_headers = {"foo": "bar", "Stripe-Account": "acct_123"} + params = {"headers": extra_headers} + + stripe_mock_stripe_client.raw_request( + "get", self.GET_REL_URL, **params + ) + + http_client_mock.assert_requested( + "get", + path=self.GET_REL_URL, + extra_headers=extra_headers, + ) + + def test_preview_request_default_api_version( + self, http_client_mock, stripe_mock_stripe_client + ): + http_client_mock.stub_request( + "get", + path=self.GET_REL_URL_V2, + rbody='{"id": "acct_123", "object": "account"}', + rcode=200, + rheaders={}, + ) + params = {} + + stripe_mock_stripe_client.raw_request( + "get", self.GET_REL_URL_V2, **params + ) + + http_client_mock.assert_requested( + "get", + path=self.GET_REL_URL_V2, + ) + + def test_preview_request_overridden_api_version( + self, http_client_mock, stripe_mock_stripe_client + ): + http_client_mock.stub_request( + "post", + path=self.POST_REL_URL_V2, + rbody='{"id": "acct_123", "object": "account"}', + rcode=200, + rheaders={}, + ) + stripe_version_override = "2023-05-15.preview" + params = { + "stripe_version": stripe_version_override, + } + + stripe_mock_stripe_client.raw_request( + "post", self.POST_REL_URL_V2, **params + ) + + http_client_mock.assert_requested( + "post", + path=self.POST_REL_URL_V2, + content_type="application/json", + stripe_version=stripe_version_override, + post_data="{}", + is_json=True, + ) + + # TODO(jar) this test is not applicable yet, but may be some day + # @pytest.mark.anyio + # async def test_form_request_get_async( + # self, http_client_mock, stripe_mock_stripe_client + # ): + # http_client_mock.stub_request( + # "get", + # path=self.GET_REL_URL, + # rbody='{"id": "acct_123", "object": "account"}', + # rcode=200, + # rheaders={}, + # ) + # + # resp = await stripe_mock_stripe_client.raw_request_async( + # "get", self.GET_REL_URL + # ) + # + # http_client_mock.assert_requested("get", path=self.GET_REL_URL) + # + # deserialized = stripe_mock_stripe_client.deserialize(resp) + # assert isinstance(deserialized, stripe.Account) + # + def test_raw_request_usage_reported( + self, http_client_mock, stripe_mock_stripe_client + ): + http_client_mock.stub_request( + "post", + path=self.POST_REL_URL, + rbody='{"id": "acct_123", "object": "account"}', + rcode=200, + rheaders={}, + ) + + expectation = "type=standard&int=123&datetime=1356994801" + + resp = stripe_mock_stripe_client.raw_request( + "post", self.POST_REL_URL, **self.ENCODE_INPUTS + ) + + http_client_mock.assert_requested( + "post", + path=self.POST_REL_URL, + content_type="application/x-www-form-urlencoded", + post_data=expectation, + usage=["raw_request"], + ) + + deserialized = stripe_mock_stripe_client.deserialize( + resp, api_mode="V1" + ) + assert isinstance(deserialized, stripe.Account) diff --git a/tests/test_request_options.py b/tests/test_request_options.py index b57995ba1..27d1fe026 100644 --- a/tests/test_request_options.py +++ b/tests/test_request_options.py @@ -42,6 +42,7 @@ def test_extract_from_dict(self): "api_key": "sk_test_123", "stripe_version": "2020-01-01", "stripe_account": "acct_123", + "stripe_context": "wksp_123", "idempotency_key": "idemp_123", "headers": { "X-Stripe-Header": "Some-Value", @@ -52,6 +53,7 @@ def test_extract_from_dict(self): assert options.get("api_key") == "sk_test_123" assert options.get("stripe_version") == "2020-01-01" assert options.get("stripe_account") == "acct_123" + assert options.get("stripe_context") == "wksp_123" assert options.get("idempotency_key") == "idemp_123" assert options.get("headers") == {"X-Stripe-Header": "Some-Value"} assert remaining == {"foo": "bar"} diff --git a/tests/test_requestor_options.py b/tests/test_requestor_options.py index 2ed3731ad..b818d39a8 100644 --- a/tests/test_requestor_options.py +++ b/tests/test_requestor_options.py @@ -10,6 +10,7 @@ def test_to_dict(self): requestor = RequestorOptions( api_key="sk_test_123", stripe_account="acct_123", + stripe_context="wksp_123", stripe_version="2019-12-03", base_addresses={ "api": "https://api.example.com", @@ -21,6 +22,7 @@ def test_to_dict(self): assert requestor.to_dict() == { "api_key": "sk_test_123", "stripe_account": "acct_123", + "stripe_context": "wksp_123", "stripe_version": "2019-12-03", "base_addresses": { "api": "https://api.example.com", @@ -38,16 +40,22 @@ def test_global_options_get_updated( orig_api_base = stripe.api_base orig_connect_base = stripe.connect_api_base orig_upload_base = stripe.upload_api_base + orig_meter_events_base = stripe.meter_events_api_base orig_max_network_retries = stripe.max_network_retries assert global_options.api_key == orig_api_key assert global_options.base_addresses["api"] == orig_api_base assert global_options.base_addresses["connect"] == orig_connect_base assert global_options.base_addresses["files"] == orig_upload_base + assert ( + global_options.base_addresses["meter_events"] + == orig_meter_events_base + ) assert global_options.stripe_account is None stripe.api_key = "sk_test_555555555" stripe.api_base = "https://api.example.com" stripe.connect_api_base = "https://connect.example.com" stripe.upload_api_base = "https://upload.example.com" + stripe.meter_events_api_base = "https://meter-events.example.com" stripe.max_network_retries = 3 assert global_options.api_key == "sk_test_555555555" assert ( @@ -61,10 +69,15 @@ def test_global_options_get_updated( global_options.base_addresses["files"] == "https://upload.example.com" ) + assert ( + global_options.base_addresses["meter_events"] + == "https://meter-events.example.com" + ) assert global_options.stripe_account is None assert global_options.max_network_retries == 3 stripe.api_key = orig_api_key stripe.api_base = orig_api_base stripe.connect_api_base = orig_connect_base stripe.upload_api_base = orig_upload_base + stripe.meter_events_api_base = orig_meter_events_base stripe.max_network_retries = orig_max_network_retries diff --git a/tests/test_stripe_client.py b/tests/test_stripe_client.py index 6abfe396b..16a5d53bc 100644 --- a/tests/test_stripe_client.py +++ b/tests/test_stripe_client.py @@ -2,7 +2,11 @@ import stripe import pytest +from stripe.v2._event import Event from stripe._http_client import new_default_http_client +from stripe.events._v1_billing_meter_error_report_triggered_event import ( + V1BillingMeterErrorReportTriggeredEvent, +) class TestStripeClient(object): @@ -28,6 +32,32 @@ def test_v1_customers_retrieve( http_client_mock.assert_requested(method, path=path) assert customer.id is not None + def test_v2_events_retrieve(self, http_client_mock): + method = "get" + path = "/v2/core/events/evt_123" + http_client_mock.stub_request( + method, + path=path, + rbody='{"id": "evt_123","object": "v2.core.event", "type": "v1.billing.meter.error_report_triggered"}', + rcode=200, + rheaders={}, + ) + client = stripe.StripeClient( + api_key="keyinfo_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + event = client.v2.core.events.retrieve("evt_123") + + http_client_mock.assert_requested( + method, + api_base=stripe.DEFAULT_API_BASE, + path=path, + api_key="keyinfo_test_123", + ) + assert event.id is not None + assert isinstance(event, Event) + assert isinstance(event, V1BillingMeterErrorReportTriggeredEvent) + def test_no_api_key(self): with pytest.raises(stripe.error.AuthenticationError): stripe.StripeClient(None) # type: ignore @@ -61,12 +91,14 @@ def test_client_level_options(self, http_client_mock): api_base = "https://example.com" api_key = "sk_test_456" stripe_account = "acct_123" + stripe_context = "wksp_123" stripe_client = stripe.StripeClient( api_key=api_key, http_client=http_client_mock.get_mock_http_client(), base_addresses={"api": api_base}, stripe_account=stripe_account, + stripe_context=stripe_context, ) stripe_client.customers.retrieve("cus_xxxxxxxxxxxxx") @@ -77,6 +109,7 @@ def test_client_level_options(self, http_client_mock): path=path, api_key=api_key, stripe_account=stripe_account, + stripe_context=stripe_context, stripe_version=stripe.api_version, ) @@ -111,15 +144,18 @@ def test_request_level_options(self, http_client_mock): client_api_base = "https://example.com" client_api_key = "sk_test_456" client_stripe_account = "acct_123" + client_stripe_context = "wksp_123" request_api_key = "sk_test_789" request_stripe_account = "acct_456" + request_stripe_context = "wksp_456" stripe_client = stripe.StripeClient( api_key=client_api_key, http_client=http_client_mock.get_mock_http_client(), base_addresses={"api": client_api_base}, stripe_account=client_stripe_account, + stripe_context=client_stripe_context, ) stripe_client.customers.retrieve( @@ -127,6 +163,7 @@ def test_request_level_options(self, http_client_mock): options={ "api_key": request_api_key, "stripe_account": request_stripe_account, + "stripe_context": request_stripe_context, }, ) @@ -136,6 +173,7 @@ def test_request_level_options(self, http_client_mock): path=path, api_key=request_api_key, stripe_account=request_stripe_account, + stripe_context=request_stripe_context, stripe_version=stripe.api_version, ) @@ -179,6 +217,31 @@ def test_separate_clients_have_separate_options(self, http_client_mock): stripe_version=stripe.api_version, ) + def test_v2_encodes_none_as_null(self, http_client_mock): + http_client_mock.stub_request( + "post", + path="/v2/billing/meter_events", + rbody='{"event_name": "cool", "payload": {}, "identifier": null}', + rcode=200, + rheaders={}, + ) + + client = stripe.StripeClient( + api_key="sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.meter_events.create( + {"event_name": "cool", "payload": {}, "identifier": None} # type: ignore - None is not valid for `identifier` + ) + + http_client_mock.assert_requested( + "post", + content_type="application/json", + post_data='{"event_name": "cool", "payload": {}, "identifier": null}', + is_json=True, + ) + def test_carries_over_requestor_options_to_resource( self, http_client_mock ): @@ -230,7 +293,8 @@ def test_user_options_are_not_mutated(self, http_client_mock): http_client_mock.stub_request( "get", - path="/v1/accounts", + path="/v2/core/events", + query_string="object_id=obj_123", rbody='{"data": [{"id": "x"}], "next_page": "page_2"}', rcode=200, rheaders={}, @@ -238,7 +302,9 @@ def test_user_options_are_not_mutated(self, http_client_mock): my_options: stripe.RequestOptions = {"api_key": "sk_test_xyz"} - client.accounts.list(options=my_options) + client.v2.core.events.list( + {"object_id": "obj_123"}, options=my_options + ) assert my_options == {"api_key": "sk_test_xyz"} diff --git a/tests/test_util.py b/tests/test_util.py index df045a749..93b75c84f 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -135,7 +135,7 @@ def test_convert_to_stripe_object_and_back(self): "livemode": False, } - obj = util.convert_to_stripe_object(resp) + obj = util.convert_to_stripe_object(resp, api_mode="V1") assert isinstance(obj, stripe.Balance) assert isinstance(obj.available, list) assert isinstance(obj.available[0], stripe.stripe_object.StripeObject) @@ -149,4 +149,6 @@ def test_convert_to_stripe_object_and_back(self): def test_sanitize_id(self): sanitized_id = util.sanitize_id("cu %x 123") + if isinstance(sanitized_id, bytes): + sanitized_id = sanitized_id.decode("utf-8", "strict") assert sanitized_id == "cu++%25x+123" diff --git a/tests/test_v2_error.py b/tests/test_v2_error.py new file mode 100644 index 000000000..f2828c377 --- /dev/null +++ b/tests/test_v2_error.py @@ -0,0 +1,141 @@ +from __future__ import absolute_import, division, print_function + +import json + +import pytest + +import stripe +from stripe import error +from tests.http_client_mock import HTTPClientMock + + +class TestV2Error(object): + @pytest.fixture(scope="function") + def stripe_client(self, http_client_mock): + return stripe.StripeClient( + api_key="keyinfo_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + def test_raises_v2_error( + self, + stripe_client: stripe.StripeClient, + http_client_mock: HTTPClientMock, + ): + method = "get" + path = "/v2/core/events/evt_123" + + error_response = { + "error": { + "type": "temporary_session_expired", + "code": "session_bad", + "message": "you messed up", + } + } + http_client_mock.stub_request( + method, + path=path, + rbody=json.dumps(error_response), + rcode=400, + rheaders={}, + ) + + try: + stripe_client.v2.core.events.retrieve("evt_123") + except error.TemporarySessionExpiredError as e: + assert e.code == "session_bad" + assert e.error.code == "session_bad" + assert e.error.message == "you messed up" + else: + assert False, "Should have raised a TemporarySessionExpiredError" + + http_client_mock.assert_requested( + method, + path=path, + api_key="keyinfo_test_123", + ) + + @pytest.mark.skip("python doesn't have any errors with invalid params yet") + def test_raises_v2_error_with_field( + self, + stripe_client: stripe.StripeClient, + http_client_mock: HTTPClientMock, + ): + method = "post" + path = "/v2/payment_methods/us_bank_accounts" + + error_response = { + "error": { + "type": "invalid_payment_method", + "code": "invalid_us_bank_account", + "message": "bank account is invalid", + "invalid_param": "routing_number", + } + } + http_client_mock.stub_request( + method, + path=path, + rbody=json.dumps(error_response), + rcode=400, + rheaders={}, + ) + + try: + stripe_client.v2.payment_methods.us_bank_accounts.create( + params={"account_number": "123", "routing_number": "456"} + ) + except error.InvalidPaymentMethodError as e: + assert e.invalid_param == "routing_number" + assert e.error.code == "invalid_us_bank_account" + assert e.error.message == "bank account is invalid" + else: + assert False, "Should have raised a InvalidUsBankAccountError" + + http_client_mock.assert_requested( + method, + path=path, + api_key="keyinfo_test_123", + ) + + def test_falls_back_to_v1_error( + self, + stripe_client: stripe.StripeClient, + http_client_mock: HTTPClientMock, + ): + method = "post" + path = "/v2/billing/meter_events" + + error_response = { + "error": { + "code": "invalid_request", + "message": "your request is invalid", + "param": "invalid_param", + } + } + http_client_mock.stub_request( + method, + path=path, + rbody=json.dumps(error_response), + rcode=400, + rheaders={"request-id": "123"}, + ) + + try: + stripe_client.v2.billing.meter_events.create( + {"event_name": "asdf", "payload": {}} + ) + except error.InvalidRequestError as e: + assert e.param == "invalid_param" + assert repr(e) == ( + "InvalidRequestError(message='your request is invalid', " + "param='invalid_param', code='invalid_request', " + "http_status=400, request_id='123')" + ) + else: + assert False, "Should have raised a InvalidRequestError" + + http_client_mock.assert_requested( + method, + path=path, + api_key="keyinfo_test_123", + ) diff --git a/tests/test_v2_event.py b/tests/test_v2_event.py new file mode 100644 index 000000000..4fbbc7af7 --- /dev/null +++ b/tests/test_v2_event.py @@ -0,0 +1,110 @@ +import json +from typing import Callable + +import pytest + +import stripe +from stripe import ThinEvent +from tests.test_webhook import DUMMY_WEBHOOK_SECRET, generate_header + +EventParser = Callable[[str], ThinEvent] + + +class TestV2Event(object): + @pytest.fixture(scope="function") + def v2_payload_no_data(self): + return json.dumps( + { + "id": "evt_234", + "object": "v2.core.event", + "type": "financial_account.balance.opened", + "created": "2022-02-15T00:27:45.330Z", + "related_object": { + "id": "fa_123", + "type": "financial_account", + "url": "/v2/financial_accounts/fa_123", + "stripe_context": "acct_123", + }, + "reason": { + "id": "foo", + "idempotency_key": "bar", + }, + } + ) + + @pytest.fixture(scope="function") + def v2_payload_with_data(self): + return json.dumps( + { + "id": "evt_234", + "object": "v2.core.event", + "type": "financial_account.balance.opened", + "created": "2022-02-15T00:27:45.330Z", + "related_object": { + "id": "fa_123", + "type": "financial_account", + "url": "/v2/financial_accounts/fa_123", + "stripe_context": "acct_123", + }, + "data": { + "containing_compartment_id": "compid", + "id": "foo", + "type": "bufo", + }, + } + ) + + @pytest.fixture(scope="function") + def stripe_client(self, http_client_mock): + return stripe.StripeClient( + api_key="keyinfo_test_123", + stripe_context="wksp_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + @pytest.fixture(scope="function") + def parse_thin_event( + self, stripe_client: stripe.StripeClient + ) -> EventParser: + """ + helper to simplify parsing and validating events given a payload + returns a function that has the client pre-bound + """ + + def _parse_thin_event(payload: str): + return stripe_client.parse_thin_event( + payload, generate_header(payload=payload), DUMMY_WEBHOOK_SECRET + ) + + return _parse_thin_event + + def test_parses_thin_event( + self, parse_thin_event: EventParser, v2_payload_no_data: str + ): + event = parse_thin_event(v2_payload_no_data) + + assert isinstance(event, ThinEvent) + assert event.id == "evt_234" + + assert event.related_object + assert event.related_object.id == "fa_123" + + assert event.reason + assert event.reason.id == "foo" + + def test_parses_thin_event_with_data( + self, parse_thin_event: EventParser, v2_payload_with_data: str + ): + event = parse_thin_event(v2_payload_with_data) + + assert isinstance(event, ThinEvent) + assert not hasattr(event, "data") + assert event.reason is None + + def test_validates_signature( + self, stripe_client: stripe.StripeClient, v2_payload_no_data + ): + with pytest.raises(stripe.error.SignatureVerificationError): + stripe_client.parse_thin_event( + v2_payload_no_data, "bad header", DUMMY_WEBHOOK_SECRET + ) diff --git a/tests/test_webhook.py b/tests/test_webhook.py index 53389f725..8c190acb7 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -135,7 +135,7 @@ def test_timestamp_off_but_no_tolerance(self): class TestStripeClientConstructEvent(object): def test_construct_event(self, stripe_mock_stripe_client): header = generate_header() - event = stripe_mock_stripe_client.construct_event( + event = stripe_mock_stripe_client.parse_snapshot_event( DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) assert isinstance(event, stripe.Event) @@ -144,21 +144,21 @@ def test_raise_on_json_error(self, stripe_mock_stripe_client): payload = "this is not valid JSON" header = generate_header(payload=payload) with pytest.raises(ValueError): - stripe_mock_stripe_client.construct_event( + stripe_mock_stripe_client.parse_snapshot_event( payload, header, DUMMY_WEBHOOK_SECRET ) def test_raise_on_invalid_header(self, stripe_mock_stripe_client): header = "bad_header" with pytest.raises(stripe.error.SignatureVerificationError): - stripe_mock_stripe_client.construct_event( + stripe_mock_stripe_client.parse_snapshot_event( DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) def test_construct_event_from_bytearray(self, stripe_mock_stripe_client): header = generate_header() payload = bytearray(DUMMY_WEBHOOK_PAYLOAD, "utf-8") - event = stripe_mock_stripe_client.construct_event( + event = stripe_mock_stripe_client.parse_snapshot_event( payload, header, DUMMY_WEBHOOK_SECRET ) assert isinstance(event, stripe.Event) @@ -166,7 +166,7 @@ def test_construct_event_from_bytearray(self, stripe_mock_stripe_client): def test_construct_event_from_bytes(self, stripe_mock_stripe_client): header = generate_header() payload = bytes(DUMMY_WEBHOOK_PAYLOAD, "utf-8") - event = stripe_mock_stripe_client.construct_event( + event = stripe_mock_stripe_client.parse_snapshot_event( payload, header, DUMMY_WEBHOOK_SECRET ) assert isinstance(event, stripe.Event) @@ -181,7 +181,7 @@ def test_construct_event_inherits_requestor(self, http_client_mock): http_client=http_client_mock.get_mock_http_client(), ) header = generate_header() - event = client.construct_event( + event = client.parse_snapshot_event( DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) assert event._requestor == client._requestor From 206b394bac3b52566d9e793a29621d9b1d1d524a Mon Sep 17 00:00:00 2001 From: jar-stripe Date: Tue, 1 Oct 2024 10:01:08 -0700 Subject: [PATCH 02/11] Add Custom requests section to README (#1405) --- README.md | 14 ++++++++++++++ examples/raw_request.py | 15 +++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 examples/raw_request.py diff --git a/README.md b/README.md index 1723b0e2e..62f399fd0 100644 --- a/README.md +++ b/README.md @@ -264,6 +264,20 @@ If your beta feature requires a `Stripe-Version` header to be sent, set the `str stripe.add_beta_version("feature_beta", "v3") ``` +### Custom requests + +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 +client = StripeClient("sk_test_...") +response = client.raw_request( + "post", "/v1/beta_endpoint", param=123, stripe_version="2022-11-15; feature_beta=v3" +) + +# (Optional) response is a StripeResponse. You can use `client.deserialize` to get a StripeObject. +deserialized_resp = client.deserialize(response, api_mode='V1') +``` + ### Async Asynchronous versions of request-making methods are available by suffixing the method name diff --git a/examples/raw_request.py b/examples/raw_request.py new file mode 100644 index 000000000..5d142f909 --- /dev/null +++ b/examples/raw_request.py @@ -0,0 +1,15 @@ +from stripe import StripeClient + +# Set your API key here +api_key = "{{API_KEY}}" + +client = StripeClient(api_key) +response = client.raw_request( + "post", + "/v1/beta_endpoint", + param=123, + stripe_version="2022-11-15; feature_beta=v3", +) + +# (Optional) response is a StripeResponse. You can use `client.deserialize` to get a StripeObject. +deserialized_resp = client.deserialize(response, api_mode="V1") From ae9cfd183377401f2e1658bcf48c8549301441cd Mon Sep 17 00:00:00 2001 From: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:21:18 -0400 Subject: [PATCH 03/11] Removed parseSnapshotEvent (#1406) --- stripe/_stripe_client.py | 2 +- stripe/v2/_event.py | 18 ++++++++++++++++++ tests/test_webhook.py | 12 ++++++------ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index 661c018b1..5ef477d9d 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -283,7 +283,7 @@ def parse_thin_event( return ThinEvent(payload) - def parse_snapshot_event( + def construct_event( self, payload: Union[bytes, str], sig_header: str, diff --git a/stripe/v2/_event.py b/stripe/v2/_event.py index 04c95ca8d..56f160dc0 100644 --- a/stripe/v2/_event.py +++ b/stripe/v2/_event.py @@ -102,11 +102,29 @@ class ThinEvent: """ id: str + """ + Unique identifier for the event. + """ type: str + """ + The type of the event. + """ created: str + """ + Time at which the object was created. + """ context: Optional[str] = None + """ + [Optional] Authentication context needed to fetch the event or related object. + """ related_object: Optional[RelatedObject] = None + """ + [Optional] Object containing the reference to API resource relevant to the event. + """ reason: Optional[Reason] = None + """ + [Optional] Reason for the event. + """ def __init__(self, payload: str) -> None: parsed = json.loads(payload) diff --git a/tests/test_webhook.py b/tests/test_webhook.py index 8c190acb7..53389f725 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -135,7 +135,7 @@ def test_timestamp_off_but_no_tolerance(self): class TestStripeClientConstructEvent(object): def test_construct_event(self, stripe_mock_stripe_client): header = generate_header() - event = stripe_mock_stripe_client.parse_snapshot_event( + event = stripe_mock_stripe_client.construct_event( DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) assert isinstance(event, stripe.Event) @@ -144,21 +144,21 @@ def test_raise_on_json_error(self, stripe_mock_stripe_client): payload = "this is not valid JSON" header = generate_header(payload=payload) with pytest.raises(ValueError): - stripe_mock_stripe_client.parse_snapshot_event( + stripe_mock_stripe_client.construct_event( payload, header, DUMMY_WEBHOOK_SECRET ) def test_raise_on_invalid_header(self, stripe_mock_stripe_client): header = "bad_header" with pytest.raises(stripe.error.SignatureVerificationError): - stripe_mock_stripe_client.parse_snapshot_event( + stripe_mock_stripe_client.construct_event( DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) def test_construct_event_from_bytearray(self, stripe_mock_stripe_client): header = generate_header() payload = bytearray(DUMMY_WEBHOOK_PAYLOAD, "utf-8") - event = stripe_mock_stripe_client.parse_snapshot_event( + event = stripe_mock_stripe_client.construct_event( payload, header, DUMMY_WEBHOOK_SECRET ) assert isinstance(event, stripe.Event) @@ -166,7 +166,7 @@ def test_construct_event_from_bytearray(self, stripe_mock_stripe_client): def test_construct_event_from_bytes(self, stripe_mock_stripe_client): header = generate_header() payload = bytes(DUMMY_WEBHOOK_PAYLOAD, "utf-8") - event = stripe_mock_stripe_client.parse_snapshot_event( + event = stripe_mock_stripe_client.construct_event( payload, header, DUMMY_WEBHOOK_SECRET ) assert isinstance(event, stripe.Event) @@ -181,7 +181,7 @@ def test_construct_event_inherits_requestor(self, http_client_mock): http_client=http_client_mock.get_mock_http_client(), ) header = generate_header() - event = client.parse_snapshot_event( + event = client.construct_event( DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) assert event._requestor == client._requestor From 9bc3689f3736eab961aa937ff9ddee9105b375e9 Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Tue, 1 Oct 2024 11:35:45 -0700 Subject: [PATCH 04/11] Bump version to 11.0.0 --- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ VERSION | 2 +- stripe/_version.py | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e71c80fc2..0fc81f549 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,36 @@ +## 11.0.0 - 2024-10-01 +* [#1404](https://github.com/stripe/stripe-python/pull/1404) Support for APIs in the new API version 2024-09-30.acacia + + This release changes the pinned API version to `2024-09-30.acacia`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-09-30.acacia) and carefully review the API changes before upgrading. + + ### ⚠️ Breaking changes due to changes in the API + + + * Rename for `usage_threshold_config` to `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` + * Remove support for `filter` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert`. Use the filters on the `usage_threshold` instead + * * Remove support for `customer_consent_collected` on parameter class `stripe.terminal.Reader.ProcessSetupIntentParams` + + ### ⚠️ Other Breaking changes in the SDK + * Adjusted default values for HTTP requests. You can use the old defaults by setting them explicitly. New values are: + - max retries: `0` -> `2` + - max timeout (seconds): `2` -> `5` + * Add method `parse_thin_event()` on the `StripeClient` class to parse [thin events](https://docs.corp.stripe.com/event-destinations#events-overview). Rename `construct_event()` method on the same class to `parse_snapshot_event()` to clearly distinguish between the two kinds of events. + + ### Additions + + * Add support for `custom_unit_amount` on parameter class `stripe.Product.CreateParamsDefaultPriceData` + * Add support for `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` + * Add support for `allow_redisplay` on parameter classes `stripe.terminal.Reader.ProcessPaymentIntentParamsProcessConfig` and `stripe.terminal.Reader.ProcessSetupIntentParams` + * Add support for `international_transaction` on enum `stripe.treasury.ReceivedCredit.failure_code` + * Add support for `2024-09-30.acacia` on enum `stripe.WebhookEndpoint.CreateParams.api_version` + * Add support for new Usage Billing APIs `stripe.v2.billing.MeterEvent`, `stripe.v2.billing.MeterEventAdjustments`, `stripe.v2.billing.MeterEventSession`, `stripe.v2.billing.MeterEventStream` and the new Events API `stripe.v2.core.Events` under the [v2 namespace ](https://docs.corp.stripe.com/api-v2-overview) + * Add method [rawRequest()](https://github.com/stripe/stripe-python/tree/master?tab=readme-ov-file#custom-requests) on the `StripeClient` class that takes a HTTP method type, url and relevant parameters to make requests to the Stripe API that are not yet supported in the SDK. + + ### Other changes + * Change type of `default_allowed_updates` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Literal['price', 'promotion_code', 'quantity']]]` to `NotRequired[Literal['']|List[Literal['price', 'promotion_code', 'quantity']]]` + * Change type of `products` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` to `NotRequired[Literal['']|List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` + + ## 10.12.0 - 2024-09-18 * [#1394](https://github.com/stripe/stripe-python/pull/1394) Update generated code * Add support for `international_transaction` on enum `stripe.treasury.ReceivedDebit.failure_code` diff --git a/VERSION b/VERSION index c4d592e16..275283a18 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.12.0 +11.0.0 diff --git a/stripe/_version.py b/stripe/_version.py index b20ec0ac7..cbbc18cb3 100644 --- a/stripe/_version.py +++ b/stripe/_version.py @@ -1 +1 @@ -VERSION = "10.12.0" +VERSION = "11.0.0" From 9dc810fb2dc371f8c01853acfa97814e0c758870 Mon Sep 17 00:00:00 2001 From: Jesse Rosalia Date: Wed, 2 Oct 2024 10:58:22 -0700 Subject: [PATCH 05/11] updated generated files --- stripe/_account_session.py | 21 +++++++++++++++++++++ stripe/_account_session_service.py | 21 +++++++++++++++++++++ stripe/_credit_note.py | 25 +++++++++++++++++++++++++ stripe/_invoice.py | 29 +++++++++++++++++++++++++++++ stripe/_invoice_line_item.py | 2 +- stripe/_quote.py | 6 ------ stripe/_quote_preview_invoice.py | 29 +++++++++++++++++++++++++++++ stripe/terminal/_reader.py | 6 ++++++ stripe/terminal/_reader_service.py | 6 ++++++ 9 files changed, 138 insertions(+), 7 deletions(-) diff --git a/stripe/_account_session.py b/stripe/_account_session.py index 65c6a707c..80e02eabe 100644 --- a/stripe/_account_session.py +++ b/stripe/_account_session.py @@ -407,6 +407,12 @@ class CreateParamsComponents(TypedDict): recipients: NotRequired[ "AccountSession.CreateParamsComponentsRecipients" ] + reporting_chart: NotRequired[ + "AccountSession.CreateParamsComponentsReportingChart" + ] + """ + Configuration for the reporting chart embedded component. + """ tax_registrations: NotRequired[ "AccountSession.CreateParamsComponentsTaxRegistrations" ] @@ -831,6 +837,21 @@ class CreateParamsComponentsRecipients(TypedDict): class CreateParamsComponentsRecipientsFeatures(TypedDict): pass + class CreateParamsComponentsReportingChart(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSession.CreateParamsComponentsReportingChartFeatures" + ] + """ + The list of features enabled in the embedded component. + """ + + class CreateParamsComponentsReportingChartFeatures(TypedDict): + pass + class CreateParamsComponentsTaxRegistrations(TypedDict): enabled: bool """ diff --git a/stripe/_account_session_service.py b/stripe/_account_session_service.py index 6416d983c..7dff8241f 100644 --- a/stripe/_account_session_service.py +++ b/stripe/_account_session_service.py @@ -146,6 +146,12 @@ class CreateParamsComponents(TypedDict): recipients: NotRequired[ "AccountSessionService.CreateParamsComponentsRecipients" ] + reporting_chart: NotRequired[ + "AccountSessionService.CreateParamsComponentsReportingChart" + ] + """ + Configuration for the reporting chart embedded component. + """ tax_registrations: NotRequired[ "AccountSessionService.CreateParamsComponentsTaxRegistrations" ] @@ -570,6 +576,21 @@ class CreateParamsComponentsRecipients(TypedDict): class CreateParamsComponentsRecipientsFeatures(TypedDict): pass + class CreateParamsComponentsReportingChart(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSessionService.CreateParamsComponentsReportingChartFeatures" + ] + """ + The list of features enabled in the embedded component. + """ + + class CreateParamsComponentsReportingChartFeatures(TypedDict): + pass + class CreateParamsComponentsTaxRegistrations(TypedDict): enabled: bool """ diff --git a/stripe/_credit_note.py b/stripe/_credit_note.py index f3b6423d6..d07108438 100644 --- a/stripe/_credit_note.py +++ b/stripe/_credit_note.py @@ -27,6 +27,9 @@ from stripe._refund import Refund as RefundResource from stripe._shipping_rate import ShippingRate from stripe._tax_rate import TaxRate + from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction, + ) @nested_resource_class_methods("line") @@ -53,6 +56,26 @@ class DiscountAmount(StripeObject): The discount that was applied to get this discount amount. """ + class PretaxCreditAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the pretax credit amount. + """ + credit_balance_transaction: Optional[ + ExpandableField["CreditBalanceTransaction"] + ] + """ + The credit balance transaction that was applied to get this pretax credit amount. + """ + discount: Optional[ExpandableField["Discount"]] + """ + The discount that was applied to get this pretax credit amount. + """ + type: Literal["credit_balance_transaction", "discount"] + """ + Type of the pretax credit amount referenced. + """ + class Refund(StripeObject): amount_refunded: int """ @@ -765,6 +788,7 @@ class VoidCreditNoteParams(RequestOptions): """ post_payment_amount: Optional[int] pre_payment_amount: Optional[int] + pretax_credit_amounts: Optional[List[PretaxCreditAmount]] reason: Optional[ Literal[ "duplicate", "fraudulent", "order_change", "product_unsatisfactory" @@ -1180,6 +1204,7 @@ async def list_lines_async( _inner_class_types = { "discount_amounts": DiscountAmount, + "pretax_credit_amounts": PretaxCreditAmount, "refunds": Refund, "shipping_cost": ShippingCost, "tax_amounts": TaxAmount, diff --git a/stripe/_invoice.py b/stripe/_invoice.py index d22f75a63..2f0d607b5 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -51,6 +51,9 @@ from stripe._subscription import Subscription from stripe._tax_id import TaxId from stripe._tax_rate import TaxRate + from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction, + ) from stripe.test_helpers._test_clock import TestClock @@ -1044,6 +1047,30 @@ class TotalMarginAmount(StripeObject): The margin that was applied to get this margin amount. """ + class TotalPretaxCreditAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the pretax credit amount. + """ + credit_balance_transaction: Optional[ + ExpandableField["CreditBalanceTransaction"] + ] + """ + The credit balance transaction that was applied to get this pretax credit amount. + """ + discount: Optional[ExpandableField["Discount"]] + """ + The discount that was applied to get this pretax credit amount. + """ + margin: Optional[ExpandableField["Margin"]] + """ + The margin that was applied to get this pretax credit amount. + """ + type: Literal["credit_balance_transaction", "discount", "margin"] + """ + Type of the pretax credit amount referenced. + """ + class TotalTaxAmount(StripeObject): amount: int """ @@ -9543,6 +9570,7 @@ class VoidInvoiceParams(RequestOptions): """ The aggregate amounts calculated per margin across all line items. """ + total_pretax_credit_amounts: Optional[List[TotalPretaxCreditAmount]] total_tax_amounts: List[TotalTaxAmount] """ The aggregate amounts calculated per tax rate for all line items. @@ -11375,6 +11403,7 @@ async def retrieve_payment_async( "threshold_reason": ThresholdReason, "total_discount_amounts": TotalDiscountAmount, "total_margin_amounts": TotalMarginAmount, + "total_pretax_credit_amounts": TotalPretaxCreditAmount, "total_tax_amounts": TotalTaxAmount, "transfer_data": TransferData, } diff --git a/stripe/_invoice_line_item.py b/stripe/_invoice_line_item.py index f9d5a6e77..0c89f89bc 100644 --- a/stripe/_invoice_line_item.py +++ b/stripe/_invoice_line_item.py @@ -86,7 +86,7 @@ class PretaxCreditAmount(StripeObject): """ The margin that was applied to get this pretax credit amount. """ - type: Literal["credit_balance_transaction", "discount"] + type: Literal["credit_balance_transaction", "discount", "margin"] """ Type of the pretax credit amount referenced. """ diff --git a/stripe/_quote.py b/stripe/_quote.py index fc88d32c4..2222f6dc1 100644 --- a/stripe/_quote.py +++ b/stripe/_quote.py @@ -605,12 +605,6 @@ class Prebilling(StripeObject): """ Behavior of the subscription schedule and underlying subscription when it ends. """ - from_schedule: Optional[ - ExpandableField["SubscriptionScheduleResource"] - ] - """ - The id of the subscription schedule that will be updated when the quote is accepted. - """ from_subscription: Optional[ExpandableField["Subscription"]] """ The id of the subscription that will be updated when the quote is accepted. diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 89ae85449..c9103410d 100644 --- a/stripe/_quote_preview_invoice.py +++ b/stripe/_quote_preview_invoice.py @@ -25,6 +25,9 @@ from stripe._subscription import Subscription from stripe._tax_id import TaxId from stripe._tax_rate import TaxRate + from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction, + ) from stripe.test_helpers._test_clock import TestClock @@ -1026,6 +1029,30 @@ class TotalMarginAmount(StripeObject): The margin that was applied to get this margin amount. """ + class TotalPretaxCreditAmount(StripeObject): + amount: int + """ + The amount, in cents (or local equivalent), of the pretax credit amount. + """ + credit_balance_transaction: Optional[ + ExpandableField["CreditBalanceTransaction"] + ] + """ + The credit balance transaction that was applied to get this pretax credit amount. + """ + discount: Optional[ExpandableField["Discount"]] + """ + The discount that was applied to get this pretax credit amount. + """ + margin: Optional[ExpandableField["Margin"]] + """ + The margin that was applied to get this pretax credit amount. + """ + type: Literal["credit_balance_transaction", "discount", "margin"] + """ + Type of the pretax credit amount referenced. + """ + class TotalTaxAmount(StripeObject): amount: int """ @@ -1399,6 +1426,7 @@ class TransferData(StripeObject): """ The aggregate amounts calculated per margin across all line items. """ + total_pretax_credit_amounts: Optional[List[TotalPretaxCreditAmount]] total_tax_amounts: List[TotalTaxAmount] """ The aggregate amounts calculated per tax rate for all line items. @@ -1431,6 +1459,7 @@ class TransferData(StripeObject): "threshold_reason": ThresholdReason, "total_discount_amounts": TotalDiscountAmount, "total_margin_amounts": TotalMarginAmount, + "total_pretax_credit_amounts": TotalPretaxCreditAmount, "total_tax_amounts": TotalTaxAmount, "transfer_data": TransferData, } diff --git a/stripe/terminal/_reader.py b/stripe/terminal/_reader.py index 4e701e337..8263c2d70 100644 --- a/stripe/terminal/_reader.py +++ b/stripe/terminal/_reader.py @@ -570,6 +570,12 @@ class CollectPaymentMethodParams(RequestOptions): """ class CollectPaymentMethodParamsCollectConfig(TypedDict): + allow_redisplay: NotRequired[ + Literal["always", "limited", "unspecified"] + ] + """ + This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. + """ enable_customer_cancellation: NotRequired[bool] """ Enables cancel button on transaction screens. diff --git a/stripe/terminal/_reader_service.py b/stripe/terminal/_reader_service.py index 52bb73373..16bb62d75 100644 --- a/stripe/terminal/_reader_service.py +++ b/stripe/terminal/_reader_service.py @@ -123,6 +123,12 @@ class CollectPaymentMethodParams(TypedDict): """ class CollectPaymentMethodParamsCollectConfig(TypedDict): + allow_redisplay: NotRequired[ + Literal["always", "limited", "unspecified"] + ] + """ + This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. + """ enable_customer_cancellation: NotRequired[bool] """ Enables cancel button on transaction screens. From a9116761a6fa46259f329fe6cafd555a3f94f340 Mon Sep 17 00:00:00 2001 From: Jesse Rosalia Date: Wed, 2 Oct 2024 15:22:57 -0700 Subject: [PATCH 06/11] restored latest beta version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 275283a18..cc346aab7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -11.0.0 +10.13.0b1 From 731c922481bde665ca9fee025cc4c898fc03ea27 Mon Sep 17 00:00:00 2001 From: Jesse Rosalia Date: Wed, 2 Oct 2024 15:25:53 -0700 Subject: [PATCH 07/11] reverted formatting --- CHANGELOG.md | 3446 ++++++++++++++++++++++---------------------------- 1 file changed, 1517 insertions(+), 1929 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b848e84a8..72d630a2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,695 +1,642 @@ # Changelog ## 11.0.0 - 2024-10-01 +* [#1404](https://github.com/stripe/stripe-python/pull/1404) Support for APIs in the new API version 2024-09-30.acacia -- [#1404](https://github.com/stripe/stripe-python/pull/1404) Support for APIs in the new API version 2024-09-30.acacia + This release changes the pinned API version to `2024-09-30.acacia`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-09-30.acacia) and carefully review the API changes before upgrading. - This release changes the pinned API version to `2024-09-30.acacia`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-09-30.acacia) and carefully review the API changes before upgrading. + ### ⚠️ Breaking changes due to changes in the API - ### ⚠️ Breaking changes due to changes in the API - - Rename for `usage_threshold_config` to `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` - - Remove support for `filter` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert`. Use the filters on the `usage_threshold` instead - - - Remove support for `customer_consent_collected` on parameter class `stripe.terminal.Reader.ProcessSetupIntentParams` + * Rename for `usage_threshold_config` to `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` + * Remove support for `filter` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert`. Use the filters on the `usage_threshold` instead + * * Remove support for `customer_consent_collected` on parameter class `stripe.terminal.Reader.ProcessSetupIntentParams` - ### ⚠️ Other Breaking changes in the SDK + ### ⚠️ Other Breaking changes in the SDK + * Adjusted default values for HTTP requests. You can use the old defaults by setting them explicitly. New values are: + - max retries: `0` -> `2` + - max timeout (seconds): `2` -> `5` + * Add method `parse_thin_event()` on the `StripeClient` class to parse [thin events](https://docs.corp.stripe.com/event-destinations#events-overview). Rename `construct_event()` method on the same class to `parse_snapshot_event()` to clearly distinguish between the two kinds of events. - - Adjusted default values for HTTP requests. You can use the old defaults by setting them explicitly. New values are: - - max retries: `0` -> `2` - - max timeout (seconds): `2` -> `5` - - Add method `parse_thin_event()` on the `StripeClient` class to parse [thin events](https://docs.corp.stripe.com/event-destinations#events-overview). Rename `construct_event()` method on the same class to `parse_snapshot_event()` to clearly distinguish between the two kinds of events. + ### Additions - ### Additions + * Add support for `custom_unit_amount` on parameter class `stripe.Product.CreateParamsDefaultPriceData` + * Add support for `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` + * Add support for `allow_redisplay` on parameter classes `stripe.terminal.Reader.ProcessPaymentIntentParamsProcessConfig` and `stripe.terminal.Reader.ProcessSetupIntentParams` + * Add support for `international_transaction` on enum `stripe.treasury.ReceivedCredit.failure_code` + * Add support for `2024-09-30.acacia` on enum `stripe.WebhookEndpoint.CreateParams.api_version` + * Add support for new Usage Billing APIs `stripe.v2.billing.MeterEvent`, `stripe.v2.billing.MeterEventAdjustments`, `stripe.v2.billing.MeterEventSession`, `stripe.v2.billing.MeterEventStream` and the new Events API `stripe.v2.core.Events` under the [v2 namespace ](https://docs.corp.stripe.com/api-v2-overview) + * Add method [rawRequest()](https://github.com/stripe/stripe-python/tree/master?tab=readme-ov-file#custom-requests) on the `StripeClient` class that takes a HTTP method type, url and relevant parameters to make requests to the Stripe API that are not yet supported in the SDK. - - Add support for `custom_unit_amount` on parameter class `stripe.Product.CreateParamsDefaultPriceData` - - Add support for `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` - - Add support for `allow_redisplay` on parameter classes `stripe.terminal.Reader.ProcessPaymentIntentParamsProcessConfig` and `stripe.terminal.Reader.ProcessSetupIntentParams` - - Add support for `international_transaction` on enum `stripe.treasury.ReceivedCredit.failure_code` - - Add support for `2024-09-30.acacia` on enum `stripe.WebhookEndpoint.CreateParams.api_version` - - Add support for new Usage Billing APIs `stripe.v2.billing.MeterEvent`, `stripe.v2.billing.MeterEventAdjustments`, `stripe.v2.billing.MeterEventSession`, `stripe.v2.billing.MeterEventStream` and the new Events API `stripe.v2.core.Events` under the [v2 namespace ](https://docs.corp.stripe.com/api-v2-overview) - - Add method [rawRequest()](https://github.com/stripe/stripe-python/tree/master?tab=readme-ov-file#custom-requests) on the `StripeClient` class that takes a HTTP method type, url and relevant parameters to make requests to the Stripe API that are not yet supported in the SDK. - - ### Other changes - - - Change type of `default_allowed_updates` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Literal['price', 'promotion_code', 'quantity']]]` to `NotRequired[Literal['']|List[Literal['price', 'promotion_code', 'quantity']]]` - - Change type of `products` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` to `NotRequired[Literal['']|List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` + ### Other changes + * Change type of `default_allowed_updates` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Literal['price', 'promotion_code', 'quantity']]]` to `NotRequired[Literal['']|List[Literal['price', 'promotion_code', 'quantity']]]` + * Change type of `products` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` to `NotRequired[Literal['']|List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` ## 10.13.0b1 - 2024-09-18 - -- [#1395](https://github.com/stripe/stripe-python/pull/1395) Update generated code for beta - - Add support for `send_money` on parameter class `stripe.AccountSession.CreateParamsComponentsFinancialAccountFeatures` - - Add support for `transfer_balance` on parameter class `stripe.AccountSession.CreateParamsComponentsFinancialAccountFeatures` - - Add support for `automatically_finalizes_at` on resource `stripe.QuotePreviewInvoice` - - Remove support for resource `stripe.QuotePhase` - - Add support for `rechnung` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` - - Add support for `terminal_reader_invalid_location_for_activation` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` +* [#1395](https://github.com/stripe/stripe-python/pull/1395) Update generated code for beta + * Add support for `send_money` on parameter class `stripe.AccountSession.CreateParamsComponentsFinancialAccountFeatures` + * Add support for `transfer_balance` on parameter class `stripe.AccountSession.CreateParamsComponentsFinancialAccountFeatures` + * Add support for `automatically_finalizes_at` on resource `stripe.QuotePreviewInvoice` + * Remove support for resource `stripe.QuotePhase` + * Add support for `rechnung` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` + * Add support for `terminal_reader_invalid_location_for_activation` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` ## 10.12.0 - 2024-09-18 - -- [#1394](https://github.com/stripe/stripe-python/pull/1394) Update generated code - - Add support for `international_transaction` on enum `stripe.treasury.ReceivedDebit.failure_code` -- [#1393](https://github.com/stripe/stripe-python/pull/1393) Update generated code - - Add support for `payer_details` on resource class `stripe.Charge.PaymentMethodDetails.Klarna` - - Add support for `amazon_pay` on resource class `stripe.Dispute.PaymentMethodDetails` - - Add support for `automatically_finalizes_at` on resource `stripe.Invoice` - - Add support for `state_sales_tax` on resource class `stripe.tax.Registration.CountryOptions.Us` and parameter class `stripe.tax.Registration.CreateParamsCountryOptionsUs` - - Add support for `verification_supportability` on enums `stripe.Account.FutureRequirements.Error.code`, `stripe.Account.Requirements.Error.code`, `stripe.BankAccount.FutureRequirements.Error.code`, `stripe.BankAccount.Requirements.Error.code`, `stripe.Capability.FutureRequirements.Error.code`, `stripe.Capability.Requirements.Error.code`, `stripe.Person.FutureRequirements.Error.code`, and `stripe.Person.Requirements.Error.code` - - Add support for `amazon_pay` on enum `stripe.Dispute.PaymentMethodDetails.type` - - Add support for `terminal_reader_invalid_location_for_activation` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` +* [#1394](https://github.com/stripe/stripe-python/pull/1394) Update generated code + * Add support for `international_transaction` on enum `stripe.treasury.ReceivedDebit.failure_code` +* [#1393](https://github.com/stripe/stripe-python/pull/1393) Update generated code + * Add support for `payer_details` on resource class `stripe.Charge.PaymentMethodDetails.Klarna` + * Add support for `amazon_pay` on resource class `stripe.Dispute.PaymentMethodDetails` + * Add support for `automatically_finalizes_at` on resource `stripe.Invoice` + * Add support for `state_sales_tax` on resource class `stripe.tax.Registration.CountryOptions.Us` and parameter class `stripe.tax.Registration.CreateParamsCountryOptionsUs` + * Add support for `verification_supportability` on enums `stripe.Account.FutureRequirements.Error.code`, `stripe.Account.Requirements.Error.code`, `stripe.BankAccount.FutureRequirements.Error.code`, `stripe.BankAccount.Requirements.Error.code`, `stripe.Capability.FutureRequirements.Error.code`, `stripe.Capability.Requirements.Error.code`, `stripe.Person.FutureRequirements.Error.code`, and `stripe.Person.Requirements.Error.code` + * Add support for `amazon_pay` on enum `stripe.Dispute.PaymentMethodDetails.type` + * Add support for `terminal_reader_invalid_location_for_activation` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` ## 10.12.0b1 - 2024-09-13 - -- [#1389](https://github.com/stripe/stripe-python/pull/1389) Update generated code for beta - - Add support for `template` on resource class `stripe.QuotePreviewInvoice.Rendering` - - Add support for resource `stripe.issuing.DisputeSettlementDetail` - - Add support for resource `stripe.issuing.Settlement` - - Add support for `settlement` on parameter class `stripe.issuing.Transaction.ListParams` and resource `stripe.issuing.Transaction` - - Remove support for `list` on resource `stripe.QuotePhase` - - Add support for `rechnung` on enum `stripe.checkout.Session.CreateParams.payment_method_types` - - Add support for `issuing_dispute_settlement_detail.created` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `issuing_dispute_settlement_detail.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `issuing_settlement.created` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `issuing_settlement.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` +* [#1389](https://github.com/stripe/stripe-python/pull/1389) Update generated code for beta + * Add support for `template` on resource class `stripe.QuotePreviewInvoice.Rendering` + * Add support for resource `stripe.issuing.DisputeSettlementDetail` + * Add support for resource `stripe.issuing.Settlement` + * Add support for `settlement` on parameter class `stripe.issuing.Transaction.ListParams` and resource `stripe.issuing.Transaction` + * Remove support for `list` on resource `stripe.QuotePhase` + * Add support for `rechnung` on enum `stripe.checkout.Session.CreateParams.payment_method_types` + * Add support for `issuing_dispute_settlement_detail.created` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `issuing_dispute_settlement_detail.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `issuing_settlement.created` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `issuing_settlement.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` ## 10.11.0 - 2024-09-12 - -- [#1391](https://github.com/stripe/stripe-python/pull/1391) Update generated code - - Add support for `template` on parameter classes `stripe.Customer.CreateParamsInvoiceSettingsRenderingOptions`, `stripe.Customer.ModifyParamsInvoiceSettingsRenderingOptions`, `stripe.Invoice.CreateParamsRendering`, and `stripe.Invoice.ModifyParamsRendering` and resource classes `stripe.Customer.InvoiceSettings.RenderingOptions` and `stripe.Invoice.Rendering` - - Add support for resource `stripe.InvoiceRenderingTemplate` - - Add support for `required` on parameter classes `stripe.PaymentLink.CreateParamsTaxIdCollection`, `stripe.PaymentLink.ModifyParamsTaxIdCollection`, and `stripe.checkout.Session.CreateParamsTaxIdCollection` and resource classes `stripe.PaymentLink.TaxIdCollection` and `stripe.checkout.Session.TaxIdCollection` - - Add support for `submitted` on enum `stripe.issuing.Card.Shipping.status` - - Change type of `tax_amounts` on `stripe.InvoiceLineItem` from `Optional[List[TaxAmount]]` to `List[TaxAmount]` - - Change type of `tax_rates` on `stripe.InvoiceLineItem` from `Optional[List[TaxRate]]` to `List[TaxRate]` - - Change type of `status_details` on `stripe.test_helpers.TestClock` from `Optional[StatusDetails]` to `StatusDetails` +* [#1391](https://github.com/stripe/stripe-python/pull/1391) Update generated code + * Add support for `template` on parameter classes `stripe.Customer.CreateParamsInvoiceSettingsRenderingOptions`, `stripe.Customer.ModifyParamsInvoiceSettingsRenderingOptions`, `stripe.Invoice.CreateParamsRendering`, and `stripe.Invoice.ModifyParamsRendering` and resource classes `stripe.Customer.InvoiceSettings.RenderingOptions` and `stripe.Invoice.Rendering` + * Add support for resource `stripe.InvoiceRenderingTemplate` + * Add support for `required` on parameter classes `stripe.PaymentLink.CreateParamsTaxIdCollection`, `stripe.PaymentLink.ModifyParamsTaxIdCollection`, and `stripe.checkout.Session.CreateParamsTaxIdCollection` and resource classes `stripe.PaymentLink.TaxIdCollection` and `stripe.checkout.Session.TaxIdCollection` + * Add support for `submitted` on enum `stripe.issuing.Card.Shipping.status` + * Change type of `tax_amounts` on `stripe.InvoiceLineItem` from `Optional[List[TaxAmount]]` to `List[TaxAmount]` + * Change type of `tax_rates` on `stripe.InvoiceLineItem` from `Optional[List[TaxRate]]` to `List[TaxRate]` + * Change type of `status_details` on `stripe.test_helpers.TestClock` from `Optional[StatusDetails]` to `StatusDetails` ## 10.11.0b1 - 2024-09-05 - -- [#1387](https://github.com/stripe/stripe-python/pull/1387) Update generated code for beta - - Add support for `recipients` on parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for resource `stripe.billing.MeterErrorReport` - - Add support for `business_name` on resource class `stripe.checkout.Session.CollectedInformation` - - Add support for `tax_ids` on resource class `stripe.checkout.Session.CollectedInformation` - - Add support for `billing.meter_error_report.triggered` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `mb_way` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` -- [#1386](https://github.com/stripe/stripe-python/pull/1386) Merge from master -- [#1384](https://github.com/stripe/stripe-python/pull/1384) Merge from master after the changes to not pass api_mode from individual methods -- [#1380](https://github.com/stripe/stripe-python/pull/1380) Update generated code for beta - - Add support for `email` on resource class `stripe.checkout.Session.CollectedInformation` - - Add support for `phone` on resource class `stripe.checkout.Session.CollectedInformation` - - Add support for `regulatory_reporting_file` on parameter classes `stripe.issuing.CreditUnderwritingRecord.CorrectParams`, `stripe.issuing.CreditUnderwritingRecord.CreateFromProactiveReviewParams`, and `stripe.issuing.CreditUnderwritingRecord.ReportDecisionParams` and resource `stripe.issuing.CreditUnderwritingRecord` - - Add support for resource `stripe.terminal.ReaderCollectedData` - - Remove support for `rechnung` on parameter class `stripe.PaymentMethod.ModifyParams` - - Add support for `mb_way` on enum `stripe.checkout.Session.CreateParams.payment_method_types` - - Add support for `terminal_reader_collected_data_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` +* [#1387](https://github.com/stripe/stripe-python/pull/1387) Update generated code for beta + * Add support for `recipients` on parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for resource `stripe.billing.MeterErrorReport` + * Add support for `business_name` on resource class `stripe.checkout.Session.CollectedInformation` + * Add support for `tax_ids` on resource class `stripe.checkout.Session.CollectedInformation` + * Add support for `billing.meter_error_report.triggered` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `mb_way` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` +* [#1386](https://github.com/stripe/stripe-python/pull/1386) Merge from master +* [#1384](https://github.com/stripe/stripe-python/pull/1384) Merge from master after the changes to not pass api_mode from individual methods +* [#1380](https://github.com/stripe/stripe-python/pull/1380) Update generated code for beta + * Add support for `email` on resource class `stripe.checkout.Session.CollectedInformation` + * Add support for `phone` on resource class `stripe.checkout.Session.CollectedInformation` + * Add support for `regulatory_reporting_file` on parameter classes `stripe.issuing.CreditUnderwritingRecord.CorrectParams`, `stripe.issuing.CreditUnderwritingRecord.CreateFromProactiveReviewParams`, and `stripe.issuing.CreditUnderwritingRecord.ReportDecisionParams` and resource `stripe.issuing.CreditUnderwritingRecord` + * Add support for resource `stripe.terminal.ReaderCollectedData` + * Remove support for `rechnung` on parameter class `stripe.PaymentMethod.ModifyParams` + * Add support for `mb_way` on enum `stripe.checkout.Session.CreateParams.payment_method_types` + * Add support for `terminal_reader_collected_data_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` ## 10.10.0 - 2024-09-05 - -- [#1376](https://github.com/stripe/stripe-python/pull/1376) Update generated code - - Add support for `subscription` on parameter class `stripe.billing.Alert.CreateParamsFilter` - - Change type of `customer_consent_collected` on `stripe.terminal.Reader.ProcessSetupIntentParams` from `bool` to `NotRequired[bool]` +* [#1376](https://github.com/stripe/stripe-python/pull/1376) Update generated code + * Add support for `subscription` on parameter class `stripe.billing.Alert.CreateParamsFilter` + * Change type of `customer_consent_collected` on `stripe.terminal.Reader.ProcessSetupIntentParams` from `bool` to `NotRequired[bool]` ## 10.9.0 - 2024-08-29 - -- [#1385](https://github.com/stripe/stripe-python/pull/1385) Generate SDK for OpenAPI spec version 1230 - - Add support for `status_details` on resource `stripe.test_helpers.TestClock` - - Change type of `fields` on `stripe.AccountLink.CreateParamsCollectionOptions` from `Literal['currently_due', 'eventually_due']` to `NotRequired[Literal['currently_due', 'eventually_due']]` - - Add support for `hr_oib` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `issuing_regulatory_reporting` on enums `stripe.File.purpose`, `stripe.File.CreateParams.purpose`, and `stripe.File.ListParams.purpose` +* [#1385](https://github.com/stripe/stripe-python/pull/1385) Generate SDK for OpenAPI spec version 1230 + * Add support for `status_details` on resource `stripe.test_helpers.TestClock` + * Change type of `fields` on `stripe.AccountLink.CreateParamsCollectionOptions` from `Literal['currently_due', 'eventually_due']` to `NotRequired[Literal['currently_due', 'eventually_due']]` + * Add support for `hr_oib` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `issuing_regulatory_reporting` on enums `stripe.File.purpose`, `stripe.File.CreateParams.purpose`, and `stripe.File.ListParams.purpose` ## 10.9.0b2 - 2024-08-22 - -- [#1377](https://github.com/stripe/stripe-python/pull/1377) Update generated code for beta - - Add support for `mb_way_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` - - Add support for `mb_way` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, and `stripe.PaymentIntent.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData`, and resource `stripe.PaymentMethod` - - Remove support for `phases` on parameter classes `stripe.Quote.CreateParams` and `stripe.Quote.ModifyParams` - - Remove support for `from_schedule` on parameter class `stripe.Quote.CreateParamsSubscriptionData` - - Add support for `mb_way` on enums `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` - - Add support for `hr_oib` on enums `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, and `stripe.QuotePreviewInvoice.CustomerTaxId.type` - - Remove support for `accepted` on enum `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3.status` - - Remove support for `partner_rejected` on enum `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3.status` - - Remove support for `submitted` on enum `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3.status` +* [#1377](https://github.com/stripe/stripe-python/pull/1377) Update generated code for beta + * Add support for `mb_way_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` + * Add support for `mb_way` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, and `stripe.PaymentIntent.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData`, and resource `stripe.PaymentMethod` + * Remove support for `phases` on parameter classes `stripe.Quote.CreateParams` and `stripe.Quote.ModifyParams` + * Remove support for `from_schedule` on parameter class `stripe.Quote.CreateParamsSubscriptionData` + * Add support for `mb_way` on enums `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` + * Add support for `hr_oib` on enums `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, and `stripe.QuotePreviewInvoice.CustomerTaxId.type` + * Remove support for `accepted` on enum `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3.status` + * Remove support for `partner_rejected` on enum `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3.status` + * Remove support for `submitted` on enum `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3.status` ## 10.9.0b1 - 2024-08-15 - -- [#1375](https://github.com/stripe/stripe-python/pull/1375) Update generated code for beta - - Add support for `capital_financing` on parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `permissions` on parameter class `stripe.checkout.Session.CreateParams` and resource `stripe.checkout.Session` - - Add support for `collected_information` on parameter class `stripe.checkout.Session.ModifyParams` and resource `stripe.checkout.Session` - - Add support for `shipping_options` on parameter class `stripe.checkout.Session.ModifyParams` +* [#1375](https://github.com/stripe/stripe-python/pull/1375) Update generated code for beta + * Add support for `capital_financing` on parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `permissions` on parameter class `stripe.checkout.Session.CreateParams` and resource `stripe.checkout.Session` + * Add support for `collected_information` on parameter class `stripe.checkout.Session.ModifyParams` and resource `stripe.checkout.Session` + * Add support for `shipping_options` on parameter class `stripe.checkout.Session.ModifyParams` ## 10.8.0 - 2024-08-15 - -- [#1373](https://github.com/stripe/stripe-python/pull/1373) Update generated code - - Add support for `authorization_code` on resource class `stripe.Charge.PaymentMethodDetails.Card` - - Add support for `wallet` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.CardPresent`, `stripe.PaymentMethod.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, and `stripe.PaymentMethod.CardPresent` - - Add support for `mandate_options` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsBacsDebit`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsBacsDebit`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsBacsDebit` and resource class `stripe.PaymentIntent.PaymentMethodOptions.BacsDebit` - - Add support for `bacs_debit` on parameter classes `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, and `stripe.SetupIntent.ModifyParamsPaymentMethodOptions` and resource class `stripe.SetupIntent.PaymentMethodOptions` - - Add support for `chips` on resource classes `stripe.treasury.OutboundPayment.TrackingDetails.UsDomesticWire` and `stripe.treasury.OutboundTransfer.TrackingDetails.UsDomesticWire` and parameter classes `stripe.treasury.OutboundPayment.UpdateParamsTrackingDetailsUsDomesticWire` and `stripe.treasury.OutboundTransfer.UpdateParamsTrackingDetailsUsDomesticWire` - - Change type of `imad` on `stripe.treasury.OutboundPayment.TrackingDetails.UsDomesticWire` and `stripe.treasury.OutboundTransfer.TrackingDetails.UsDomesticWire` from `str` to `Optional[str]` +* [#1373](https://github.com/stripe/stripe-python/pull/1373) Update generated code + * Add support for `authorization_code` on resource class `stripe.Charge.PaymentMethodDetails.Card` + * Add support for `wallet` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.CardPresent`, `stripe.PaymentMethod.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, and `stripe.PaymentMethod.CardPresent` + * Add support for `mandate_options` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsBacsDebit`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsBacsDebit`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsBacsDebit` and resource class `stripe.PaymentIntent.PaymentMethodOptions.BacsDebit` + * Add support for `bacs_debit` on parameter classes `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, and `stripe.SetupIntent.ModifyParamsPaymentMethodOptions` and resource class `stripe.SetupIntent.PaymentMethodOptions` + * Add support for `chips` on resource classes `stripe.treasury.OutboundPayment.TrackingDetails.UsDomesticWire` and `stripe.treasury.OutboundTransfer.TrackingDetails.UsDomesticWire` and parameter classes `stripe.treasury.OutboundPayment.UpdateParamsTrackingDetailsUsDomesticWire` and `stripe.treasury.OutboundTransfer.UpdateParamsTrackingDetailsUsDomesticWire` + * Change type of `imad` on `stripe.treasury.OutboundPayment.TrackingDetails.UsDomesticWire` and `stripe.treasury.OutboundTransfer.TrackingDetails.UsDomesticWire` from `str` to `Optional[str]` ## 10.8.0b1 - 2024-08-12 - -- [#1372](https://github.com/stripe/stripe-python/pull/1372) Update generated code for beta - - Add support for `capital_financing` on resource class `stripe.AccountSession.Components` - - Add support for `payto` on parameter class `stripe.checkout.Session.CreateParamsPaymentMethodOptions` and resource class `stripe.checkout.Session.PaymentMethodOptions` - - ⚠️ Remove support for `risk_correlation_id` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsRechnung`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsRechnung`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsRechnung` and resource class `stripe.PaymentIntent.PaymentMethodOptions.Rechnung` - - Add support for `custom` on enums `stripe.checkout.Session.ui_mode` and `stripe.checkout.Session.CreateParams.ui_mode` - - Add support for `payto` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` - - Add support for `invalid_mandate_reference_prefix_format` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` +* [#1372](https://github.com/stripe/stripe-python/pull/1372) Update generated code for beta + * Add support for `capital_financing` on resource class `stripe.AccountSession.Components` + * Add support for `payto` on parameter class `stripe.checkout.Session.CreateParamsPaymentMethodOptions` and resource class `stripe.checkout.Session.PaymentMethodOptions` + * ⚠️ Remove support for `risk_correlation_id` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsRechnung`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsRechnung`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsRechnung` and resource class `stripe.PaymentIntent.PaymentMethodOptions.Rechnung` + * Add support for `custom` on enums `stripe.checkout.Session.ui_mode` and `stripe.checkout.Session.CreateParams.ui_mode` + * Add support for `payto` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` + * Add support for `invalid_mandate_reference_prefix_format` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` ## 10.7.0 - 2024-08-08 - -- [#1371](https://github.com/stripe/stripe-python/pull/1371) Update generated code - - Add support for `type` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent.Offline`, `stripe.ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetails.CardPresent.Offline`, `stripe.PaymentMethod.Card.GeneratedFrom.PaymentMethodDetails.CardPresent.Offline`, and `stripe.SetupAttempt.PaymentMethodDetails.CardPresent.Offline` - - Add support for `offline` on resource classes `stripe.ConfirmationToken.PaymentMethodPreview.CardPresent` and `stripe.PaymentMethod.CardPresent` - - Add support for `_cls_activate` on resource `stripe.billing.Alert` - - Add support for `_cls_archive` on resource `stripe.billing.Alert` - - Add support for `_cls_deactivate` on resource `stripe.billing.Alert` - - Add support for `activate` on resource `stripe.billing.Alert` - - Add support for `archive` on resource `stripe.billing.Alert` - - Add support for `create` on resource `stripe.billing.Alert` - - Add support for `deactivate` on resource `stripe.billing.Alert` - - Add support for `list` on resource `stripe.billing.Alert` - - Add support for `retrieve` on resources `stripe.billing.Alert` and `stripe.tax.Calculation` - - Add support for `related_customer` on parameter classes `stripe.identity.VerificationSession.CreateParams` and `stripe.identity.VerificationSession.ListParams` and resource `stripe.identity.VerificationSession` - - Add support for `invalid_mandate_reference_prefix_format` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Add support for `girocard` on enums `stripe.PaymentIntent.PaymentMethodOptions.Card.network`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsCard.network`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsCard.network`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsCard.network`, `stripe.SetupIntent.PaymentMethodOptions.Card.network`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptionsCard.network`, `stripe.SetupIntent.CreateParamsPaymentMethodOptionsCard.network`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptionsCard.network`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.Card.network`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptionsCard.network`, and `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptionsCard.network` - - Add support for `financial_addresses.aba.forwarding` on enums `stripe.treasury.FinancialAccount.active_features`, `stripe.treasury.FinancialAccount.pending_features`, and `stripe.treasury.FinancialAccount.restricted_features` - - Change type of `count` on `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsCardInstallmentsPlan`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsCardInstallmentsPlan` from `int` to `NotRequired[int]` - - Change type of `interval` on `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsCardInstallmentsPlan`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsCardInstallmentsPlan` from `Literal['month']` to `NotRequired[Literal['month']]` - - Change type of `account` on `stripe.Person.AdditionalTosAcceptances` from `Account` to `Optional[Account]` +* [#1371](https://github.com/stripe/stripe-python/pull/1371) Update generated code + * Add support for `type` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent.Offline`, `stripe.ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetails.CardPresent.Offline`, `stripe.PaymentMethod.Card.GeneratedFrom.PaymentMethodDetails.CardPresent.Offline`, and `stripe.SetupAttempt.PaymentMethodDetails.CardPresent.Offline` + * Add support for `offline` on resource classes `stripe.ConfirmationToken.PaymentMethodPreview.CardPresent` and `stripe.PaymentMethod.CardPresent` + * Add support for `_cls_activate` on resource `stripe.billing.Alert` + * Add support for `_cls_archive` on resource `stripe.billing.Alert` + * Add support for `_cls_deactivate` on resource `stripe.billing.Alert` + * Add support for `activate` on resource `stripe.billing.Alert` + * Add support for `archive` on resource `stripe.billing.Alert` + * Add support for `create` on resource `stripe.billing.Alert` + * Add support for `deactivate` on resource `stripe.billing.Alert` + * Add support for `list` on resource `stripe.billing.Alert` + * Add support for `retrieve` on resources `stripe.billing.Alert` and `stripe.tax.Calculation` + * Add support for `related_customer` on parameter classes `stripe.identity.VerificationSession.CreateParams` and `stripe.identity.VerificationSession.ListParams` and resource `stripe.identity.VerificationSession` + * Add support for `invalid_mandate_reference_prefix_format` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Add support for `girocard` on enums `stripe.PaymentIntent.PaymentMethodOptions.Card.network`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsCard.network`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsCard.network`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsCard.network`, `stripe.SetupIntent.PaymentMethodOptions.Card.network`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptionsCard.network`, `stripe.SetupIntent.CreateParamsPaymentMethodOptionsCard.network`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptionsCard.network`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.Card.network`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptionsCard.network`, and `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptionsCard.network` + * Add support for `financial_addresses.aba.forwarding` on enums `stripe.treasury.FinancialAccount.active_features`, `stripe.treasury.FinancialAccount.pending_features`, and `stripe.treasury.FinancialAccount.restricted_features` + * Change type of `count` on `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsCardInstallmentsPlan`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsCardInstallmentsPlan` from `int` to `NotRequired[int]` + * Change type of `interval` on `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsCardInstallmentsPlan`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsCardInstallmentsPlan`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsCardInstallmentsPlan` from `Literal['month']` to `NotRequired[Literal['month']]` + * Change type of `account` on `stripe.Person.AdditionalTosAcceptances` from `Account` to `Optional[Account]` ## 10.7.0b1 - 2024-08-01 - -- [#1370](https://github.com/stripe/stripe-python/pull/1370) Update generated code for beta - - Add support for `app_install` on parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `app_viewport` on parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `_cls_attach_payment` on resource `stripe.Invoice` - - Add support for `attach_payment` on resource `stripe.Invoice` - - Add support for `lines_invalid` on resource class `stripe.Quote.StatusDetails.Stale.LastReason` - - Add support for `last_price_migration_error` on resources `stripe.QuotePreviewSubscriptionSchedule`, `stripe.Subscription`, and `stripe.SubscriptionSchedule` - - Remove support for `partner_rejected_details` on resource class `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3` - - Add support for `customer.subscription.price_migration_failed` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `subscription_schedule.price_migration_failed` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `lines_invalid` on enum `stripe.Quote.StatusDetails.Stale.LastReason.type` - - Add support for `charge_exceeds_transaction_limit` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` +* [#1370](https://github.com/stripe/stripe-python/pull/1370) Update generated code for beta + * Add support for `app_install` on parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `app_viewport` on parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `_cls_attach_payment` on resource `stripe.Invoice` + * Add support for `attach_payment` on resource `stripe.Invoice` + * Add support for `lines_invalid` on resource class `stripe.Quote.StatusDetails.Stale.LastReason` + * Add support for `last_price_migration_error` on resources `stripe.QuotePreviewSubscriptionSchedule`, `stripe.Subscription`, and `stripe.SubscriptionSchedule` + * Remove support for `partner_rejected_details` on resource class `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3` + * Add support for `customer.subscription.price_migration_failed` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `subscription_schedule.price_migration_failed` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `lines_invalid` on enum `stripe.Quote.StatusDetails.Stale.LastReason.type` + * Add support for `charge_exceeds_transaction_limit` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` ## 10.6.0 - 2024-08-01 - -- [#1369](https://github.com/stripe/stripe-python/pull/1369) Update generated code - - Add support for resource `stripe.billing.Alert` - - ⚠️ Remove support for `authorization_code` on resource class `stripe.Charge.PaymentMethodDetails.Card`. This was accidentally released last week. - - Add support for `billing.alert.triggered` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `charge_exceeds_transaction_limit` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` +* [#1369](https://github.com/stripe/stripe-python/pull/1369) Update generated code + * Add support for resource `stripe.billing.Alert` + * ⚠️ Remove support for `authorization_code` on resource class `stripe.Charge.PaymentMethodDetails.Card`. This was accidentally released last week. + * Add support for `billing.alert.triggered` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `charge_exceeds_transaction_limit` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` ## 10.6.0b1 - 2024-07-25 - -- [#1361](https://github.com/stripe/stripe-python/pull/1361) Update generated code for beta - - Add support for `capital` on parameter class `stripe.Account.CreateParamsSettings` and resource class `stripe.Account.Settings` - - Add support for `payment` on resource `stripe.InvoicePayment` - - Add support for `async_workflows` on parameter classes `stripe.PaymentIntent.CaptureParams`, `stripe.PaymentIntent.ConfirmParams`, `stripe.PaymentIntent.CreateParams`, `stripe.PaymentIntent.DecrementAuthorizationParams`, `stripe.PaymentIntent.IncrementAuthorizationParams`, and `stripe.PaymentIntent.ModifyParams` and resource `stripe.PaymentIntent` - - Add support for `payto` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` - - Add support for resource `stripe.billing.Alert` - - Add support for resource `stripe.tax.Association` - - Add support for `display_name` on parameter classes `stripe.treasury.FinancialAccount.CreateParams` and `stripe.treasury.FinancialAccount.ModifyParams` and resource `stripe.treasury.FinancialAccount` - - Remove support for `charge` on resource `stripe.InvoicePayment` - - Remove support for `payment_intent` on resource `stripe.InvoicePayment` - - Add support for `issuing.account_closed_for_not_providing_business_model_clarification` on enum `stripe.AccountNotice.reason` - - Add support for `issuing.account_closed_for_not_providing_url_clarification` on enum `stripe.AccountNotice.reason` - - Add support for `issuing.account_closed_for_not_providing_use_case_clarification` on enum `stripe.AccountNotice.reason` - - Add support for `billing.alert.triggered` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `multibanco` on enum `stripe.QuotePreviewInvoice.PaymentSettings.payment_method_types` +* [#1361](https://github.com/stripe/stripe-python/pull/1361) Update generated code for beta + * Add support for `capital` on parameter class `stripe.Account.CreateParamsSettings` and resource class `stripe.Account.Settings` + * Add support for `payment` on resource `stripe.InvoicePayment` + * Add support for `async_workflows` on parameter classes `stripe.PaymentIntent.CaptureParams`, `stripe.PaymentIntent.ConfirmParams`, `stripe.PaymentIntent.CreateParams`, `stripe.PaymentIntent.DecrementAuthorizationParams`, `stripe.PaymentIntent.IncrementAuthorizationParams`, and `stripe.PaymentIntent.ModifyParams` and resource `stripe.PaymentIntent` + * Add support for `payto` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` + * Add support for resource `stripe.billing.Alert` + * Add support for resource `stripe.tax.Association` + * Add support for `display_name` on parameter classes `stripe.treasury.FinancialAccount.CreateParams` and `stripe.treasury.FinancialAccount.ModifyParams` and resource `stripe.treasury.FinancialAccount` + * Remove support for `charge` on resource `stripe.InvoicePayment` + * Remove support for `payment_intent` on resource `stripe.InvoicePayment` + * Add support for `issuing.account_closed_for_not_providing_business_model_clarification` on enum `stripe.AccountNotice.reason` + * Add support for `issuing.account_closed_for_not_providing_url_clarification` on enum `stripe.AccountNotice.reason` + * Add support for `issuing.account_closed_for_not_providing_use_case_clarification` on enum `stripe.AccountNotice.reason` + * Add support for `billing.alert.triggered` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `multibanco` on enum `stripe.QuotePreviewInvoice.PaymentSettings.payment_method_types` ## 10.5.0 - 2024-07-25 - -- [#1368](https://github.com/stripe/stripe-python/pull/1368) Update generated code - - Add support for `tax_registrations` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `tax_settings` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` -- [#1364](https://github.com/stripe/stripe-python/pull/1364) Update generated code - - Add support for `transaction_id` on resource class `stripe.Charge.PaymentMethodDetails.Affirm` - - Add support for `buyer_id` on resource class `stripe.Charge.PaymentMethodDetails.Blik` - - Add support for `authorization_code` on resource class `stripe.Charge.PaymentMethodDetails.Card` - - Add support for `brand_product` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.CardPresent`, `stripe.PaymentMethod.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, and `stripe.PaymentMethod.CardPresent` - - Add support for `network_transaction_id` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent`, `stripe.Charge.PaymentMethodDetails.InteracPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, and `stripe.PaymentMethod.Card.GeneratedFrom.PaymentMethodDetails.CardPresent` - - Add support for `case_type` on resource class `stripe.Dispute.PaymentMethodDetails.Card` - - Add support for `twint` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` - - Add support for `modify` on resource `stripe.checkout.Session` - - Add support for `invoice.overdue` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `invoice.will_be_due` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` +* [#1368](https://github.com/stripe/stripe-python/pull/1368) Update generated code + * Add support for `tax_registrations` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `tax_settings` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` +* [#1364](https://github.com/stripe/stripe-python/pull/1364) Update generated code + * Add support for `transaction_id` on resource class `stripe.Charge.PaymentMethodDetails.Affirm` + * Add support for `buyer_id` on resource class `stripe.Charge.PaymentMethodDetails.Blik` + * Add support for `authorization_code` on resource class `stripe.Charge.PaymentMethodDetails.Card` + * Add support for `brand_product` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.CardPresent`, `stripe.PaymentMethod.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, and `stripe.PaymentMethod.CardPresent` + * Add support for `network_transaction_id` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent`, `stripe.Charge.PaymentMethodDetails.InteracPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetails.CardPresent`, and `stripe.PaymentMethod.Card.GeneratedFrom.PaymentMethodDetails.CardPresent` + * Add support for `case_type` on resource class `stripe.Dispute.PaymentMethodDetails.Card` + * Add support for `twint` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` + * Add support for `modify` on resource `stripe.checkout.Session` + * Add support for `invoice.overdue` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `invoice.will_be_due` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` ## 10.4.0 - 2024-07-18 - -- [#1362](https://github.com/stripe/stripe-python/pull/1362) Update generated code - - Add support for `customer` on resource class `stripe.ConfirmationToken.PaymentMethodPreview` - - Add support for `issuing_dispute.funds_rescinded` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `multibanco` on enums `stripe.Invoice.PaymentSettings.payment_method_types`, `stripe.Invoice.CreateParamsPaymentSettings.payment_method_types`, `stripe.Invoice.ModifyParamsPaymentSettings.payment_method_types`, `stripe.Subscription.PaymentSettings.payment_method_types`, `stripe.Subscription.CreateParamsPaymentSettings.payment_method_types`, and `stripe.Subscription.ModifyParamsPaymentSettings.payment_method_types` - - Add support for `stripe_s700` on enums `stripe.terminal.Reader.device_type` and `stripe.terminal.Reader.ListParams.device_type` -- [#1360](https://github.com/stripe/stripe-python/pull/1360) Update changelog +* [#1362](https://github.com/stripe/stripe-python/pull/1362) Update generated code + * Add support for `customer` on resource class `stripe.ConfirmationToken.PaymentMethodPreview` + * Add support for `issuing_dispute.funds_rescinded` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `multibanco` on enums `stripe.Invoice.PaymentSettings.payment_method_types`, `stripe.Invoice.CreateParamsPaymentSettings.payment_method_types`, `stripe.Invoice.ModifyParamsPaymentSettings.payment_method_types`, `stripe.Subscription.PaymentSettings.payment_method_types`, `stripe.Subscription.CreateParamsPaymentSettings.payment_method_types`, and `stripe.Subscription.ModifyParamsPaymentSettings.payment_method_types` + * Add support for `stripe_s700` on enums `stripe.terminal.Reader.device_type` and `stripe.terminal.Reader.ListParams.device_type` +* [#1360](https://github.com/stripe/stripe-python/pull/1360) Update changelog ## 10.4.0b1 - 2024-07-11 - -- [#1356](https://github.com/stripe/stripe-python/pull/1356) Update generated code for beta - - Change type of `payment_element` on `stripe.CustomerSession.Components` from `Optional[PaymentElement]` to `PaymentElement` - - Add support for `not_qualified` on enum `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3.status` - - Remove support for `billing_policy_remote_function_response_invalid` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` - - Remove support for `billing_policy_remote_function_timeout` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` - - Remove support for `billing_policy_remote_function_unexpected_status_code` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` - - Remove support for `billing_policy_remote_function_unreachable` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` - - Remove support for `payment_intent_fx_quote_invalid` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` +* [#1356](https://github.com/stripe/stripe-python/pull/1356) Update generated code for beta + * Change type of `payment_element` on `stripe.CustomerSession.Components` from `Optional[PaymentElement]` to `PaymentElement` + * Add support for `not_qualified` on enum `stripe.Dispute.EvidenceDetails.EnhancedEligibility.VisaCompellingEvidence3.status` + * Remove support for `billing_policy_remote_function_response_invalid` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` + * Remove support for `billing_policy_remote_function_timeout` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` + * Remove support for `billing_policy_remote_function_unexpected_status_code` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` + * Remove support for `billing_policy_remote_function_unreachable` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` + * Remove support for `payment_intent_fx_quote_invalid` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` ## 10.3.0 - 2024-07-11 - -- [#1358](https://github.com/stripe/stripe-python/pull/1358) Update generated code - - Add support for `payment_method_options` on resource `stripe.ConfirmationToken` - - Add support for `payment_element` on resource class `stripe.CustomerSession.Components` and parameter class `stripe.CustomerSession.CreateParamsComponents` - - Add support for `address_validation` on parameter class `stripe.issuing.Card.CreateParamsShipping` and resource class `stripe.issuing.Card.Shipping` - - Add support for `shipping` on parameter class `stripe.issuing.Card.ModifyParams` - - ⚠️ Remove support for `billing_policy_remote_function_response_invalid`, `billing_policy_remote_function_timeout`, `billing_policy_remote_function_unexpected_status_code`, and `billing_policy_remote_function_unreachable` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - ⚠️ Remove support for `payment_intent_fx_quote_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code`. The property was mistakenly released last week. - - [#1357](https://github.com/stripe/stripe-python/pull/1357) don't auto-organize imports +* [#1358](https://github.com/stripe/stripe-python/pull/1358) Update generated code + * Add support for `payment_method_options` on resource `stripe.ConfirmationToken` + * Add support for `payment_element` on resource class `stripe.CustomerSession.Components` and parameter class `stripe.CustomerSession.CreateParamsComponents` + * Add support for `address_validation` on parameter class `stripe.issuing.Card.CreateParamsShipping` and resource class `stripe.issuing.Card.Shipping` + * Add support for `shipping` on parameter class `stripe.issuing.Card.ModifyParams` + * ⚠️ Remove support for `billing_policy_remote_function_response_invalid`, `billing_policy_remote_function_timeout`, `billing_policy_remote_function_unexpected_status_code`, and `billing_policy_remote_function_unreachable` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * ⚠️ Remove support for `payment_intent_fx_quote_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code`. The property was mistakenly released last week. + * [#1357](https://github.com/stripe/stripe-python/pull/1357) don't auto-organize imports ## 10.3.0b1 - 2024-07-05 - -- [#1355](https://github.com/stripe/stripe-python/pull/1355) Update generated code for beta - - ⚠️ Remove support for `payment_method_update` on resource class `stripe.CustomerSession.Components.PaymentElement.Features` and parameter class `stripe.CustomerSession.CreateParamsComponentsPaymentElementFeatures`. Users are expected to completely migrate from using payment_method_update. - - Add support for `payment_method_allow_redisplay_filters`, `payment_method_redisplay`, `payment_method_save_usage` on resource class `stripe.CustomerSession.Components.PaymentElement.Features` and parameter class `stripe.CustomerSession.CreateParamsComponentsPaymentElementFeatures` - - Add support for `institution` on parameter classes `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.SetupIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, and `stripe.financial_connections.Session.CreateParamsFilters` and resource classes `stripe.Invoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.PaymentIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.QuotePreviewInvoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.SetupIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.checkout.Session.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, and `stripe.financial_connections.Session.Filters` - - Add support for resource `stripe.financial_connections.Institution` - - Add support for `balance` on enums `stripe.financial_connections.Account.subscriptions`, `stripe.financial_connections.Account.SubscribeParams.features`, and `stripe.financial_connections.Account.UnsubscribeParams.features` - - Add support for `financial_connections_institution_unavailable` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Add support for `payment_intent_fx_quote_invalid` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` +* [#1355](https://github.com/stripe/stripe-python/pull/1355) Update generated code for beta + * ⚠️ Remove support for `payment_method_update` on resource class `stripe.CustomerSession.Components.PaymentElement.Features` and parameter class `stripe.CustomerSession.CreateParamsComponentsPaymentElementFeatures`. Users are expected to completely migrate from using payment_method_update. + * Add support for `payment_method_allow_redisplay_filters`, `payment_method_redisplay`, `payment_method_save_usage` on resource class `stripe.CustomerSession.Components.PaymentElement.Features` and parameter class `stripe.CustomerSession.CreateParamsComponentsPaymentElementFeatures` + * Add support for `institution` on parameter classes `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.SetupIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters`, and `stripe.financial_connections.Session.CreateParamsFilters` and resource classes `stripe.Invoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.PaymentIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.QuotePreviewInvoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.SetupIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, `stripe.checkout.Session.PaymentMethodOptions.UsBankAccount.FinancialConnections.Filters`, and `stripe.financial_connections.Session.Filters` + * Add support for resource `stripe.financial_connections.Institution` + * Add support for `balance` on enums `stripe.financial_connections.Account.subscriptions`, `stripe.financial_connections.Account.SubscribeParams.features`, and `stripe.financial_connections.Account.UnsubscribeParams.features` + * Add support for `financial_connections_institution_unavailable` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Add support for `payment_intent_fx_quote_invalid` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` ## 10.2.0 - 2024-07-05 - -- [#1354](https://github.com/stripe/stripe-python/pull/1354) Update generated code - - Add support for `_cls_add_lines`, `_cls_remove_lines`, `_cls_update_lines`, `add_lines`, `remove_lines`, `update_lines` on resource `stripe.Invoice` - - Add support for `posted_at` on parameter class `stripe.tax.Transaction.CreateFromCalculationParams` and resource `stripe.tax.Transaction` - - Add support for `payment_intent_fx_quote_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` +* [#1354](https://github.com/stripe/stripe-python/pull/1354) Update generated code + * Add support for `_cls_add_lines`, `_cls_remove_lines`, `_cls_update_lines`, `add_lines`, `remove_lines`, `update_lines` on resource `stripe.Invoice` + * Add support for `posted_at` on parameter class `stripe.tax.Transaction.CreateFromCalculationParams` and resource `stripe.tax.Transaction` + * Add support for `payment_intent_fx_quote_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` ## 10.2.0b1 - 2024-06-27 - -- [#1349](https://github.com/stripe/stripe-python/pull/1349) Update generated code for beta - - Add support for `filters` on resource class `stripe.QuotePreviewInvoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections` - - Remove support for `payment_method_set_as_default` on resource class `stripe.CustomerSession.Components.PaymentElement.Features` and parameter class `stripe.CustomerSession.CreateParamsComponentsPaymentElementFeatures` - - Add support for `ch_uid` on enums `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, and `stripe.QuotePreviewInvoice.CustomerTaxId.type` +* [#1349](https://github.com/stripe/stripe-python/pull/1349) Update generated code for beta + * Add support for `filters` on resource class `stripe.QuotePreviewInvoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections` + * Remove support for `payment_method_set_as_default` on resource class `stripe.CustomerSession.Components.PaymentElement.Features` and parameter class `stripe.CustomerSession.CreateParamsComponentsPaymentElementFeatures` + * Add support for `ch_uid` on enums `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, and `stripe.QuotePreviewInvoice.CustomerTaxId.type` ## 10.1.0 - 2024-06-27 - -- [#1353](https://github.com/stripe/stripe-python/pull/1353) Update generated code - - Add support for `email_type` on parameter classes `stripe.CreditNote.CreateParams`, `stripe.CreditNote.PreviewLinesParams`, and `stripe.CreditNote.PreviewParams` - - Add support for `filters` on parameter classes `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.SetupIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections`, and `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections` and resource classes `stripe.Invoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections`, `stripe.PaymentIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections`, `stripe.SetupIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections`, and `stripe.checkout.Session.PaymentMethodOptions.UsBankAccount.FinancialConnections` - - Add support for `account_subcategories` on parameter class `stripe.financial_connections.Session.CreateParamsFilters` and resource class `stripe.financial_connections.Session.Filters` - - Add support for `reboot_window` on parameter classes `stripe.terminal.Configuration.CreateParams` and `stripe.terminal.Configuration.ModifyParams` and resource `stripe.terminal.Configuration` - - Add support for `day` on enum `stripe.billing.Meter.ListEventSummariesParams.value_grouping_window` - - Add support for `multibanco` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` - - Add support for `twint` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` - - Add support for `zip` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` +* [#1353](https://github.com/stripe/stripe-python/pull/1353) Update generated code + * Add support for `email_type` on parameter classes `stripe.CreditNote.CreateParams`, `stripe.CreditNote.PreviewLinesParams`, and `stripe.CreditNote.PreviewParams` + * Add support for `filters` on parameter classes `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.SetupIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections`, and `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections` and resource classes `stripe.Invoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections`, `stripe.PaymentIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections`, `stripe.SetupIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections`, and `stripe.checkout.Session.PaymentMethodOptions.UsBankAccount.FinancialConnections` + * Add support for `account_subcategories` on parameter class `stripe.financial_connections.Session.CreateParamsFilters` and resource class `stripe.financial_connections.Session.Filters` + * Add support for `reboot_window` on parameter classes `stripe.terminal.Configuration.CreateParams` and `stripe.terminal.Configuration.ModifyParams` and resource `stripe.terminal.Configuration` + * Add support for `day` on enum `stripe.billing.Meter.ListEventSummariesParams.value_grouping_window` + * Add support for `multibanco` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` + * Add support for `twint` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` + * Add support for `zip` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` ## 10.0.0 - 2024-06-24 +* [#1350](https://github.com/stripe/stripe-python/pull/1350) Update generated code -- [#1350](https://github.com/stripe/stripe-python/pull/1350) Update generated code - - This release changes the pinned API version to 2024-06-20. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-06-20) and carefully review the API changes before upgrading. + This release changes the pinned API version to 2024-06-20. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-06-20) and carefully review the API changes before upgrading. - ### ⚠️ Breaking changes + ### ⚠️ Breaking changes - - Remove the unused resource `PlatformTaxFee` - - Rename `volume_decimal` to `quantity_decimal` on parameter classes `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel` and resource class `stripe.issuing.Transaction.PurchaseDetails.Fuel` + * Remove the unused resource `PlatformTaxFee` + * Rename `volume_decimal` to `quantity_decimal` on parameter classes `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel` and resource class `stripe.issuing.Transaction.PurchaseDetails.Fuel` - ### Additions + ### Additions - - Add support for `fleet` on parameter classes `stripe.issuing.Authorization.CaptureParamsPurchaseDetails`, `stripe.issuing.Authorization.CreateParams`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetails`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetails`, resource `stripe.issuing.Authorization`, and resource class `stripe.issuing.Transaction.PurchaseDetails` - - Add support for new values `platform_disabled`, `paused.inactivity` and `other` on enums `Capability.Requirements.disabled_reason` and `Capability.FutureRequirements.disabled_reason` - - Add support for `industry_product_code` on parameter classes `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel` and resource class `stripe.issuing.Transaction.PurchaseDetails.Fuel` - - Add support for `quantity_decimal` on parameter classes `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel` and resource class `stripe.issuing.Transaction.PurchaseDetails.Fuel` - - Add support for `fuel` on parameter class `stripe.issuing.Authorization.CreateParams` and resource `stripe.issuing.Authorization` - - Add support for `_cls_finalize_amount` on resource `stripe.issuing.Authorization` - - Add support for `finalize_amount` on resource `stripe.issuing.Authorization` - - Change type of `disabled_reason` on `stripe.Capability.FutureRequirements` and `stripe.Capability.Requirements` from `str` to `Literal['other', 'paused.inactivity', 'pending.onboarding', 'pending.review', 'platform_disabled', 'platform_paused', 'rejected.inactivity', 'rejected.other', 'rejected.unsupported_business', 'requirements.fields_needed']` - - Add support for `ch_uid` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `card_canceled`, `card_expired`, `cardholder_blocked`, `insecure_authorization_method` and `pin_blocked` on enum `stripe.issuing.Authorization.RequestHistory.reason` - - Add support for `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `pound`, on enums `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel.unit`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel.unit`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel.unit` - - Add support for `2024-06-20` on enum `stripe.WebhookEndpoint.CreateParams.api_version` + * Add support for `fleet` on parameter classes `stripe.issuing.Authorization.CaptureParamsPurchaseDetails`, `stripe.issuing.Authorization.CreateParams`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetails`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetails`, resource `stripe.issuing.Authorization`, and resource class `stripe.issuing.Transaction.PurchaseDetails` + * Add support for new values `platform_disabled`, `paused.inactivity` and `other` on enums `Capability.Requirements.disabled_reason` and `Capability.FutureRequirements.disabled_reason` + * Add support for `industry_product_code` on parameter classes `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel` and resource class `stripe.issuing.Transaction.PurchaseDetails.Fuel` + * Add support for `quantity_decimal` on parameter classes `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel` and resource class `stripe.issuing.Transaction.PurchaseDetails.Fuel` + * Add support for `fuel` on parameter class `stripe.issuing.Authorization.CreateParams` and resource `stripe.issuing.Authorization` + * Add support for `_cls_finalize_amount` on resource `stripe.issuing.Authorization` + * Add support for `finalize_amount` on resource `stripe.issuing.Authorization` + * Change type of `disabled_reason` on `stripe.Capability.FutureRequirements` and `stripe.Capability.Requirements` from `str` to `Literal['other', 'paused.inactivity', 'pending.onboarding', 'pending.review', 'platform_disabled', 'platform_paused', 'rejected.inactivity', 'rejected.other', 'rejected.unsupported_business', 'requirements.fields_needed']` + * Add support for `ch_uid` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `card_canceled`, `card_expired`, `cardholder_blocked`, `insecure_authorization_method` and `pin_blocked` on enum `stripe.issuing.Authorization.RequestHistory.reason` + * Add support for `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `pound`, on enums `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel.unit`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel.unit`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel.unit` + * Add support for `2024-06-20` on enum `stripe.WebhookEndpoint.CreateParams.api_version` ## 9.12.0 - 2024-06-17 - -- [#1348](https://github.com/stripe/stripe-python/pull/1348) Update generated code - - Add support for `tax_id_collection` on parameter class `stripe.PaymentLink.ModifyParams` - - Add support for `mobilepay` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` +* [#1348](https://github.com/stripe/stripe-python/pull/1348) Update generated code + * Add support for `tax_id_collection` on parameter class `stripe.PaymentLink.ModifyParams` + * Add support for `mobilepay` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` ## 9.12.0b1 - 2024-06-13 - -- [#1343](https://github.com/stripe/stripe-python/pull/1343) Update generated code for beta - - Add support for `de_stn` on enums `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, and `stripe.QuotePreviewInvoice.CustomerTaxId.type` +* [#1343](https://github.com/stripe/stripe-python/pull/1343) Update generated code for beta + * Add support for `de_stn` on enums `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, and `stripe.QuotePreviewInvoice.CustomerTaxId.type` ## 9.11.0 - 2024-06-13 - -- [#1342](https://github.com/stripe/stripe-python/pull/1342) Update generated code - - Add support for `multibanco_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` - - Add support for `twint_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` - - Add support for `twint` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, and `stripe.PaymentIntent.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData`, and resource `stripe.PaymentMethod` - - Add support for `multibanco` on parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethodConfiguration.CreateParams`, `stripe.PaymentMethodConfiguration.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, `stripe.SetupIntent.ModifyParamsPaymentMethodData`, and `stripe.checkout.Session.CreateParamsPaymentMethodOptions`, resource classes `stripe.ConfirmationToken.PaymentMethodPreview`, `stripe.PaymentIntent.PaymentMethodOptions`, `stripe.Refund.DestinationDetails`, and `stripe.checkout.Session.PaymentMethodOptions`, and resources `stripe.PaymentMethod` and `stripe.PaymentMethodConfiguration` - - Add support for `multibanco_display_details` on resource class `stripe.PaymentIntent.NextAction` - - Add support for `invoice_settings` on resource `stripe.Subscription` - - Add support for `de_stn` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `multibanco` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` - - Add support for `twint` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` +* [#1342](https://github.com/stripe/stripe-python/pull/1342) Update generated code + * Add support for `multibanco_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` + * Add support for `twint_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` + * Add support for `twint` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, and `stripe.PaymentIntent.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData`, and resource `stripe.PaymentMethod` + * Add support for `multibanco` on parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethodConfiguration.CreateParams`, `stripe.PaymentMethodConfiguration.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, `stripe.SetupIntent.ModifyParamsPaymentMethodData`, and `stripe.checkout.Session.CreateParamsPaymentMethodOptions`, resource classes `stripe.ConfirmationToken.PaymentMethodPreview`, `stripe.PaymentIntent.PaymentMethodOptions`, `stripe.Refund.DestinationDetails`, and `stripe.checkout.Session.PaymentMethodOptions`, and resources `stripe.PaymentMethod` and `stripe.PaymentMethodConfiguration` + * Add support for `multibanco_display_details` on resource class `stripe.PaymentIntent.NextAction` + * Add support for `invoice_settings` on resource `stripe.Subscription` + * Add support for `de_stn` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `multibanco` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` + * Add support for `twint` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` ## 9.11.0b1 - 2024-06-06 - -- [#1339](https://github.com/stripe/stripe-python/pull/1339) Update generated code for beta - - Add support for `twint` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions` and resource class `stripe.PaymentIntent.PaymentMethodOptions` - - Add support for `swish` on enum `stripe.QuotePreviewInvoice.PaymentSettings.payment_method_types` +* [#1339](https://github.com/stripe/stripe-python/pull/1339) Update generated code for beta + * Add support for `twint` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions` and resource class `stripe.PaymentIntent.PaymentMethodOptions` + * Add support for `swish` on enum `stripe.QuotePreviewInvoice.PaymentSettings.payment_method_types` ## 9.10.0 - 2024-06-06 - -- [#1340](https://github.com/stripe/stripe-python/pull/1340) Update generated code - - Add support for `gb_bank_transfer_payments`, `jp_bank_transfer_payments`, `mx_bank_transfer_payments`, `sepa_bank_transfer_payments`, `us_bank_transfer_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` - - Add support for `swish` on enums `stripe.Invoice.PaymentSettings.payment_method_types`, `stripe.Invoice.CreateParamsPaymentSettings.payment_method_types`, `stripe.Invoice.ModifyParamsPaymentSettings.payment_method_types`, `stripe.Subscription.PaymentSettings.payment_method_types`, `stripe.Subscription.CreateParamsPaymentSettings.payment_method_types`, and `stripe.Subscription.ModifyParamsPaymentSettings.payment_method_types` +* [#1340](https://github.com/stripe/stripe-python/pull/1340) Update generated code + * Add support for `gb_bank_transfer_payments`, `jp_bank_transfer_payments`, `mx_bank_transfer_payments`, `sepa_bank_transfer_payments`, `us_bank_transfer_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` + * Add support for `swish` on enums `stripe.Invoice.PaymentSettings.payment_method_types`, `stripe.Invoice.CreateParamsPaymentSettings.payment_method_types`, `stripe.Invoice.ModifyParamsPaymentSettings.payment_method_types`, `stripe.Subscription.PaymentSettings.payment_method_types`, `stripe.Subscription.CreateParamsPaymentSettings.payment_method_types`, and `stripe.Subscription.ModifyParamsPaymentSettings.payment_method_types` ## 9.10.0b1 - 2024-05-30 - -- [#1334](https://github.com/stripe/stripe-python/pull/1334) Update generated code for beta - - Add support for `en-RO` on enums `stripe.Order.CreateParamsPaymentSettingsPaymentMethodOptionsKlarna.preferred_locale` and `stripe.Order.ModifyParamsPaymentSettingsPaymentMethodOptionsKlarna.preferred_locale` - - Add support for `ro-RO` on enums `stripe.Order.CreateParamsPaymentSettingsPaymentMethodOptionsKlarna.preferred_locale` and `stripe.Order.ModifyParamsPaymentSettingsPaymentMethodOptionsKlarna.preferred_locale` +* [#1334](https://github.com/stripe/stripe-python/pull/1334) Update generated code for beta + * Add support for `en-RO` on enums `stripe.Order.CreateParamsPaymentSettingsPaymentMethodOptionsKlarna.preferred_locale` and `stripe.Order.ModifyParamsPaymentSettingsPaymentMethodOptionsKlarna.preferred_locale` + * Add support for `ro-RO` on enums `stripe.Order.CreateParamsPaymentSettingsPaymentMethodOptionsKlarna.preferred_locale` and `stripe.Order.ModifyParamsPaymentSettingsPaymentMethodOptionsKlarna.preferred_locale` ## 9.9.0 - 2024-05-30 - -- [#1335](https://github.com/stripe/stripe-python/pull/1335) Add method to list invoice line items - - Add methods `list_lines()` and `list_lines_async()` on the class `Invoice` to list the invoice line items -- [#1336](https://github.com/stripe/stripe-python/pull/1336) Update generated code - - Add support for `generated_from` on resource classes `stripe.ConfirmationToken.PaymentMethodPreview.Card` and `stripe.PaymentMethod.Card` - - Add support for `default_value` on parameter classes `stripe.checkout.Session.CreateParamsCustomFieldDropdown`, `stripe.checkout.Session.CreateParamsCustomFieldNumeric`, and `stripe.checkout.Session.CreateParamsCustomFieldText` and resource classes `stripe.checkout.Session.CustomField.Dropdown`, `stripe.checkout.Session.CustomField.Numeric`, and `stripe.checkout.Session.CustomField.Text` - - Add support for `verification_requires_additional_proof_of_registration` on enums `stripe.Account.FutureRequirements.Error.code`, `stripe.Account.Requirements.Error.code`, `stripe.BankAccount.FutureRequirements.Error.code`, `stripe.BankAccount.Requirements.Error.code`, `stripe.Capability.FutureRequirements.Error.code`, `stripe.Capability.Requirements.Error.code`, `stripe.Person.FutureRequirements.Error.code`, and `stripe.Person.Requirements.Error.code` - - Add support for `issuing_personalization_design.activated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `issuing_personalization_design.deactivated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `issuing_personalization_design.rejected` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `issuing_personalization_design.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `en-RO` on enums `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsKlarna.preferred_locale`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsKlarna.preferred_locale`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsKlarna.preferred_locale` - - Add support for `ro-RO` on enums `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsKlarna.preferred_locale`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsKlarna.preferred_locale`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsKlarna.preferred_locale` - - Change type of `features` on `stripe.issuing.PhysicalBundle` from `Optional[Features]` to `Features` +* [#1335](https://github.com/stripe/stripe-python/pull/1335) Add method to list invoice line items + * Add methods `list_lines()` and `list_lines_async()` on the class `Invoice` to list the invoice line items +* [#1336](https://github.com/stripe/stripe-python/pull/1336) Update generated code + * Add support for `generated_from` on resource classes `stripe.ConfirmationToken.PaymentMethodPreview.Card` and `stripe.PaymentMethod.Card` + * Add support for `default_value` on parameter classes `stripe.checkout.Session.CreateParamsCustomFieldDropdown`, `stripe.checkout.Session.CreateParamsCustomFieldNumeric`, and `stripe.checkout.Session.CreateParamsCustomFieldText` and resource classes `stripe.checkout.Session.CustomField.Dropdown`, `stripe.checkout.Session.CustomField.Numeric`, and `stripe.checkout.Session.CustomField.Text` + * Add support for `verification_requires_additional_proof_of_registration` on enums `stripe.Account.FutureRequirements.Error.code`, `stripe.Account.Requirements.Error.code`, `stripe.BankAccount.FutureRequirements.Error.code`, `stripe.BankAccount.Requirements.Error.code`, `stripe.Capability.FutureRequirements.Error.code`, `stripe.Capability.Requirements.Error.code`, `stripe.Person.FutureRequirements.Error.code`, and `stripe.Person.Requirements.Error.code` + * Add support for `issuing_personalization_design.activated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `issuing_personalization_design.deactivated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `issuing_personalization_design.rejected` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `issuing_personalization_design.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `en-RO` on enums `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsKlarna.preferred_locale`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsKlarna.preferred_locale`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsKlarna.preferred_locale` + * Add support for `ro-RO` on enums `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsKlarna.preferred_locale`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsKlarna.preferred_locale`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsKlarna.preferred_locale` + * Change type of `features` on `stripe.issuing.PhysicalBundle` from `Optional[Features]` to `Features` ## 9.9.0b1 - 2024-05-23 - -- [#1331](https://github.com/stripe/stripe-python/pull/1331) Update generated code for beta - - Change type of `refund` on `stripe.CreditNote.CreateParamsRefund`, `stripe.CreditNote.PreviewParamsRefund`, and `stripe.CreditNote.PreviewLinesParamsRefund` from `str` to `NotRequired[str]` - - Add support for `terminal_reader_invalid_location_for_payment` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` +* [#1331](https://github.com/stripe/stripe-python/pull/1331) Update generated code for beta + * Change type of `refund` on `stripe.CreditNote.CreateParamsRefund`, `stripe.CreditNote.PreviewParamsRefund`, and `stripe.CreditNote.PreviewLinesParamsRefund` from `str` to `NotRequired[str]` + * Add support for `terminal_reader_invalid_location_for_payment` on enum `stripe.QuotePreviewInvoice.LastFinalizationError.code` ## 9.8.0 - 2024-05-23 - -- [#1332](https://github.com/stripe/stripe-python/pull/1332) Update generated code - - Add support for `external_account_collection` on resource classes `stripe.AccountSession.Components.Balances.Features` and `stripe.AccountSession.Components.Payouts.Features` and parameter classes `stripe.AccountSession.CreateParamsComponentsBalancesFeatures` and `stripe.AccountSession.CreateParamsComponentsPayoutsFeatures` - - Add support for `payment_method_remove` on resource class `stripe.checkout.Session.SavedPaymentMethodOptions` - - Add support for `terminal_reader_invalid_location_for_payment` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` +* [#1332](https://github.com/stripe/stripe-python/pull/1332) Update generated code + * Add support for `external_account_collection` on resource classes `stripe.AccountSession.Components.Balances.Features` and `stripe.AccountSession.Components.Payouts.Features` and parameter classes `stripe.AccountSession.CreateParamsComponentsBalancesFeatures` and `stripe.AccountSession.CreateParamsComponentsPayoutsFeatures` + * Add support for `payment_method_remove` on resource class `stripe.checkout.Session.SavedPaymentMethodOptions` + * Add support for `terminal_reader_invalid_location_for_payment` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` ## 9.8.0b1 - 2024-05-16 +* [#1327](https://github.com/stripe/stripe-python/pull/1327) Update generated code for beta -- [#1327](https://github.com/stripe/stripe-python/pull/1327) Update generated code for beta - -- [#1330](https://github.com/stripe/stripe-python/pull/1330) (beta) swap from `black` to `ruff` for formatting +* [#1330](https://github.com/stripe/stripe-python/pull/1330) (beta) swap from `black` to `ruff` for formatting ## 9.7.0 - 2024-05-16 - -- [#1328](https://github.com/stripe/stripe-python/pull/1328) Update generated code - - Add support for `fee_source` on resource `stripe.ApplicationFee` - - Add support for `net_available` on resource class `stripe.Balance.InstantAvailable` - - Add support for `preferred_locales` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.CardPresent`, and `stripe.PaymentMethod.CardPresent` - - Add support for `klarna` on resource class `stripe.Dispute.PaymentMethodDetails` - - Add support for `routing` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsCardPresent`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsCardPresent`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsCardPresent` and resource class `stripe.PaymentIntent.PaymentMethodOptions.CardPresent` - - Add support for `application_fee` on resource `stripe.Payout` - - Add support for `archived` on parameter class `stripe.entitlements.Feature.ListParams` - - Add support for `lookup_key` on parameter class `stripe.entitlements.Feature.ListParams` - - Add support for `no_valid_authorization` on parameter classes `stripe.issuing.Dispute.CreateParamsEvidence` and `stripe.issuing.Dispute.ModifyParamsEvidence` and resource class `stripe.issuing.Dispute.Evidence` - - Add support for `loss_reason` on resource `stripe.issuing.Dispute` - - Add support for `stripe_s700` on parameter classes `stripe.terminal.Configuration.CreateParams` and `stripe.terminal.Configuration.ModifyParams` and resource `stripe.terminal.Configuration` - - Add support for `klarna` on enum `stripe.Dispute.PaymentMethodDetails.type` - - Add support for `no_valid_authorization` on enums `stripe.issuing.Dispute.Evidence.reason`, `stripe.issuing.Dispute.CreateParamsEvidence.reason`, and `stripe.issuing.Dispute.ModifyParamsEvidence.reason` - - Change type of `countries` on `stripe.financial_connections.Session.CreateParamsFilters` from `List[str]` to `NotRequired[List[str]]` -- [#1329](https://github.com/stripe/stripe-python/pull/1329) Switch from `black` to `ruff` for formatting +* [#1328](https://github.com/stripe/stripe-python/pull/1328) Update generated code + * Add support for `fee_source` on resource `stripe.ApplicationFee` + * Add support for `net_available` on resource class `stripe.Balance.InstantAvailable` + * Add support for `preferred_locales` on resource classes `stripe.Charge.PaymentMethodDetails.CardPresent`, `stripe.ConfirmationToken.PaymentMethodPreview.CardPresent`, and `stripe.PaymentMethod.CardPresent` + * Add support for `klarna` on resource class `stripe.Dispute.PaymentMethodDetails` + * Add support for `routing` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsCardPresent`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsCardPresent`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsCardPresent` and resource class `stripe.PaymentIntent.PaymentMethodOptions.CardPresent` + * Add support for `application_fee` on resource `stripe.Payout` + * Add support for `archived` on parameter class `stripe.entitlements.Feature.ListParams` + * Add support for `lookup_key` on parameter class `stripe.entitlements.Feature.ListParams` + * Add support for `no_valid_authorization` on parameter classes `stripe.issuing.Dispute.CreateParamsEvidence` and `stripe.issuing.Dispute.ModifyParamsEvidence` and resource class `stripe.issuing.Dispute.Evidence` + * Add support for `loss_reason` on resource `stripe.issuing.Dispute` + * Add support for `stripe_s700` on parameter classes `stripe.terminal.Configuration.CreateParams` and `stripe.terminal.Configuration.ModifyParams` and resource `stripe.terminal.Configuration` + * Add support for `klarna` on enum `stripe.Dispute.PaymentMethodDetails.type` + * Add support for `no_valid_authorization` on enums `stripe.issuing.Dispute.Evidence.reason`, `stripe.issuing.Dispute.CreateParamsEvidence.reason`, and `stripe.issuing.Dispute.ModifyParamsEvidence.reason` + * Change type of `countries` on `stripe.financial_connections.Session.CreateParamsFilters` from `List[str]` to `NotRequired[List[str]]` +* [#1329](https://github.com/stripe/stripe-python/pull/1329) Switch from `black` to `ruff` for formatting ## 9.7.0b1 - 2024-05-09 - -- [#1321](https://github.com/stripe/stripe-python/pull/1321) Update generated code for beta - - No new beta features. Merging changes from the main branch. +* [#1321](https://github.com/stripe/stripe-python/pull/1321) Update generated code for beta + * No new beta features. Merging changes from the main branch. ## 9.6.0 - 2024-05-09 - -- [#1323](https://github.com/stripe/stripe-python/pull/1323) Update generated code - - Add support for `allow_redisplay` on resource class `stripe.ConfirmationToken.PaymentMethodPreview` and resource `stripe.PaymentMethod` - - Add support for `preview_mode` on parameter classes `stripe.Invoice.CreatePreviewParams`, `stripe.Invoice.UpcomingLinesParams`, and `stripe.Invoice.UpcomingParams` - - Add support for `_cls_update` on resources `stripe.treasury.OutboundPayment` and `stripe.treasury.OutboundTransfer` - - Add support for `tracking_details` on resources `stripe.treasury.OutboundPayment` and `stripe.treasury.OutboundTransfer` - - Add support for `update` on resources `stripe.treasury.OutboundPayment` and `stripe.treasury.OutboundTransfer` - - Add support for `treasury.outbound_payment.tracking_details_updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` - - Add support for `treasury.outbound_transfer.tracking_details_updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` +* [#1323](https://github.com/stripe/stripe-python/pull/1323) Update generated code + * Add support for `allow_redisplay` on resource class `stripe.ConfirmationToken.PaymentMethodPreview` and resource `stripe.PaymentMethod` + * Add support for `preview_mode` on parameter classes `stripe.Invoice.CreatePreviewParams`, `stripe.Invoice.UpcomingLinesParams`, and `stripe.Invoice.UpcomingParams` + * Add support for `_cls_update` on resources `stripe.treasury.OutboundPayment` and `stripe.treasury.OutboundTransfer` + * Add support for `tracking_details` on resources `stripe.treasury.OutboundPayment` and `stripe.treasury.OutboundTransfer` + * Add support for `update` on resources `stripe.treasury.OutboundPayment` and `stripe.treasury.OutboundTransfer` + * Add support for `treasury.outbound_payment.tracking_details_updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` + * Add support for `treasury.outbound_transfer.tracking_details_updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` ## 9.6.0b1 - 2024-05-02 - -- [#1318](https://github.com/stripe/stripe-python/pull/1318) Update generated code for beta - - Add support for `rechnung_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` - - Add support for `rechnung` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, and `stripe.PaymentIntent.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethod.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData`, and resource `stripe.PaymentMethod` - - Add support for `multibanco` on parameter class `stripe.checkout.Session.CreateParamsPaymentMethodOptions` and resource class `stripe.checkout.Session.PaymentMethodOptions` - - Add support for `multibanco` on enum `stripe.checkout.Session.CreateParams.payment_method_types` - - Add support for `rechnung` on enums `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` - - Change type of `transactions` on `stripe.gift_cards.Card` from `ListObject[Transaction]` to `Optional[ListObject[Transaction]]` +* [#1318](https://github.com/stripe/stripe-python/pull/1318) Update generated code for beta + * Add support for `rechnung_payments` on resource class `stripe.Account.Capabilities` and parameter class `stripe.Account.CreateParamsCapabilities` + * Add support for `rechnung` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, and `stripe.PaymentIntent.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethod.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData`, and resource `stripe.PaymentMethod` + * Add support for `multibanco` on parameter class `stripe.checkout.Session.CreateParamsPaymentMethodOptions` and resource class `stripe.checkout.Session.PaymentMethodOptions` + * Add support for `multibanco` on enum `stripe.checkout.Session.CreateParams.payment_method_types` + * Add support for `rechnung` on enums `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` + * Change type of `transactions` on `stripe.gift_cards.Card` from `ListObject[Transaction]` to `Optional[ListObject[Transaction]]` ## 9.5.0 - 2024-05-02 - -- [#1317](https://github.com/stripe/stripe-python/pull/1317) Update generated code - - Add support for `paypal` on resource class `stripe.Dispute.PaymentMethodDetails` - - Add support for `payment_method_types` on parameter class `stripe.PaymentIntent.ConfirmParams` - - Add support for `ship_from_details` on parameter class `stripe.tax.Calculation.CreateParams` and resources `stripe.tax.Calculation` and `stripe.tax.Transaction` - - Add support for `bh`, `eg`, `ge`, `ke`, `kz`, `ng`, `om` on resource class `stripe.tax.Registration.CountryOptions` and parameter class `stripe.tax.Registration.CreateParamsCountryOptions` - - Add support for `paypal` on enum `stripe.Dispute.PaymentMethodDetails.type` - - Add support for `shipping_address_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Change type of `metadata` on `stripe.entitlements.Feature.ModifyParams` from `Dict[str, str]` to `Literal['']|Dict[str, str]` -- [#1319](https://github.com/stripe/stripe-python/pull/1319) Fix type change entries in Python Changelog +* [#1317](https://github.com/stripe/stripe-python/pull/1317) Update generated code + * Add support for `paypal` on resource class `stripe.Dispute.PaymentMethodDetails` + * Add support for `payment_method_types` on parameter class `stripe.PaymentIntent.ConfirmParams` + * Add support for `ship_from_details` on parameter class `stripe.tax.Calculation.CreateParams` and resources `stripe.tax.Calculation` and `stripe.tax.Transaction` + * Add support for `bh`, `eg`, `ge`, `ke`, `kz`, `ng`, `om` on resource class `stripe.tax.Registration.CountryOptions` and parameter class `stripe.tax.Registration.CreateParamsCountryOptions` + * Add support for `paypal` on enum `stripe.Dispute.PaymentMethodDetails.type` + * Add support for `shipping_address_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Change type of `metadata` on `stripe.entitlements.Feature.ModifyParams` from `Dict[str, str]` to `Literal['']|Dict[str, str]` +* [#1319](https://github.com/stripe/stripe-python/pull/1319) Fix type change entries in Python Changelog ## 9.5.0b1 - 2024-04-25 - -- [#1308](https://github.com/stripe/stripe-python/pull/1308) Update generated code for beta - - Add support for `payment_method_settings` on parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `cancel_subscription_schedule` on parameter classes `stripe.Quote.CreateParamsLine` and `stripe.Quote.ModifyParamsLine` and resource `stripe.QuoteLine` - - Add support for `amazon_pay` on enum `stripe.QuotePreviewInvoice.PaymentSettings.payment_method_types` - - Add support for `revolut_pay` on enum `stripe.QuotePreviewInvoice.PaymentSettings.payment_method_types` +* [#1308](https://github.com/stripe/stripe-python/pull/1308) Update generated code for beta + * Add support for `payment_method_settings` on parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `cancel_subscription_schedule` on parameter classes `stripe.Quote.CreateParamsLine` and `stripe.Quote.ModifyParamsLine` and resource `stripe.QuoteLine` + * Add support for `amazon_pay` on enum `stripe.QuotePreviewInvoice.PaymentSettings.payment_method_types` + * Add support for `revolut_pay` on enum `stripe.QuotePreviewInvoice.PaymentSettings.payment_method_types` ## 9.4.0 - 2024-04-25 - -- [#1316](https://github.com/stripe/stripe-python/pull/1316) Update generated code - - Add support for `amazon_pay` on resource classes `stripe.Mandate.PaymentMethodDetails` and `stripe.SetupAttempt.PaymentMethodDetails` - - Add support for `revolut_pay` on resource classes `stripe.Mandate.PaymentMethodDetails` and `stripe.SetupAttempt.PaymentMethodDetails` - - Add support for `setup_future_usage` on resource classes `stripe.PaymentIntent.PaymentMethodOptions.AmazonPay`, `stripe.PaymentIntent.PaymentMethodOptions.RevolutPay`, `stripe.checkout.Session.PaymentMethodOptions.AmazonPay`, and `stripe.checkout.Session.PaymentMethodOptions.RevolutPay` - - Add support for `mobilepay` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` - - Add support for `ending_before` on parameter class `stripe.PaymentMethodConfiguration.ListParams` - - Add support for `limit` on parameter class `stripe.PaymentMethodConfiguration.ListParams` - - Add support for `starting_after` on parameter class `stripe.PaymentMethodConfiguration.ListParams` - - Change type of `feature` on `stripe.entitlements.ActiveEntitlement` from `str` to `ExpandableField[Feature]` - - Add support for `amazon_pay` on enums `stripe.Invoice.PaymentSettings.payment_method_types`, `stripe.Invoice.CreateParamsPaymentSettings.payment_method_types`, `stripe.Invoice.ModifyParamsPaymentSettings.payment_method_types`, `stripe.Subscription.PaymentSettings.payment_method_types`, `stripe.Subscription.CreateParamsPaymentSettings.payment_method_types`, and `stripe.Subscription.ModifyParamsPaymentSettings.payment_method_types` - - Add support for `revolut_pay` on enums `stripe.Invoice.PaymentSettings.payment_method_types`, `stripe.Invoice.CreateParamsPaymentSettings.payment_method_types`, `stripe.Invoice.ModifyParamsPaymentSettings.payment_method_types`, `stripe.Subscription.PaymentSettings.payment_method_types`, `stripe.Subscription.CreateParamsPaymentSettings.payment_method_types`, and `stripe.Subscription.ModifyParamsPaymentSettings.payment_method_types` - - Remove support for inadvertently released identity verification features `email` and `phone` on parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions` -- [#1307](https://github.com/stripe/stripe-python/pull/1307) Bump aiohttp from 3.9.2 to 3.9.4 +* [#1316](https://github.com/stripe/stripe-python/pull/1316) Update generated code + * Add support for `amazon_pay` on resource classes `stripe.Mandate.PaymentMethodDetails` and `stripe.SetupAttempt.PaymentMethodDetails` + * Add support for `revolut_pay` on resource classes `stripe.Mandate.PaymentMethodDetails` and `stripe.SetupAttempt.PaymentMethodDetails` + * Add support for `setup_future_usage` on resource classes `stripe.PaymentIntent.PaymentMethodOptions.AmazonPay`, `stripe.PaymentIntent.PaymentMethodOptions.RevolutPay`, `stripe.checkout.Session.PaymentMethodOptions.AmazonPay`, and `stripe.checkout.Session.PaymentMethodOptions.RevolutPay` + * Add support for `mobilepay` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` + * Add support for `ending_before` on parameter class `stripe.PaymentMethodConfiguration.ListParams` + * Add support for `limit` on parameter class `stripe.PaymentMethodConfiguration.ListParams` + * Add support for `starting_after` on parameter class `stripe.PaymentMethodConfiguration.ListParams` + * Change type of `feature` on `stripe.entitlements.ActiveEntitlement` from `str` to `ExpandableField[Feature]` + * Add support for `amazon_pay` on enums `stripe.Invoice.PaymentSettings.payment_method_types`, `stripe.Invoice.CreateParamsPaymentSettings.payment_method_types`, `stripe.Invoice.ModifyParamsPaymentSettings.payment_method_types`, `stripe.Subscription.PaymentSettings.payment_method_types`, `stripe.Subscription.CreateParamsPaymentSettings.payment_method_types`, and `stripe.Subscription.ModifyParamsPaymentSettings.payment_method_types` + * Add support for `revolut_pay` on enums `stripe.Invoice.PaymentSettings.payment_method_types`, `stripe.Invoice.CreateParamsPaymentSettings.payment_method_types`, `stripe.Invoice.ModifyParamsPaymentSettings.payment_method_types`, `stripe.Subscription.PaymentSettings.payment_method_types`, `stripe.Subscription.CreateParamsPaymentSettings.payment_method_types`, and `stripe.Subscription.ModifyParamsPaymentSettings.payment_method_types` + * Remove support for inadvertently released identity verification features `email` and `phone` on parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions` +* [#1307](https://github.com/stripe/stripe-python/pull/1307) Bump aiohttp from 3.9.2 to 3.9.4 ## 9.4.0b1 - 2024-04-18 - -- [#1302](https://github.com/stripe/stripe-python/pull/1302) Update generated code for beta - - Add support for `balances` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `payouts_list` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `capital_overview` on parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `tax_registrations` on parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `tax_settings` on parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `external_account_collection` on parameter class `stripe.AccountSession.CreateParamsComponentsFinancialAccountFeatures` - - Add support for `allow_redisplay` on parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.Customer.ListPaymentMethodsParams`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethod.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData` - - Add support for `subscription_trial_from_plan` on parameter classes `stripe.Invoice.UpcomingLinesParams` and `stripe.Invoice.UpcomingParams` - - Add support for `swish` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` - - Add support for `payment_method_data` on parameter class `stripe.checkout.Session.CreateParams` - - Add support for `saved_payment_method_options` on parameter class `stripe.checkout.Session.CreateParams` and resource `stripe.checkout.Session` - - Add support for `mobilepay` on parameter class `stripe.checkout.Session.CreateParamsPaymentMethodOptions` and resource class `stripe.checkout.Session.PaymentMethodOptions` - - Remove support for `config` on parameter class `stripe.forwarding.Request.CreateParams` and resource `stripe.forwarding.Request` - - Change type of fields `stripe.AccountSession.Components.PaymentDetails.Features` and `stripe.AccountSession.Components.Payments.Features` from `Optional[bool]` to `bool` of `destination_on_behalf_of_charge_management` - - Change type of field `stripe.billing.MeterEvent.CreateParams` from `int` to `NotRequired[int]` of `timestamp` - - Add support for `mobilepay` on enum `stripe.checkout.Session.CreateParams.payment_method_types` - - Add support for `other` on enums `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel.unit`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel.unit`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel.unit` +* [#1302](https://github.com/stripe/stripe-python/pull/1302) Update generated code for beta + * Add support for `balances` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `payouts_list` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `capital_overview` on parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `tax_registrations` on parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `tax_settings` on parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `external_account_collection` on parameter class `stripe.AccountSession.CreateParamsComponentsFinancialAccountFeatures` + * Add support for `allow_redisplay` on parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.Customer.ListPaymentMethodsParams`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethod.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData` + * Add support for `subscription_trial_from_plan` on parameter classes `stripe.Invoice.UpcomingLinesParams` and `stripe.Invoice.UpcomingParams` + * Add support for `swish` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` + * Add support for `payment_method_data` on parameter class `stripe.checkout.Session.CreateParams` + * Add support for `saved_payment_method_options` on parameter class `stripe.checkout.Session.CreateParams` and resource `stripe.checkout.Session` + * Add support for `mobilepay` on parameter class `stripe.checkout.Session.CreateParamsPaymentMethodOptions` and resource class `stripe.checkout.Session.PaymentMethodOptions` + * Remove support for `config` on parameter class `stripe.forwarding.Request.CreateParams` and resource `stripe.forwarding.Request` + * Change type of fields `stripe.AccountSession.Components.PaymentDetails.Features` and `stripe.AccountSession.Components.Payments.Features` from `Optional[bool]` to `bool` of `destination_on_behalf_of_charge_management` + * Change type of field `stripe.billing.MeterEvent.CreateParams` from `int` to `NotRequired[int]` of `timestamp` + * Add support for `mobilepay` on enum `stripe.checkout.Session.CreateParams.payment_method_types` + * Add support for `other` on enums `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel.unit`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel.unit`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel.unit` ## 9.3.0 - 2024-04-18 - -- [#1305](https://github.com/stripe/stripe-python/pull/1305) Update generated code - - Add support for `allow_redisplay` on parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.Customer.ListPaymentMethodsParams`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethod.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData` - - Add support for `schedule_details` on parameter classes `stripe.Invoice.UpcomingLinesParams` and `stripe.Invoice.UpcomingParams` - - Add support for `subscription_details` on parameter classes `stripe.Invoice.UpcomingLinesParams` and `stripe.Invoice.UpcomingParams` - - Add support for `create_preview` on resource `stripe.Invoice` - - Add support for `payment_method_data` on parameter class `stripe.checkout.Session.CreateParams` - - Add support for `saved_payment_method_options` on parameter class `stripe.checkout.Session.CreateParams` and resource `stripe.checkout.Session` - - Add support for `mobilepay` on parameter class `stripe.checkout.Session.CreateParamsPaymentMethodOptions` and resource class `stripe.checkout.Session.PaymentMethodOptions` - - Add support for `mobilepay` on enum `stripe.checkout.Session.CreateParams.payment_method_types` - - Add support for `other` on enums `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel.unit`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel.unit`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel.unit` -- [#1306](https://github.com/stripe/stripe-python/pull/1306) Update `Quote.pdf()` to use the right base address i.e. files.stripe.com instead of api.stripe.com. Fixes [#1303](https://github.com/stripe/stripe-python/issues/1303) +* [#1305](https://github.com/stripe/stripe-python/pull/1305) Update generated code + * Add support for `allow_redisplay` on parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.Customer.ListPaymentMethodsParams`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethod.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData` + * Add support for `schedule_details` on parameter classes `stripe.Invoice.UpcomingLinesParams` and `stripe.Invoice.UpcomingParams` + * Add support for `subscription_details` on parameter classes `stripe.Invoice.UpcomingLinesParams` and `stripe.Invoice.UpcomingParams` + * Add support for `create_preview` on resource `stripe.Invoice` + * Add support for `payment_method_data` on parameter class `stripe.checkout.Session.CreateParams` + * Add support for `saved_payment_method_options` on parameter class `stripe.checkout.Session.CreateParams` and resource `stripe.checkout.Session` + * Add support for `mobilepay` on parameter class `stripe.checkout.Session.CreateParamsPaymentMethodOptions` and resource class `stripe.checkout.Session.PaymentMethodOptions` + * Add support for `mobilepay` on enum `stripe.checkout.Session.CreateParams.payment_method_types` + * Add support for `other` on enums `stripe.issuing.Authorization.CaptureParamsPurchaseDetailsFuel.unit`, `stripe.issuing.Transaction.CreateForceCaptureParamsPurchaseDetailsFuel.unit`, and `stripe.issuing.Transaction.CreateUnlinkedRefundParamsPurchaseDetailsFuel.unit` +* [#1306](https://github.com/stripe/stripe-python/pull/1306) Update `Quote.pdf()` to use the right base address i.e. files.stripe.com instead of api.stripe.com. Fixes [#1303](https://github.com/stripe/stripe-python/issues/1303) ## 9.2.0 - 2024-04-16 - -- [#1301](https://github.com/stripe/stripe-python/pull/1301) Update generated code - - Add support for `balances` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `payouts_list` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `capture_method` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsRevolutPay`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsRevolutPay`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsRevolutPay` and resource class `stripe.PaymentIntent.PaymentMethodOptions.RevolutPay` - - Add support for `swish` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` - - Add support for resource `stripe.entitlements.ActiveEntitlementSummary` - - Remove support for `config` on parameter class `stripe.forwarding.Request.CreateParams` and resource `stripe.forwarding.Request`. This field is no longer used by the Forwarding Request API. - - Change type of `destination_on_behalf_of_charge_management` on `stripe.AccountSession.Components.PaymentDetails.Features` and `stripe.AccountSession.Components.Payments.Features` from `Optional[bool]` to `bool` - - Change type of `timestamp` on `stripe.billing.MeterEvent.CreateParams` from `int` to `NotRequired[int]` - - Add support for `entitlements.active_entitlement_summary.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` +* [#1301](https://github.com/stripe/stripe-python/pull/1301) Update generated code + * Add support for `balances` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `payouts_list` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `capture_method` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsRevolutPay`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsRevolutPay`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsRevolutPay` and resource class `stripe.PaymentIntent.PaymentMethodOptions.RevolutPay` + * Add support for `swish` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` + * Add support for resource `stripe.entitlements.ActiveEntitlementSummary` + * Remove support for `config` on parameter class `stripe.forwarding.Request.CreateParams` and resource `stripe.forwarding.Request`. This field is no longer used by the Forwarding Request API. + * Change type of `destination_on_behalf_of_charge_management` on `stripe.AccountSession.Components.PaymentDetails.Features` and `stripe.AccountSession.Components.Payments.Features` from `Optional[bool]` to `bool` + * Change type of `timestamp` on `stripe.billing.MeterEvent.CreateParams` from `int` to `NotRequired[int]` + * Add support for `entitlements.active_entitlement_summary.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` ## 9.2.0b1 - 2024-04-11 - -- [#1296](https://github.com/stripe/stripe-python/pull/1296) Update generated code for beta - - Add support for `external_account_collection` on resource class `stripe.AccountSession.Components.AccountOnboarding.Features` and parameter class `stripe.AccountSession.CreateParamsComponentsAccountOnboardingFeatures` - - Add support for `account_management` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `notification_banner` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `amazon_pay` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, `stripe.PaymentIntent.PaymentMethodOptions`, `stripe.Refund.DestinationDetails`, `stripe.SetupIntent.PaymentMethodOptions`, and `stripe.checkout.Session.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethodConfiguration.CreateParams`, `stripe.PaymentMethodConfiguration.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, `stripe.SetupIntent.ModifyParamsPaymentMethodData`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptions`, and `stripe.checkout.Session.CreateParamsPaymentMethodOptions`, and resources `stripe.PaymentMethod` and `stripe.PaymentMethodConfiguration` - - Add support for `capture_method` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsRevolutPay`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsRevolutPay`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsRevolutPay` and resource class `stripe.PaymentIntent.PaymentMethodOptions.RevolutPay` - - Change type of field `stripe.billing.MeterEventAdjustment` from `Cancel` to `Optional[Cancel]` of `cancel` - - Change type of field `stripe.billing.MeterEventAdjustment.Cancel` from `str` to `Optional[str]` of `identifier` - - Change type of field `stripe.billing.MeterEventAdjustment.CreateParamsCancel` from `str` to `NotRequired[str]` of `identifier` - - Change type of field `stripe.billing.MeterEventAdjustment.CreateParams` from `MeterEventAdjustment.CreateParamsCancel` to `NotRequired[MeterEventAdjustment.CreateParamsCancel]` of `cancel` - - Change type of field `stripe.billing.MeterEventAdjustment.CreateParams` from `NotRequired[Literal['cancel']]` to `Literal['cancel']` of `type` - - Add support for `bh_vat` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, `stripe.QuotePreviewInvoice.CustomerTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `kz_bin` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, `stripe.QuotePreviewInvoice.CustomerTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `ng_tin` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, `stripe.QuotePreviewInvoice.CustomerTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `om_vat` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, `stripe.QuotePreviewInvoice.CustomerTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `amazon_pay` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` - - Add support for `billing_policy_remote_function_response_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Add support for `billing_policy_remote_function_timeout` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Add support for `billing_policy_remote_function_unexpected_status_code` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Add support for `billing_policy_remote_function_unreachable` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` +* [#1296](https://github.com/stripe/stripe-python/pull/1296) Update generated code for beta + * Add support for `external_account_collection` on resource class `stripe.AccountSession.Components.AccountOnboarding.Features` and parameter class `stripe.AccountSession.CreateParamsComponentsAccountOnboardingFeatures` + * Add support for `account_management` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `notification_banner` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `amazon_pay` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, `stripe.PaymentIntent.PaymentMethodOptions`, `stripe.Refund.DestinationDetails`, `stripe.SetupIntent.PaymentMethodOptions`, and `stripe.checkout.Session.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethodConfiguration.CreateParams`, `stripe.PaymentMethodConfiguration.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, `stripe.SetupIntent.ModifyParamsPaymentMethodData`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptions`, and `stripe.checkout.Session.CreateParamsPaymentMethodOptions`, and resources `stripe.PaymentMethod` and `stripe.PaymentMethodConfiguration` + * Add support for `capture_method` on parameter classes `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsRevolutPay`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsRevolutPay`, and `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsRevolutPay` and resource class `stripe.PaymentIntent.PaymentMethodOptions.RevolutPay` + * Change type of field `stripe.billing.MeterEventAdjustment` from `Cancel` to `Optional[Cancel]` of `cancel` + * Change type of field `stripe.billing.MeterEventAdjustment.Cancel` from `str` to `Optional[str]` of `identifier` + * Change type of field `stripe.billing.MeterEventAdjustment.CreateParamsCancel` from `str` to `NotRequired[str]` of `identifier` + * Change type of field `stripe.billing.MeterEventAdjustment.CreateParams` from `MeterEventAdjustment.CreateParamsCancel` to `NotRequired[MeterEventAdjustment.CreateParamsCancel]` of `cancel` + * Change type of field `stripe.billing.MeterEventAdjustment.CreateParams` from `NotRequired[Literal['cancel']]` to `Literal['cancel']` of `type` + * Add support for `bh_vat` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, `stripe.QuotePreviewInvoice.CustomerTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `kz_bin` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, `stripe.QuotePreviewInvoice.CustomerTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `ng_tin` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, `stripe.QuotePreviewInvoice.CustomerTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `om_vat` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.CreatePreviewParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.Order.TaxDetails.TaxId.type`, `stripe.Order.CreateParamsTaxDetailsTaxId.type`, `stripe.Order.ModifyParamsTaxDetailsTaxId.type`, `stripe.QuotePreviewInvoice.CustomerTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `amazon_pay` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` + * Add support for `billing_policy_remote_function_response_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Add support for `billing_policy_remote_function_timeout` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Add support for `billing_policy_remote_function_unexpected_status_code` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Add support for `billing_policy_remote_function_unreachable` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` ## 9.1.0 - 2024-04-11 - -- [#1300](https://github.com/stripe/stripe-python/pull/1300) Update generated code - - Add support for `external_account_collection` on resource class `stripe.AccountSession.Components.AccountOnboarding.Features` and parameter class `stripe.AccountSession.CreateParamsComponentsAccountOnboardingFeatures` - - Add support for `account_management` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `notification_banner` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` - - Add support for `amazon_pay` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, `stripe.PaymentIntent.PaymentMethodOptions`, `stripe.Refund.DestinationDetails`, `stripe.SetupIntent.PaymentMethodOptions`, and `stripe.checkout.Session.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethodConfiguration.CreateParams`, `stripe.PaymentMethodConfiguration.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, `stripe.SetupIntent.ModifyParamsPaymentMethodData`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptions`, and `stripe.checkout.Session.CreateParamsPaymentMethodOptions`, and resources `stripe.PaymentMethod` and `stripe.PaymentMethodConfiguration` - - Add support for `next_refresh_available_at` on resource class `stripe.financial_connections.Account.OwnershipRefresh` - - Change type of `cancel` on `stripe.billing.MeterEventAdjustment` from `Cancel` to `Optional[Cancel]` - - Change type of `identifier` on `stripe.billing.MeterEventAdjustment.Cancel` from `str` to `Optional[str]` - - Change type of `identifier` on `stripe.billing.MeterEventAdjustment.CreateParamsCancel` from `str` to `NotRequired[str]` - - Change type of `cancel` on `stripe.billing.MeterEventAdjustment.CreateParams` from `MeterEventAdjustment.CreateParamsCancel` to `NotRequired[MeterEventAdjustment.CreateParamsCancel]` - - Change type of `type` on `stripe.billing.MeterEventAdjustment.CreateParams` from `NotRequired[Literal['cancel']]` to `Literal['cancel']` - - Add support for `bh_vat` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `kz_bin` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `ng_tin` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `om_vat` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` - - Add support for `ownership` on enums `stripe.checkout.Session.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.checkout.Session.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.Invoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.permissions`, `stripe.Invoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.PaymentIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.SetupIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.SetupIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.permissions`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, and `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch` - - Add support for `amazon_pay` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` - - Add support for `billing_policy_remote_function_response_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Add support for `billing_policy_remote_function_timeout` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Add support for `billing_policy_remote_function_unexpected_status_code` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` - - Add support for `billing_policy_remote_function_unreachable` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` -- [#1297](https://github.com/stripe/stripe-python/pull/1297) Use stdlib AsyncMock when available +* [#1300](https://github.com/stripe/stripe-python/pull/1300) Update generated code + * Add support for `external_account_collection` on resource class `stripe.AccountSession.Components.AccountOnboarding.Features` and parameter class `stripe.AccountSession.CreateParamsComponentsAccountOnboardingFeatures` + * Add support for `account_management` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `notification_banner` on resource class `stripe.AccountSession.Components` and parameter class `stripe.AccountSession.CreateParamsComponents` + * Add support for `amazon_pay` on resource classes `stripe.Charge.PaymentMethodDetails`, `stripe.ConfirmationToken.PaymentMethodPreview`, `stripe.PaymentIntent.PaymentMethodOptions`, `stripe.Refund.DestinationDetails`, `stripe.SetupIntent.PaymentMethodOptions`, and `stripe.checkout.Session.PaymentMethodOptions`, parameter classes `stripe.ConfirmationToken.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptions`, `stripe.PaymentIntent.CreateParamsPaymentMethodData`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptions`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptions`, `stripe.PaymentMethod.CreateParams`, `stripe.PaymentMethodConfiguration.CreateParams`, `stripe.PaymentMethodConfiguration.ModifyParams`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodData`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, `stripe.SetupIntent.ModifyParamsPaymentMethodData`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptions`, and `stripe.checkout.Session.CreateParamsPaymentMethodOptions`, and resources `stripe.PaymentMethod` and `stripe.PaymentMethodConfiguration` + * Add support for `next_refresh_available_at` on resource class `stripe.financial_connections.Account.OwnershipRefresh` + * Change type of `cancel` on `stripe.billing.MeterEventAdjustment` from `Cancel` to `Optional[Cancel]` + * Change type of `identifier` on `stripe.billing.MeterEventAdjustment.Cancel` from `str` to `Optional[str]` + * Change type of `identifier` on `stripe.billing.MeterEventAdjustment.CreateParamsCancel` from `str` to `NotRequired[str]` + * Change type of `cancel` on `stripe.billing.MeterEventAdjustment.CreateParams` from `MeterEventAdjustment.CreateParamsCancel` to `NotRequired[MeterEventAdjustment.CreateParamsCancel]` + * Change type of `type` on `stripe.billing.MeterEventAdjustment.CreateParams` from `NotRequired[Literal['cancel']]` to `Literal['cancel']` + * Add support for `bh_vat` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `kz_bin` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `ng_tin` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `om_vat` on enums `stripe.checkout.Session.CustomerDetails.TaxId.type`, `stripe.Customer.CreateParamsTaxIdDatum.type`, `stripe.Customer.CreateTaxIdParams.type`, `stripe.Invoice.CustomerTaxId.type`, `stripe.Invoice.UpcomingParamsCustomerDetailsTaxId.type`, `stripe.Invoice.UpcomingLinesParamsCustomerDetailsTaxId.type`, `stripe.tax.Calculation.CustomerDetails.TaxId.type`, `stripe.tax.Calculation.CreateParamsCustomerDetailsTaxId.type`, `stripe.tax.Transaction.CustomerDetails.TaxId.type`, `stripe.TaxId.type`, and `stripe.TaxId.CreateParams.type` + * Add support for `ownership` on enums `stripe.checkout.Session.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.checkout.Session.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.Invoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.permissions`, `stripe.Invoice.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.PaymentIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.PaymentIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.PaymentIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.SetupIntent.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.SetupIntent.ConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.SetupIntent.CreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.SetupIntent.ModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.permissions`, `stripe.Subscription.PaymentSettings.PaymentMethodOptions.UsBankAccount.FinancialConnections.prefetch`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch`, and `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections.prefetch` + * Add support for `amazon_pay` on enums `stripe.checkout.Session.CreateParams.payment_method_types`, `stripe.ConfirmationToken.PaymentMethodPreview.type`, `stripe.ConfirmationToken.CreateParamsPaymentMethodData.type`, `stripe.Customer.ListPaymentMethodsParams.type`, `stripe.PaymentIntent.ConfirmParamsPaymentMethodData.type`, `stripe.PaymentIntent.CreateParamsPaymentMethodData.type`, `stripe.PaymentIntent.ModifyParamsPaymentMethodData.type`, `stripe.PaymentMethod.type`, `stripe.PaymentMethod.CreateParams.type`, `stripe.PaymentMethod.ListParams.type`, `stripe.SetupIntent.ConfirmParamsPaymentMethodData.type`, `stripe.SetupIntent.CreateParamsPaymentMethodData.type`, and `stripe.SetupIntent.ModifyParamsPaymentMethodData.type` + * Add support for `billing_policy_remote_function_response_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Add support for `billing_policy_remote_function_timeout` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Add support for `billing_policy_remote_function_unexpected_status_code` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + * Add support for `billing_policy_remote_function_unreachable` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` +* [#1297](https://github.com/stripe/stripe-python/pull/1297) Use stdlib AsyncMock when available ## 9.0.0 - 2024-04-10 - -- [#1286](https://github.com/stripe/stripe-python/pull/1286) - - - This release changes the pinned API version to `2024-04-10`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-04-10) and carefully review the API changes before upgrading. - - ### ⚠️ Breaking changes - - - Remove `FinancialAccountFeaturesService.CreateParams`, `FinancialAccountFeaturesService.ListParams`, `FinancialAccountFeaturesService.create()`, `FinancialAccountFeaturesService.list()` as Financial account features is a singleton and so should have retrieve and update methods instead of create and list methods. - - Rename `features` to `marketing_features` on parameter classes `stripe.Product.CreateParams` and `stripe.Product.ModifyParams` and resource `stripe.Product`. - - #### ⚠️ Removal of enum values, properties and events that are no longer part of the publicly documented Stripe API - - - Remove `.subscription_pause` from the below as the feature to pause subscription on the portal has been deprecated - - `Configuration.Features` - - `ConfigurationService.CreateParamsFeatures` - - `ConfigurationService.UpdateParamsFeatures` - - Remove the below deprecated values for `BalanceTransaction.type` - - `obligation_inbound` - - `obligation_payout` - - `obligation_payout_failure` - - `obligation_reversal_outbound` - - Remove the below deprecated events from `Event.type`, `WebhookEndpoint.CreateParams.enabled_events`, `WebhookEndpoint.ModifyParams.enabled_events`, `WebhookEndpointService.CreateParams.enabled_events`, `WebhookEndpointService.ModifyParams.enabled_events` - - `invoiceitem.updated` - - `order.created` - - `recipient.created` - - `recipient.deleted` - - `recipient.updated` - - `sku.created` - - `sku.deleted` - - `sku.updated` - - Remove the deprecated value `include_and_require` for `Invoice.CreateParams.pending_invoice_items_behavior` and `InvoiceService.CreateParams.pending_invoice_items_behavior` - - Remove the deprecated value `service_tax` for - - `TaxRate.RetrieveParams.tax_type` - - `TaxRate.CreateParams.tax_type` - - `TaxRate.ModifyParams.tax_type` - - `TaxRateService.CreateParams.tax_type` - - `TaxRateService.UpdateParams.tax_type` - - `InvoiceLineItem.ModifyParamsTaxAmountTaxRateData.tax_type` - - `InvoiceLineItemService.UpdateParamsTaxAmountTaxRateData.tax_type` - - Remove `request_incremental_authorization` from - - `PaymentIntent.ConfirmParamsPaymentMethodOptionsCardPresent` - - `PaymentIntent.CreateParamsPaymentMethodOptionsCardPresent` - - `PaymentIntent.ModifyParamsPaymentMethodOptionsCardPresent` - - `PaymentIntentService.ConfirmParamsPaymentMethodOptionsCardPresent` - - `PaymentIntentService.CreateParamsPaymentMethodOptionsCardPresent` - - `PaymentIntentService.ModifyParamsPaymentMethodOptionsCardPresent` - - Remove support for `id_bank_transfer`, `multibanco`, `netbanking`, `pay_by_bank`, and `upi` on `PaymentMethodConfiguration` - - Remove the deprecated value `challenge_only` from `SetupIntent.PaymentMethodOptions.Card.request_three_d_secure` - - Remove deprecated value `various` for `Climate.Supplier.removal_pathway` - - Remove the deprecated value `obligation` for `ReportRun.CreateParamsParameters.reporting_category` and `ReportRunService.CreateParamsParameters.reporting_category` - - Remove the legacy field `rendering_options` on parameter classes `stripe.Invoice.CreateParams` and `stripe.Invoice.ModifyParams` and resource `stripe.Invoice`. Use `rendering` instead. +* [#1286](https://github.com/stripe/stripe-python/pull/1286) + + * This release changes the pinned API version to `2024-04-10`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-04-10) and carefully review the API changes before upgrading. + + ### ⚠️ Breaking changes + + * Remove `FinancialAccountFeaturesService.CreateParams`, `FinancialAccountFeaturesService.ListParams`, `FinancialAccountFeaturesService.create()`, `FinancialAccountFeaturesService.list()` as Financial account features is a singleton and so should have retrieve and update methods instead of create and list methods. + * Rename `features` to `marketing_features` on parameter classes `stripe.Product.CreateParams` and `stripe.Product.ModifyParams` and resource `stripe.Product`. + + #### ⚠️ Removal of enum values, properties and events that are no longer part of the publicly documented Stripe API + * Remove `.subscription_pause` from the below as the feature to pause subscription on the portal has been deprecated + * `Configuration.Features` + * `ConfigurationService.CreateParamsFeatures` + * `ConfigurationService.UpdateParamsFeatures` + * Remove the below deprecated values for `BalanceTransaction.type` + * `obligation_inbound` + * `obligation_payout` + * `obligation_payout_failure` + * `obligation_reversal_outbound` + * Remove the below deprecated events from `Event.type`, `WebhookEndpoint.CreateParams.enabled_events`, `WebhookEndpoint.ModifyParams.enabled_events`, `WebhookEndpointService.CreateParams.enabled_events`, `WebhookEndpointService.ModifyParams.enabled_events` + * `invoiceitem.updated` + * `order.created` + * `recipient.created` + * `recipient.deleted` + * `recipient.updated` + * `sku.created` + * `sku.deleted` + * `sku.updated` + * Remove the deprecated value `include_and_require` for `Invoice.CreateParams.pending_invoice_items_behavior` and `InvoiceService.CreateParams.pending_invoice_items_behavior` + * Remove the deprecated value `service_tax` for + * `TaxRate.RetrieveParams.tax_type` + * `TaxRate.CreateParams.tax_type` + * `TaxRate.ModifyParams.tax_type` + * `TaxRateService.CreateParams.tax_type` + * `TaxRateService.UpdateParams.tax_type` + * `InvoiceLineItem.ModifyParamsTaxAmountTaxRateData.tax_type` + * `InvoiceLineItemService.UpdateParamsTaxAmountTaxRateData.tax_type` + * Remove `request_incremental_authorization` from + * `PaymentIntent.ConfirmParamsPaymentMethodOptionsCardPresent` + * `PaymentIntent.CreateParamsPaymentMethodOptionsCardPresent` + * `PaymentIntent.ModifyParamsPaymentMethodOptionsCardPresent` + * `PaymentIntentService.ConfirmParamsPaymentMethodOptionsCardPresent` + * `PaymentIntentService.CreateParamsPaymentMethodOptionsCardPresent` + * `PaymentIntentService.ModifyParamsPaymentMethodOptionsCardPresent` + * Remove support for `id_bank_transfer`, `multibanco`, `netbanking`, `pay_by_bank`, and `upi` on `PaymentMethodConfiguration` + * Remove the deprecated value `challenge_only` from `SetupIntent.PaymentMethodOptions.Card.request_three_d_secure` + * Remove deprecated value `various` for `Climate.Supplier.removal_pathway` + * Remove the deprecated value `obligation` for `ReportRun.CreateParamsParameters.reporting_category` and `ReportRunService.CreateParamsParameters.reporting_category` + * Remove the legacy field `rendering_options` on parameter classes `stripe.Invoice.CreateParams` and `stripe.Invoice.ModifyParams` and resource `stripe.Invoice`. Use `rendering` instead. ## 8.11.0 - 2024-04-09 - -- [#1295](https://github.com/stripe/stripe-python/pull/1295) Update generated code - - - Add support for `fees`, `losses`, `requirement_collection` & `stripe_dashboard` on resource class `stripe.Account.Controller` - - Add support for `controller` on parameter class `stripe.Account.CreateParams` - - Add support for `create_feature`, `delete_feature`, `list_features`, `retrieve_feature` on resource `stripe.Product` - - Add support for resource `stripe.ProductFeature` - - Add support for `event_name` on parameter class `stripe.billing.MeterEventAdjustment.CreateParams` and resource `stripe.billing.MeterEventAdjustment` - - Add support for `cancel` and `type` on resource `stripe.billing.MeterEventAdjustment` - - Add support for resource `stripe.entitlements.ActiveEntitlement` - - Add support for resource `stripe.entitlements.Feature` - - Add support for `none` on enum `stripe.Account.type` - -- [#1299](https://github.com/stripe/stripe-python/pull/1299) Fix README.md -- [#1292](https://github.com/stripe/stripe-python/pull/1292) Tweak changelog for python async note +* [#1295](https://github.com/stripe/stripe-python/pull/1295) Update generated code + * Add support for `fees`, `losses`, `requirement_collection` & `stripe_dashboard` on resource class `stripe.Account.Controller` + * Add support for `controller` on parameter class `stripe.Account.CreateParams` + * Add support for `create_feature`, `delete_feature`, `list_features`, `retrieve_feature` on resource `stripe.Product` + * Add support for resource `stripe.ProductFeature` + * Add support for `event_name` on parameter class `stripe.billing.MeterEventAdjustment.CreateParams` and resource `stripe.billing.MeterEventAdjustment` + * Add support for `cancel` and `type` on resource `stripe.billing.MeterEventAdjustment` + * Add support for resource `stripe.entitlements.ActiveEntitlement` + * Add support for resource `stripe.entitlements.Feature` + * Add support for `none` on enum `stripe.Account.type` + +* [#1299](https://github.com/stripe/stripe-python/pull/1299) Fix README.md +* [#1292](https://github.com/stripe/stripe-python/pull/1292) Tweak changelog for python async note ## 8.11.0b1 - 2024-04-04 - -- [#1293](https://github.com/stripe/stripe-python/pull/1293) Update generated code for beta - - Add support for `risk_controls` on parameter class `stripe.Account.CreateParams` and resource `stripe.Account` - - Add support for `promotion_code` on parameter classes `stripe.Invoice.AddLinesParamsLineDiscount`, `stripe.Invoice.CreateParamsDiscount`, `stripe.Invoice.ModifyParamsDiscount`, `stripe.Invoice.UpdateLinesParamsLineDiscount`, `stripe.InvoiceItem.CreateParamsDiscount`, `stripe.InvoiceItem.ModifyParamsDiscount`, `stripe.InvoiceLineItem.ModifyParamsDiscount`, `stripe.Quote.CreateParamsDiscount`, `stripe.Quote.CreateParamsLineActionAddDiscount`, `stripe.Quote.CreateParamsLineItemDiscount`, `stripe.Quote.CreateParamsPhaseLineItemDiscount`, `stripe.Quote.ModifyParamsDiscount`, `stripe.Quote.ModifyParamsLineActionAddDiscount`, `stripe.Quote.ModifyParamsLineItemDiscount`, and `stripe.Quote.ModifyParamsPhaseLineItemDiscount` - - Add support for `zip` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` - - Add support for `offline` on resource class `stripe.SetupAttempt.PaymentMethodDetails.CardPresent` - - Add support for `card_present` on parameter classes `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, and `stripe.SetupIntent.ModifyParamsPaymentMethodOptions` and resource class `stripe.SetupIntent.PaymentMethodOptions` - - Add support for `modify` on resource `stripe.entitlements.Feature` - - Add support for `email` on resource `stripe.identity.VerificationReport`, parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions`, and resource classes `stripe.identity.VerificationSession.Options` and `stripe.identity.VerificationSession.VerifiedOutputs` - - Add support for `phone` on resource `stripe.identity.VerificationReport`, parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions`, and resource classes `stripe.identity.VerificationSession.Options` and `stripe.identity.VerificationSession.VerifiedOutputs` - - Add support for `verification_flow` on resources `stripe.identity.VerificationReport` and `stripe.identity.VerificationSession` and parameter class `stripe.identity.VerificationSession.CreateParams` - - Add support for `provided_details` on parameter classes `stripe.identity.VerificationSession.CreateParams` and `stripe.identity.VerificationSession.ModifyParams` and resource `stripe.identity.VerificationSession` - - Add support for `allowed_merchant_countries` on parameter classes `stripe.issuing.Card.CreateParamsSpendingControls`, `stripe.issuing.Card.ModifyParamsSpendingControls`, `stripe.issuing.Cardholder.CreateParamsSpendingControls`, and `stripe.issuing.Cardholder.ModifyParamsSpendingControls` and resource classes `stripe.issuing.Card.SpendingControls` and `stripe.issuing.Cardholder.SpendingControls` - - Add support for `blocked_merchant_countries` on parameter classes `stripe.issuing.Card.CreateParamsSpendingControls`, `stripe.issuing.Card.ModifyParamsSpendingControls`, `stripe.issuing.Cardholder.CreateParamsSpendingControls`, and `stripe.issuing.Cardholder.ModifyParamsSpendingControls` and resource classes `stripe.issuing.Card.SpendingControls` and `stripe.issuing.Cardholder.SpendingControls` - - Change type of field `stripe.checkout.Session.CreateParamsPaymentMethodOptionsSwish` from `Literal['']|str` to `str` of `reference` - - Add support for `verification_flow` on enums `stripe.identity.VerificationReport.type` and `stripe.identity.VerificationSession.type` - - Add support for `email_unverified_other` on enum `stripe.identity.VerificationSession.LastError.code` - - Add support for `email_verification_declined` on enum `stripe.identity.VerificationSession.LastError.code` - - Add support for `phone_unverified_other` on enum `stripe.identity.VerificationSession.LastError.code` - - Add support for `phone_verification_declined` on enum `stripe.identity.VerificationSession.LastError.code` - - Add support for `mobile_phone_reader` on enums `stripe.terminal.Reader.device_type` and `stripe.terminal.Reader.ListParams.device_type` - - Change type of field `stripe.identity.VerificationSession.CreateParams` from `Literal['document', 'id_number']` to `NotRequired[Literal['document', 'id_number']]` of `type` - - Change type of fields `stripe.Invoice`, `stripe.InvoiceLineItem`, `stripe.QuotePreviewInvoice`, `stripe.Subscription`, and `stripe.SubscriptionItem` from `Optional[List[ExpandableField[Discount]]]` to `List[ExpandableField[Discount]]` of `discounts` - - Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` of `data` - - Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` of `image_url_png` - - Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` of `image_url_svg` - - Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[str]` to `str` of `hosted_instructions_url` - - Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[str]` to `str` of `mobile_auth_url` - - Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[QrCode]` to `QrCode` of `qr_code` - - Change type of fields `stripe.QuoteLine.Action.AddItem`, `stripe.QuoteLine.Action.SetItem`, `stripe.QuotePreviewSubscriptionSchedule.Phase.AddInvoiceItem`, `stripe.QuotePreviewSubscriptionSchedule.Phase.Item`, `stripe.QuotePreviewSubscriptionSchedule.Phase`, `stripe.SubscriptionSchedule.Phase.AddInvoiceItem`, `stripe.SubscriptionSchedule.Phase.Item`, and `stripe.SubscriptionSchedule.Phase` from `Optional[List[Discount]]` to `List[Discount]` of `discounts` +* [#1293](https://github.com/stripe/stripe-python/pull/1293) Update generated code for beta + * Add support for `risk_controls` on parameter class `stripe.Account.CreateParams` and resource `stripe.Account` + * Add support for `promotion_code` on parameter classes `stripe.Invoice.AddLinesParamsLineDiscount`, `stripe.Invoice.CreateParamsDiscount`, `stripe.Invoice.ModifyParamsDiscount`, `stripe.Invoice.UpdateLinesParamsLineDiscount`, `stripe.InvoiceItem.CreateParamsDiscount`, `stripe.InvoiceItem.ModifyParamsDiscount`, `stripe.InvoiceLineItem.ModifyParamsDiscount`, `stripe.Quote.CreateParamsDiscount`, `stripe.Quote.CreateParamsLineActionAddDiscount`, `stripe.Quote.CreateParamsLineItemDiscount`, `stripe.Quote.CreateParamsPhaseLineItemDiscount`, `stripe.Quote.ModifyParamsDiscount`, `stripe.Quote.ModifyParamsLineActionAddDiscount`, `stripe.Quote.ModifyParamsLineItemDiscount`, and `stripe.Quote.ModifyParamsPhaseLineItemDiscount` + * Add support for `zip` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` + * Add support for `offline` on resource class `stripe.SetupAttempt.PaymentMethodDetails.CardPresent` + * Add support for `card_present` on parameter classes `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, and `stripe.SetupIntent.ModifyParamsPaymentMethodOptions` and resource class `stripe.SetupIntent.PaymentMethodOptions` + * Add support for `modify` on resource `stripe.entitlements.Feature` + * Add support for `email` on resource `stripe.identity.VerificationReport`, parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions`, and resource classes `stripe.identity.VerificationSession.Options` and `stripe.identity.VerificationSession.VerifiedOutputs` + * Add support for `phone` on resource `stripe.identity.VerificationReport`, parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions`, and resource classes `stripe.identity.VerificationSession.Options` and `stripe.identity.VerificationSession.VerifiedOutputs` + * Add support for `verification_flow` on resources `stripe.identity.VerificationReport` and `stripe.identity.VerificationSession` and parameter class `stripe.identity.VerificationSession.CreateParams` + * Add support for `provided_details` on parameter classes `stripe.identity.VerificationSession.CreateParams` and `stripe.identity.VerificationSession.ModifyParams` and resource `stripe.identity.VerificationSession` + * Add support for `allowed_merchant_countries` on parameter classes `stripe.issuing.Card.CreateParamsSpendingControls`, `stripe.issuing.Card.ModifyParamsSpendingControls`, `stripe.issuing.Cardholder.CreateParamsSpendingControls`, and `stripe.issuing.Cardholder.ModifyParamsSpendingControls` and resource classes `stripe.issuing.Card.SpendingControls` and `stripe.issuing.Cardholder.SpendingControls` + * Add support for `blocked_merchant_countries` on parameter classes `stripe.issuing.Card.CreateParamsSpendingControls`, `stripe.issuing.Card.ModifyParamsSpendingControls`, `stripe.issuing.Cardholder.CreateParamsSpendingControls`, and `stripe.issuing.Cardholder.ModifyParamsSpendingControls` and resource classes `stripe.issuing.Card.SpendingControls` and `stripe.issuing.Cardholder.SpendingControls` + * Change type of field `stripe.checkout.Session.CreateParamsPaymentMethodOptionsSwish` from `Literal['']|str` to `str` of `reference` + * Add support for `verification_flow` on enums `stripe.identity.VerificationReport.type` and `stripe.identity.VerificationSession.type` + * Add support for `email_unverified_other` on enum `stripe.identity.VerificationSession.LastError.code` + * Add support for `email_verification_declined` on enum `stripe.identity.VerificationSession.LastError.code` + * Add support for `phone_unverified_other` on enum `stripe.identity.VerificationSession.LastError.code` + * Add support for `phone_verification_declined` on enum `stripe.identity.VerificationSession.LastError.code` + * Add support for `mobile_phone_reader` on enums `stripe.terminal.Reader.device_type` and `stripe.terminal.Reader.ListParams.device_type` + * Change type of field `stripe.identity.VerificationSession.CreateParams` from `Literal['document', 'id_number']` to `NotRequired[Literal['document', 'id_number']]` of `type` + * Change type of fields `stripe.Invoice`, `stripe.InvoiceLineItem`, `stripe.QuotePreviewInvoice`, `stripe.Subscription`, and `stripe.SubscriptionItem` from `Optional[List[ExpandableField[Discount]]]` to `List[ExpandableField[Discount]]` of `discounts` + * Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` of `data` + * Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` of `image_url_png` + * Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` of `image_url_svg` + * Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[str]` to `str` of `hosted_instructions_url` + * Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[str]` to `str` of `mobile_auth_url` + * Change type of field `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[QrCode]` to `QrCode` of `qr_code` + * Change type of fields `stripe.QuoteLine.Action.AddItem`, `stripe.QuoteLine.Action.SetItem`, `stripe.QuotePreviewSubscriptionSchedule.Phase.AddInvoiceItem`, `stripe.QuotePreviewSubscriptionSchedule.Phase.Item`, `stripe.QuotePreviewSubscriptionSchedule.Phase`, `stripe.SubscriptionSchedule.Phase.AddInvoiceItem`, `stripe.SubscriptionSchedule.Phase.Item`, and `stripe.SubscriptionSchedule.Phase` from `Optional[List[Discount]]` to `List[Discount]` of `discounts` ## 8.10.0 - 2024-04-04 -- [#1288](https://github.com/stripe/stripe-python/pull/1288) Port **async support** from beta to the stable channel. To use it, add an `_async` suffix to any request-making method. +* [#1288](https://github.com/stripe/stripe-python/pull/1288) Port **async support** from beta to the stable channel. To use it, add an `_async` suffix to any request-making method. ```diff - cus = stripe.Customer.create(...) @@ -697,912 +644,809 @@ ``` See the [README](./README.md#async) for detailed usage instructions. Support is provided out of the box for async requests via the HTTPX (used by default) and aiohttp libraries. For other libraries, you can also provide your own `stripe.HTTPClient` implementation. Please do not hesitate to [open a Github issue](https://github.com/stripe/stripe-python/issues/new/choose) if you have any feedback on this feature. - -- [#1284](https://github.com/stripe/stripe-python/pull/1284) Update generated code - - Add support for `subscription_item` on resource `stripe.Discount` - - Add support for `promotion_code` on parameter classes `stripe.Invoice.CreateParamsDiscount`, `stripe.Invoice.ModifyParamsDiscount`, `stripe.InvoiceItem.CreateParamsDiscount`, `stripe.InvoiceItem.ModifyParamsDiscount`, `stripe.InvoiceLineItem.ModifyParamsDiscount`, `stripe.Quote.CreateParamsDiscount`, and `stripe.Quote.ModifyParamsDiscount` - - Add support for `discounts` on parameter classes `stripe.Invoice.UpcomingLinesParamsSubscriptionItem`, `stripe.Invoice.UpcomingParamsSubscriptionItem`, `stripe.Quote.CreateParamsLineItem`, `stripe.Quote.ModifyParamsLineItem`, `stripe.Subscription.CreateParams`, `stripe.Subscription.CreateParamsAddInvoiceItem`, `stripe.Subscription.CreateParamsItem`, `stripe.Subscription.ModifyParams`, `stripe.Subscription.ModifyParamsAddInvoiceItem`, `stripe.Subscription.ModifyParamsItem`, `stripe.SubscriptionItem.CreateParams`, `stripe.SubscriptionItem.ModifyParams`, `stripe.SubscriptionSchedule.CreateParamsPhase`, `stripe.SubscriptionSchedule.CreateParamsPhaseAddInvoiceItem`, `stripe.SubscriptionSchedule.CreateParamsPhaseItem`, `stripe.SubscriptionSchedule.ModifyParamsPhase`, `stripe.SubscriptionSchedule.ModifyParamsPhaseAddInvoiceItem`, and `stripe.SubscriptionSchedule.ModifyParamsPhaseItem`, resources `stripe.Subscription` and `stripe.SubscriptionItem`, and resource classes `stripe.SubscriptionSchedule.Phase.AddInvoiceItem`, `stripe.SubscriptionSchedule.Phase.Item`, and `stripe.SubscriptionSchedule.Phase` - - Add support for `zip` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` - - Add support for `offline` on resource class `stripe.SetupAttempt.PaymentMethodDetails.CardPresent` - - Add support for `card_present` on parameter classes `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, and `stripe.SetupIntent.ModifyParamsPaymentMethodOptions` and resource class `stripe.SetupIntent.PaymentMethodOptions` - - Add support for `email` on resource `stripe.identity.VerificationReport`, parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions`, and resource classes `stripe.identity.VerificationSession.Options` and `stripe.identity.VerificationSession.VerifiedOutputs` - - Add support for `phone` on resource `stripe.identity.VerificationReport`, parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions`, and resource classes `stripe.identity.VerificationSession.Options` and `stripe.identity.VerificationSession.VerifiedOutputs` - - Add support for `verification_flow` on resources `stripe.identity.VerificationReport` and `stripe.identity.VerificationSession` and parameter class `stripe.identity.VerificationSession.CreateParams` - - Add support for `provided_details` on parameter classes `stripe.identity.VerificationSession.CreateParams` and `stripe.identity.VerificationSession.ModifyParams` and resource `stripe.identity.VerificationSession` - - Add support for `allowed_merchant_countries` on parameter classes `stripe.issuing.Card.CreateParamsSpendingControls`, `stripe.issuing.Card.ModifyParamsSpendingControls`, `stripe.issuing.Cardholder.CreateParamsSpendingControls`, and `stripe.issuing.Cardholder.ModifyParamsSpendingControls` and resource classes `stripe.issuing.Card.SpendingControls` and `stripe.issuing.Cardholder.SpendingControls` - - Add support for `blocked_merchant_countries` on parameter classes `stripe.issuing.Card.CreateParamsSpendingControls`, `stripe.issuing.Card.ModifyParamsSpendingControls`, `stripe.issuing.Cardholder.CreateParamsSpendingControls`, and `stripe.issuing.Cardholder.ModifyParamsSpendingControls` and resource classes `stripe.issuing.Card.SpendingControls` and `stripe.issuing.Cardholder.SpendingControls` - - Change type of `reference` on `stripe.checkout.Session.CreateParamsPaymentMethodOptionsSwish` from `Literal['']|str` to `str` - - Add support for `verification_flow` on enums `stripe.identity.VerificationReport.type` and `stripe.identity.VerificationSession.type` - - Add support for `email_unverified_other` on enum `stripe.identity.VerificationSession.LastError.code` - - Add support for `email_verification_declined` on enum `stripe.identity.VerificationSession.LastError.code` - - Add support for `phone_unverified_other` on enum `stripe.identity.VerificationSession.LastError.code` - - Add support for `phone_verification_declined` on enum `stripe.identity.VerificationSession.LastError.code` - - Add support for `mobile_phone_reader` on enums `stripe.terminal.Reader.device_type` and `stripe.terminal.Reader.ListParams.device_type` - - Change type of `type` on `stripe.identity.VerificationSession.CreateParams` from `Literal['document', 'id_number']` to `NotRequired[Literal['document', 'id_number']]` - - Change type of `discounts` on `stripe.Invoice` and `stripe.InvoiceLineItem` from `Optional[List[ExpandableField[Discount]]]` to `List[ExpandableField[Discount]]` - - Change type of `data` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` - - Change type of `image_url_png` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` - - Change type of `image_url_svg` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` - - Change type of `hosted_instructions_url` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[str]` to `str` - - Change type of `mobile_auth_url` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[str]` to `str` - - Change type of `qr_code` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[QrCode]` to `QrCode` -- [#1289](https://github.com/stripe/stripe-python/pull/1289) Bump aiohttp from 3.9.0 to 3.9.2 +* [#1284](https://github.com/stripe/stripe-python/pull/1284) Update generated code + * Add support for `subscription_item` on resource `stripe.Discount` + * Add support for `promotion_code` on parameter classes `stripe.Invoice.CreateParamsDiscount`, `stripe.Invoice.ModifyParamsDiscount`, `stripe.InvoiceItem.CreateParamsDiscount`, `stripe.InvoiceItem.ModifyParamsDiscount`, `stripe.InvoiceLineItem.ModifyParamsDiscount`, `stripe.Quote.CreateParamsDiscount`, and `stripe.Quote.ModifyParamsDiscount` + * Add support for `discounts` on parameter classes `stripe.Invoice.UpcomingLinesParamsSubscriptionItem`, `stripe.Invoice.UpcomingParamsSubscriptionItem`, `stripe.Quote.CreateParamsLineItem`, `stripe.Quote.ModifyParamsLineItem`, `stripe.Subscription.CreateParams`, `stripe.Subscription.CreateParamsAddInvoiceItem`, `stripe.Subscription.CreateParamsItem`, `stripe.Subscription.ModifyParams`, `stripe.Subscription.ModifyParamsAddInvoiceItem`, `stripe.Subscription.ModifyParamsItem`, `stripe.SubscriptionItem.CreateParams`, `stripe.SubscriptionItem.ModifyParams`, `stripe.SubscriptionSchedule.CreateParamsPhase`, `stripe.SubscriptionSchedule.CreateParamsPhaseAddInvoiceItem`, `stripe.SubscriptionSchedule.CreateParamsPhaseItem`, `stripe.SubscriptionSchedule.ModifyParamsPhase`, `stripe.SubscriptionSchedule.ModifyParamsPhaseAddInvoiceItem`, and `stripe.SubscriptionSchedule.ModifyParamsPhaseItem`, resources `stripe.Subscription` and `stripe.SubscriptionItem`, and resource classes `stripe.SubscriptionSchedule.Phase.AddInvoiceItem`, `stripe.SubscriptionSchedule.Phase.Item`, and `stripe.SubscriptionSchedule.Phase` + * Add support for `zip` on parameter classes `stripe.PaymentMethodConfiguration.CreateParams` and `stripe.PaymentMethodConfiguration.ModifyParams` and resource `stripe.PaymentMethodConfiguration` + * Add support for `offline` on resource class `stripe.SetupAttempt.PaymentMethodDetails.CardPresent` + * Add support for `card_present` on parameter classes `stripe.SetupIntent.ConfirmParamsPaymentMethodOptions`, `stripe.SetupIntent.CreateParamsPaymentMethodOptions`, and `stripe.SetupIntent.ModifyParamsPaymentMethodOptions` and resource class `stripe.SetupIntent.PaymentMethodOptions` + * Add support for `email` on resource `stripe.identity.VerificationReport`, parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions`, and resource classes `stripe.identity.VerificationSession.Options` and `stripe.identity.VerificationSession.VerifiedOutputs` + * Add support for `phone` on resource `stripe.identity.VerificationReport`, parameter classes `stripe.identity.VerificationSession.CreateParamsOptions` and `stripe.identity.VerificationSession.ModifyParamsOptions`, and resource classes `stripe.identity.VerificationSession.Options` and `stripe.identity.VerificationSession.VerifiedOutputs` + * Add support for `verification_flow` on resources `stripe.identity.VerificationReport` and `stripe.identity.VerificationSession` and parameter class `stripe.identity.VerificationSession.CreateParams` + * Add support for `provided_details` on parameter classes `stripe.identity.VerificationSession.CreateParams` and `stripe.identity.VerificationSession.ModifyParams` and resource `stripe.identity.VerificationSession` + * Add support for `allowed_merchant_countries` on parameter classes `stripe.issuing.Card.CreateParamsSpendingControls`, `stripe.issuing.Card.ModifyParamsSpendingControls`, `stripe.issuing.Cardholder.CreateParamsSpendingControls`, and `stripe.issuing.Cardholder.ModifyParamsSpendingControls` and resource classes `stripe.issuing.Card.SpendingControls` and `stripe.issuing.Cardholder.SpendingControls` + * Add support for `blocked_merchant_countries` on parameter classes `stripe.issuing.Card.CreateParamsSpendingControls`, `stripe.issuing.Card.ModifyParamsSpendingControls`, `stripe.issuing.Cardholder.CreateParamsSpendingControls`, and `stripe.issuing.Cardholder.ModifyParamsSpendingControls` and resource classes `stripe.issuing.Card.SpendingControls` and `stripe.issuing.Cardholder.SpendingControls` + * Change type of `reference` on `stripe.checkout.Session.CreateParamsPaymentMethodOptionsSwish` from `Literal['']|str` to `str` + * Add support for `verification_flow` on enums `stripe.identity.VerificationReport.type` and `stripe.identity.VerificationSession.type` + * Add support for `email_unverified_other` on enum `stripe.identity.VerificationSession.LastError.code` + * Add support for `email_verification_declined` on enum `stripe.identity.VerificationSession.LastError.code` + * Add support for `phone_unverified_other` on enum `stripe.identity.VerificationSession.LastError.code` + * Add support for `phone_verification_declined` on enum `stripe.identity.VerificationSession.LastError.code` + * Add support for `mobile_phone_reader` on enums `stripe.terminal.Reader.device_type` and `stripe.terminal.Reader.ListParams.device_type` + * Change type of `type` on `stripe.identity.VerificationSession.CreateParams` from `Literal['document', 'id_number']` to `NotRequired[Literal['document', 'id_number']]` + * Change type of `discounts` on `stripe.Invoice` and `stripe.InvoiceLineItem` from `Optional[List[ExpandableField[Discount]]]` to `List[ExpandableField[Discount]]` + * Change type of `data` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` + * Change type of `image_url_png` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` + * Change type of `image_url_svg` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode.QrCode` from `Optional[str]` to `str` + * Change type of `hosted_instructions_url` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[str]` to `str` + * Change type of `mobile_auth_url` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[str]` to `str` + * Change type of `qr_code` on `stripe.PaymentIntent.NextAction.SwishHandleRedirectOrDisplayQrCode` from `Optional[QrCode]` to `QrCode` +* [#1289](https://github.com/stripe/stripe-python/pull/1289) Bump aiohttp from 3.9.0 to 3.9.2 ## 8.10.0b1 - 2024-03-28 +* [#1277](https://github.com/stripe/stripe-python/pull/1277) Update generated code for beta + * Add support for `financial_account_transactions`, `financial_account`, `issuing_card`, and `issuing_cards_list` on `AccountSession.CreateParamsComponents` and `AccountSessionService.CreateParamsComponents` + * Remove support for `subscription_billing_cycle_anchor`, `subscription_cancel_at_period_end`, `subscription_cancel_at`, `subscription_cancel_now`, `subscription_default_tax_rates`, `subscription_items`, `subscription_prebilling`, `subscription_proration_behavior`, `subscription_proration_date`, `subscription_resume_at`, `subscription_start_date`, and `subscription_trial_end` on `Invoice.CreatePreviewParams` and `InvoiceService.CreatePreviewParams` -- [#1277](https://github.com/stripe/stripe-python/pull/1277) Update generated code for beta - - - Add support for `financial_account_transactions`, `financial_account`, `issuing_card`, and `issuing_cards_list` on `AccountSession.CreateParamsComponents` and `AccountSessionService.CreateParamsComponents` - - Remove support for `subscription_billing_cycle_anchor`, `subscription_cancel_at_period_end`, `subscription_cancel_at`, `subscription_cancel_now`, `subscription_default_tax_rates`, `subscription_items`, `subscription_prebilling`, `subscription_proration_behavior`, `subscription_proration_date`, `subscription_resume_at`, `subscription_start_date`, and `subscription_trial_end` on `Invoice.CreatePreviewParams` and `InvoiceService.CreatePreviewParams` - -- [#1283](https://github.com/stripe/stripe-python/pull/1283) Fix unneccessary quotes +* [#1283](https://github.com/stripe/stripe-python/pull/1283) Fix unneccessary quotes ## 8.9.0 - 2024-03-28 - -- [#1276](https://github.com/stripe/stripe-python/pull/1276) Update generated code - - Add support for new resources `Billing.MeterEventAdjustment`, `Billing.MeterEvent`, and `Billing.Meter` - - Add support for `create`, `deactivate`, `list`, `modify`, `reactivate`, and `retrieve` methods on resource `Meter` - - Add support for `create` method on resources `MeterEventAdjustment` and `MeterEvent` - - Add support for `amazon_pay_payments` on `Account.Capabilities`, `Account.CreateParamsCapabilities`, `Account.UpdateParamsCapabilities`,`AccountService.CreateParamsCapabilities`, and `AccountService.UpdateParamsCapabilities` - - Add support for new value `verification_failed_representative_authority` on enums `Account.FutureRequirements.Error.code`, `Account.Requirements.Errors.code`, `BankAccount.FutureRequirements.Error.code`, `BankAccount.Requirements.Errors.code`, `Capability.FutureRequirements.Error.code`, `Capability.Requirements.Errors.code`, `Person.FutureRequirements.Error.code`, `Person.Requirements.Errors.code`, - - Add support for `destination_on_behalf_of_charge_management` on `AccountSession.Components.PaymentDetails.Features`, `AccountSession.Components.Payments.Features`, `AccountSession.CreateParamsComponentsPaymentDetailsFeatures`, `AccountSession.CreateParamsComponentsPaymentsFeatures`, `AccountSessionService.CreateParamsComponentsPaymentDetailsFeatures` and `AccountSessionService.CreateParamsComponentsPaymentsFeatures` - - Add support for `meter` on `Plan.CreateParams`, `Plan`, `PlanService.CreateParams`, `Price.Recurring`, `Price.CreateParamsRecurring`, `Price.ListParamsRecurring`, `PriceService.CreateParamsRecurring`, and `PriceService.ListParamsRecurring` - - Add support for `mandate` on `Charge.PaymentMethodDetails.USBankAccount`, `Treasury.InboundTransfer.OriginPaymentMethodDetails.USBankAccount`, `Treasury.OutboundPayment.DestinationPaymentMethodDetails.USBankAccount`, and `Treasury.OutboundTransfer.DestinationPaymentMethodDetails.USBankAccount` - - Add support for `second_line` on `Issuing.Card.CreateParams` -- [#1278](https://github.com/stripe/stripe-python/pull/1278) Types: remove unnecessary quotes -- [#1279](https://github.com/stripe/stripe-python/pull/1279) Update README.md +* [#1276](https://github.com/stripe/stripe-python/pull/1276) Update generated code + * Add support for new resources `Billing.MeterEventAdjustment`, `Billing.MeterEvent`, and `Billing.Meter` + * Add support for `create`, `deactivate`, `list`, `modify`, `reactivate`, and `retrieve` methods on resource `Meter` + * Add support for `create` method on resources `MeterEventAdjustment` and `MeterEvent` + * Add support for `amazon_pay_payments` on `Account.Capabilities`, `Account.CreateParamsCapabilities`, `Account.UpdateParamsCapabilities`,`AccountService.CreateParamsCapabilities`, and `AccountService.UpdateParamsCapabilities` + * Add support for new value `verification_failed_representative_authority` on enums `Account.FutureRequirements.Error.code`, `Account.Requirements.Errors.code`, `BankAccount.FutureRequirements.Error.code`, `BankAccount.Requirements.Errors.code`, `Capability.FutureRequirements.Error.code`, `Capability.Requirements.Errors.code`, `Person.FutureRequirements.Error.code`, `Person.Requirements.Errors.code`, + * Add support for `destination_on_behalf_of_charge_management` on `AccountSession.Components.PaymentDetails.Features`, `AccountSession.Components.Payments.Features`, `AccountSession.CreateParamsComponentsPaymentDetailsFeatures`, `AccountSession.CreateParamsComponentsPaymentsFeatures`, `AccountSessionService.CreateParamsComponentsPaymentDetailsFeatures` and `AccountSessionService.CreateParamsComponentsPaymentsFeatures` + * Add support for `meter` on `Plan.CreateParams`, `Plan`, `PlanService.CreateParams`, `Price.Recurring`, `Price.CreateParamsRecurring`, `Price.ListParamsRecurring`, `PriceService.CreateParamsRecurring`, and `PriceService.ListParamsRecurring` + * Add support for `mandate` on `Charge.PaymentMethodDetails.USBankAccount`, `Treasury.InboundTransfer.OriginPaymentMethodDetails.USBankAccount`, `Treasury.OutboundPayment.DestinationPaymentMethodDetails.USBankAccount`, and `Treasury.OutboundTransfer.DestinationPaymentMethodDetails.USBankAccount` + * Add support for `second_line` on `Issuing.Card.CreateParams` +* [#1278](https://github.com/stripe/stripe-python/pull/1278) Types: remove unnecessary quotes +* [#1279](https://github.com/stripe/stripe-python/pull/1279) Update README.md ## 8.9.0b1 - 2024-03-21 - -- [#1272](https://github.com/stripe/stripe-python/pull/1272) Update generated code for beta - - Add support for new resources `Entitlements.ActiveEntitlementSummary` and `Entitlements.ActiveEntitlement` - - Add support for `list` method on resource `ActiveEntitlement` -- [#1271](https://github.com/stripe/stripe-python/pull/1271) Support AIOHTTPClient init without running event loop +* [#1272](https://github.com/stripe/stripe-python/pull/1272) Update generated code for beta + * Add support for new resources `Entitlements.ActiveEntitlementSummary` and `Entitlements.ActiveEntitlement` + * Add support for `list` method on resource `ActiveEntitlement` +* [#1271](https://github.com/stripe/stripe-python/pull/1271) Support AIOHTTPClient init without running event loop ## 8.8.0 - 2024-03-21 - -- [#1273](https://github.com/stripe/stripe-python/pull/1273) Update generated code - - Add support for new resources `ConfirmationToken` and `Forwarding.Request` - - Add support for `retrieve` method on resource `ConfirmationToken` - - Add support for `create`, `list`, and `retrieve` methods on resource `Request` - - Add support for `mobilepay_payments` on `Account.Capabilities`, `Account.CreateParamsCapabilities`, and `Account.UpdateParamsCapabilities` - - Add support for new values `forwarding_api_inactive`, `forwarding_api_invalid_parameter`, `forwarding_api_upstream_connection_error`, and `forwarding_api_upstream_connection_timeout` on enums `Invoice.LastFinalizationError.code`, `PaymentIntent.LastPaymentError.code`, `SetupAttempt.SetupError.code`, `SetupIntent.LastSetupError.code`, and `StripeError.code` - - Add support for `payment_reference` on `Charge.PaymentMethodDetails.UsBankAccount` - - Add support for `payout` on `Treasury.ReceivedDebit.LinkedFlows` - - Add support for `name` on `ConfigurationService.CreateParams`, `ConfigurationService.UpdateParams`, and `Configuration` for terminal - - Add support for `confirmation_token` on `PaymentIntentService.ConfirmParams`, `PaymentIntentService.CreateParams`, `SetupIntentService.ConfirmParams`, and `SetupIntentService.CreateParams` - - Add support for new value `mobilepay` on enums `Customer.ListPaymentMethodsParams.type`, `PaymentMethod.CreateParams.type`, and `PaymentMethod.ListParams.type` - - Add support for `mobilepay` on `Charge.PaymentMethodDetails`, `PaymentIntent.PaymentMethodOptions`, `PaymentIntentService.ConfirmParamsPaymentMethodData`, `PaymentIntentService.ConfirmParamsPaymentMethodOptions`, `PaymentIntentService.CreateParamsPaymentMethodData`, `PaymentIntentService.CreateParamsPaymentMethodOptions`, `PaymentIntentService.UpdateParamsPaymentMethodData`, `PaymentIntentService.UpdateParamsPaymentMethodOptions`, `PaymentMethod.CreateParams`, `PaymentMethod`, `SetupIntentService.ConfirmParamsPaymentMethodData`, `SetupIntentService.CreateParamsPaymentMethodData`, and `SetupIntentService.UpdateParamsPaymentMethodData` - - Add support for new value `mobilepay` on enums `PaymentIntentService.ConfirmParamsPaymentMethodData.type`, `PaymentIntentService.CreateParamsPaymentMethodData.type`, `PaymentIntentService.UpdateParamsPaymentMethodData.type`, `SetupIntentService.ConfirmParamsPaymentMethodData.type`, `SetupIntentService.CreateParamsPaymentMethodData.type`, and `SetupIntentService.UpdateParamsPaymentMethodData.type` - - Add support for new value `mobilepay` on enum `PaymentMethod.type` +* [#1273](https://github.com/stripe/stripe-python/pull/1273) Update generated code + * Add support for new resources `ConfirmationToken` and `Forwarding.Request` + * Add support for `retrieve` method on resource `ConfirmationToken` + * Add support for `create`, `list`, and `retrieve` methods on resource `Request` + * Add support for `mobilepay_payments` on `Account.Capabilities`, `Account.CreateParamsCapabilities`, and `Account.UpdateParamsCapabilities` + * Add support for new values `forwarding_api_inactive`, `forwarding_api_invalid_parameter`, `forwarding_api_upstream_connection_error`, and `forwarding_api_upstream_connection_timeout` on enums `Invoice.LastFinalizationError.code`, `PaymentIntent.LastPaymentError.code`, `SetupAttempt.SetupError.code`, `SetupIntent.LastSetupError.code`, and `StripeError.code` + * Add support for `payment_reference` on `Charge.PaymentMethodDetails.UsBankAccount` + * Add support for `payout` on `Treasury.ReceivedDebit.LinkedFlows` + * Add support for `name` on `ConfigurationService.CreateParams`, `ConfigurationService.UpdateParams`, and `Configuration` for terminal + * Add support for `confirmation_token` on `PaymentIntentService.ConfirmParams`, `PaymentIntentService.CreateParams`, `SetupIntentService.ConfirmParams`, and `SetupIntentService.CreateParams` + * Add support for new value `mobilepay` on enums `Customer.ListPaymentMethodsParams.type`, `PaymentMethod.CreateParams.type`, and `PaymentMethod.ListParams.type` + * Add support for `mobilepay` on `Charge.PaymentMethodDetails`, `PaymentIntent.PaymentMethodOptions`, `PaymentIntentService.ConfirmParamsPaymentMethodData`, `PaymentIntentService.ConfirmParamsPaymentMethodOptions`, `PaymentIntentService.CreateParamsPaymentMethodData`, `PaymentIntentService.CreateParamsPaymentMethodOptions`, `PaymentIntentService.UpdateParamsPaymentMethodData`, `PaymentIntentService.UpdateParamsPaymentMethodOptions`, `PaymentMethod.CreateParams`, `PaymentMethod`, `SetupIntentService.ConfirmParamsPaymentMethodData`, `SetupIntentService.CreateParamsPaymentMethodData`, and `SetupIntentService.UpdateParamsPaymentMethodData` + * Add support for new value `mobilepay` on enums `PaymentIntentService.ConfirmParamsPaymentMethodData.type`, `PaymentIntentService.CreateParamsPaymentMethodData.type`, `PaymentIntentService.UpdateParamsPaymentMethodData.type`, `SetupIntentService.ConfirmParamsPaymentMethodData.type`, `SetupIntentService.CreateParamsPaymentMethodData.type`, and `SetupIntentService.UpdateParamsPaymentMethodData.type` + * Add support for new value `mobilepay` on enum `PaymentMethod.type` ## 8.8.0b1 - 2024-03-14 - -- [#1270](https://github.com/stripe/stripe-python/pull/1270) Update generated code for beta - - Add support for new resources `Billing.MeterEventAdjustment`, `Billing.MeterEvent`, and `Billing.Meter` - - Add support for `create`, `deactivate`, `list`, `modify`, `reactivate`, and `retrieve` methods on resource `Meter` - - Add support for `create` method on resources `MeterEventAdjustment` and `MeterEvent` - - Add support for `create` test helper method on resource `ConfirmationToken` - - Add support for `add_lines`, `remove_lines`, and `update_lines` methods on resource `Invoice` -- [#1266](https://github.com/stripe/stripe-python/pull/1266) Beta: record usage of async interface +* [#1270](https://github.com/stripe/stripe-python/pull/1270) Update generated code for beta + * Add support for new resources `Billing.MeterEventAdjustment`, `Billing.MeterEvent`, and `Billing.Meter` + * Add support for `create`, `deactivate`, `list`, `modify`, `reactivate`, and `retrieve` methods on resource `Meter` + * Add support for `create` method on resources `MeterEventAdjustment` and `MeterEvent` + * Add support for `create` test helper method on resource `ConfirmationToken` + * Add support for `add_lines`, `remove_lines`, and `update_lines` methods on resource `Invoice` +* [#1266](https://github.com/stripe/stripe-python/pull/1266) Beta: record usage of async interface ## 8.7.0 - 2024-03-14 - -- [#1269](https://github.com/stripe/stripe-python/pull/1269) Update generated code - - Add support for `personalization_design` on parameter classes `CardService.CreateParams`, `CardService.ListParams`, `CardService.UpdateParams`, `stripe.issuing.Card.CreateParams`, `stripe.issuing.Card.ListParams`, and `stripe.issuing.Card.ModifyParams` and resource `stripe.issuing.Card` - - Add support for `sepa_debit` on parameter classes `SubscriptionService.CreateParamsPaymentSettingsPaymentMethodOptions`, `SubscriptionService.UpdateParamsPaymentSettingsPaymentMethodOptions`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptions`, and `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptions` and resource class `stripe.Subscription.PaymentSettings.PaymentMethodOptions` - - Add support for resource `stripe.issuing.PersonalizationDesign` - - Add support for resource `stripe.issuing.PhysicalBundle` - - Change type from `float` to `Literal['']|float` of `application_fee_percent` on fields `stripe.Subscription.CreateParams`, `stripe.Subscription.ModifyParams`, `SubscriptionService.UpdateParams`, and `SubscriptionService.CreateParams` +* [#1269](https://github.com/stripe/stripe-python/pull/1269) Update generated code + * Add support for `personalization_design` on parameter classes `CardService.CreateParams`, `CardService.ListParams`, `CardService.UpdateParams`, `stripe.issuing.Card.CreateParams`, `stripe.issuing.Card.ListParams`, and `stripe.issuing.Card.ModifyParams` and resource `stripe.issuing.Card` + * Add support for `sepa_debit` on parameter classes `SubscriptionService.CreateParamsPaymentSettingsPaymentMethodOptions`, `SubscriptionService.UpdateParamsPaymentSettingsPaymentMethodOptions`, `stripe.Subscription.CreateParamsPaymentSettingsPaymentMethodOptions`, and `stripe.Subscription.ModifyParamsPaymentSettingsPaymentMethodOptions` and resource class `stripe.Subscription.PaymentSettings.PaymentMethodOptions` + * Add support for resource `stripe.issuing.PersonalizationDesign` + * Add support for resource `stripe.issuing.PhysicalBundle` + * Change type from `float` to `Literal['']|float` of `application_fee_percent` on fields `stripe.Subscription.CreateParams`, `stripe.Subscription.ModifyParams`, `SubscriptionService.UpdateParams`, and `SubscriptionService.CreateParams` ## 8.7.0b1 - 2024-03-07 - -- [#1265](https://github.com/stripe/stripe-python/pull/1265) Update generated code for beta - - Add support for new value `billing_period_end` on enums `Quote.CreateParamsLineEndsAt.type`, `QuoteLine.EndsAt.type`, and `Quote.ModifyParamsLineEndsAt.type` +* [#1265](https://github.com/stripe/stripe-python/pull/1265) Update generated code for beta + * Add support for new value `billing_period_end` on enums `Quote.CreateParamsLineEndsAt.type`, `QuoteLine.EndsAt.type`, and `Quote.ModifyParamsLineEndsAt.type` ## 8.6.0 - 2024-03-07 - -- [#1267](https://github.com/stripe/stripe-python/pull/1267) Update generated code - - Add support for `documents` on `AccountSession.Components` - - Add support for `request_three_d_secure` on `Checkout.Session.PaymentMethodOptionsCard` and `Checkout.Session.CreateParams.PaymentMethodOptionsCard` - - Add support for `created` on `CreditNote.ListParams` - - Add support for `sepa_debit` on `Invoice.PaymentSettings.PaymentMethodOptions`, `InvoiceCreateParams.PaymentSettings.PaymentMethodOptions`, and `InvoiceUpdateParams.PaymentSettings.PaymentMethodOptions` -- [#1268](https://github.com/stripe/stripe-python/pull/1268) Update README.md +* [#1267](https://github.com/stripe/stripe-python/pull/1267) Update generated code + * Add support for `documents` on `AccountSession.Components` + * Add support for `request_three_d_secure` on `Checkout.Session.PaymentMethodOptionsCard` and `Checkout.Session.CreateParams.PaymentMethodOptionsCard` + * Add support for `created` on `CreditNote.ListParams` + * Add support for `sepa_debit` on `Invoice.PaymentSettings.PaymentMethodOptions`, `InvoiceCreateParams.PaymentSettings.PaymentMethodOptions`, and `InvoiceUpdateParams.PaymentSettings.PaymentMethodOptions` +* [#1268](https://github.com/stripe/stripe-python/pull/1268) Update README.md ## 8.6.0b1 - 2024-02-29 - -- [#1251](https://github.com/stripe/stripe-python/pull/1251) Update generated code for beta - - Remove support for resource `Entitlements.Event` -- [#1264](https://github.com/stripe/stripe-python/pull/1264) Remove unconditional import of TCPConnector from aiohttp in \_http_client -- [#1259](https://github.com/stripe/stripe-python/pull/1259) Add helper to add beta version +* [#1251](https://github.com/stripe/stripe-python/pull/1251) Update generated code for beta + * Remove support for resource `Entitlements.Event` +* [#1264](https://github.com/stripe/stripe-python/pull/1264) Remove unconditional import of TCPConnector from aiohttp in _http_client +* [#1259](https://github.com/stripe/stripe-python/pull/1259) Add helper to add beta version ## 8.5.0 - 2024-02-29 - -- [#1255](https://github.com/stripe/stripe-python/pull/1255) Update generated code - - Change `identity.VerificationReport.type` to be required - - Change type of `identity.VerificationSession.type` from `Optional[Literal["document", "id_number"]]` to `Literal["document", "id_number"]` - - Add support for `number` on `Invoice.CreateParams` and `Invoice.ModifyParams` - - Add support for `enable_customer_cancellation` on `terminal.Reader.Action.ProcessPaymentIntent.process_config`, `Terminal.Reader.Action.ProcessSetupIntent.process_config`, `Terminal.Reader.ProcessPaymentIntentParams.process_config`, and `Terminal.Reader.ProcessSetupIntentParams.process_config` - - Add support for `refund_payment_config` on `Terminal.Reader.Action.refund_payment` and `Terminal.Reader.RefundPaymentParams` - - Add support for `payment_method` on `Token.CreateParams.bank_account` - - Add `list_refunds` and `retrieve_refund` methods on resource `Charge`. -- [#1260](https://github.com/stripe/stripe-python/pull/1260) Update README to use add_beta_version -- [#1250](https://github.com/stripe/stripe-python/pull/1250) Fix type of ErrorObject.code +* [#1255](https://github.com/stripe/stripe-python/pull/1255) Update generated code + * Change `identity.VerificationReport.type` to be required + * Change type of `identity.VerificationSession.type` from `Optional[Literal["document", "id_number"]]` to `Literal["document", "id_number"]` + * Add support for `number` on `Invoice.CreateParams` and `Invoice.ModifyParams` + * Add support for `enable_customer_cancellation` on `terminal.Reader.Action.ProcessPaymentIntent.process_config`, `Terminal.Reader.Action.ProcessSetupIntent.process_config`, `Terminal.Reader.ProcessPaymentIntentParams.process_config`, and `Terminal.Reader.ProcessSetupIntentParams.process_config` + * Add support for `refund_payment_config` on `Terminal.Reader.Action.refund_payment` and `Terminal.Reader.RefundPaymentParams` + * Add support for `payment_method` on `Token.CreateParams.bank_account` + * Add `list_refunds` and `retrieve_refund` methods on resource `Charge`. +* [#1260](https://github.com/stripe/stripe-python/pull/1260) Update README to use add_beta_version +* [#1250](https://github.com/stripe/stripe-python/pull/1250) Fix type of ErrorObject.code ## 8.5.0b3 - 2024-02-27 - -- [#1262](https://github.com/stripe/stripe-python/pull/1262) Beta: fix ssl for AIOHTTP client +* [#1262](https://github.com/stripe/stripe-python/pull/1262) Beta: fix ssl for AIOHTTP client ## 8.5.0b2 - 2024-02-27 - -- **Python async** - In this beta release, async support is now "feature complete". If you notice missing async support for something, it's probably a bug! Usage instructions for the async interface are available in the [README.md](https://github.com/stripe/stripe-python/blob/beta/README.md#async). - - [#1253](https://github.com/stripe/stripe-python/pull/1253) Beta: Support 'allow_sync_methods=False' in HTTPXClient - - [#1254](https://github.com/stripe/stripe-python/pull/1254) Beta: add AIOHTTP http client - - [#1247](https://github.com/stripe/stripe-python/pull/1247) Make `ListObject.auto_paging_iter()` implement `AsyncIterator` +* **Python async** - In this beta release, async support is now "feature complete". If you notice missing async support for something, it's probably a bug! Usage instructions for the async interface are available in the [README.md](https://github.com/stripe/stripe-python/blob/beta/README.md#async). + * [#1253](https://github.com/stripe/stripe-python/pull/1253) Beta: Support 'allow_sync_methods=False' in HTTPXClient + * [#1254](https://github.com/stripe/stripe-python/pull/1254) Beta: add AIOHTTP http client + * [#1247](https://github.com/stripe/stripe-python/pull/1247) Make `ListObject.auto_paging_iter()` implement `AsyncIterator` ## 8.5.0b1 - 2024-02-22 +* [#1246](https://github.com/stripe/stripe-python/pull/1246) Update generated code for beta -- [#1246](https://github.com/stripe/stripe-python/pull/1246) Update generated code for beta - -- [#1239](https://github.com/stripe/stripe-python/pull/1239) Beta: Collapse HTTPClientAsync into HTTPClient - - ⚠️ Removes the `stripe.default_http_client_async` global and the `stripe.HTTPClientAsync` class. - - To set your own async-enabled http client, set `stripe.default_http_client` to a subclass of `stripe.HTTPClient` such as `stripe.HTTPXClient` that implements `.request_async`, `.sleep_async`, `.request_stream_async`, and `.close_async`. - - The default http client of the library is still `RequestsClient` for synchronous methods, that "falls back" to a `HTTPXClient` when asynchronous methods are called. +* [#1239](https://github.com/stripe/stripe-python/pull/1239) Beta: Collapse HTTPClientAsync into HTTPClient + * ⚠️ Removes the `stripe.default_http_client_async` global and the `stripe.HTTPClientAsync` class. + * To set your own async-enabled http client, set `stripe.default_http_client` to a subclass of `stripe.HTTPClient` such as `stripe.HTTPXClient` that implements `.request_async`, `.sleep_async`, `.request_stream_async`, and `.close_async`. + * The default http client of the library is still `RequestsClient` for synchronous methods, that "falls back" to a `HTTPXClient` when asynchronous methods are called. ## 8.4.0 - 2024-02-22 - -- [#1241](https://github.com/stripe/stripe-python/pull/1241) Update generated code - - Add `InvoiceLineItem.modify` method. -- [#1244](https://github.com/stripe/stripe-python/pull/1244) Add TaxIds API - - Add support for `create`, `retrieve`, `delete`, and `list` methods on resource `TaxId` - - The `instance_url` function on resource `TaxId` now returns the top-level `/v1/tax_ids/{id}` path instead of the `/v1/customers/{customer}/tax_ids/{id}` path. -- [#1243](https://github.com/stripe/stripe-python/pull/1243) Remove http client base -- [#1242](https://github.com/stripe/stripe-python/pull/1242) Testing: unify http client mock +* [#1241](https://github.com/stripe/stripe-python/pull/1241) Update generated code + - Add `InvoiceLineItem.modify` method. +* [#1244](https://github.com/stripe/stripe-python/pull/1244) Add TaxIds API + * Add support for `create`, `retrieve`, `delete`, and `list` methods on resource `TaxId` + * The `instance_url` function on resource `TaxId` now returns the top-level `/v1/tax_ids/{id}` path instead of the `/v1/customers/{customer}/tax_ids/{id}` path. +* [#1243](https://github.com/stripe/stripe-python/pull/1243) Remove http client base +* [#1242](https://github.com/stripe/stripe-python/pull/1242) Testing: unify http client mock ## 8.4.0b1 - 2024-02-16 - -- [#1235](https://github.com/stripe/stripe-python/pull/1235) Update generated code for beta - - Add support for `payto` and `twint` payment methods throughout the API - - Add support for `decrement_authorization` method on resource `PaymentIntent` -- [#1236](https://github.com/stripe/stripe-python/pull/1236) Beta: StripeStreamResponseAsync.read helper -- [#1233](https://github.com/stripe/stripe-python/pull/1233) Beta: async streaming +* [#1235](https://github.com/stripe/stripe-python/pull/1235) Update generated code for beta + * Add support for `payto` and `twint` payment methods throughout the API + * Add support for `decrement_authorization` method on resource `PaymentIntent` +* [#1236](https://github.com/stripe/stripe-python/pull/1236) Beta: StripeStreamResponseAsync.read helper +* [#1233](https://github.com/stripe/stripe-python/pull/1233) Beta: async streaming ## 8.3.0 - 2024-02-15 - -- [#1230](https://github.com/stripe/stripe-python/pull/1230) Update generated code - - Add support for `networks` on `Card`, `PaymentMethod.CreateParamsCard`, `PaymentMethod.ModifyParamsCard`, and `Token.CreateParamsCard` - - Add support for new value `no_voec` on enums `Checkout.Session.CustomerDetails.TaxId.type`, `Invoice.CustomerTaxId.type`, `Tax.Calculation.CustomerDetails.TaxId.type`, `Tax.Transaction.CustomerDetails.TaxId.type`, and `TaxId.type` - - Add support for new value `no_voec` on enums `Customer.CreateParams.tax_id_data[].type`, `Invoice.UpcomingLinesParams.customer_details.tax_ids[].type`, `Invoice.UpcomingParams.customer_details.tax_ids[].type`, and `Tax.Calculation.CreateParams.customer_details.tax_ids[].type` - - Add support for new value `financial_connections.account.refreshed_ownership` on enum `Event.type` - - Add support for `display_brand` on `PaymentMethod.card` - - Add support for new value `financial_connections.account.refreshed_ownership` on enums `WebhookEndpoint.CreateParams.enabled_events[]` and `WebhookEndpoint.UpdateParams.enabled_events[]` -- [#1237](https://github.com/stripe/stripe-python/pull/1237) Remove broken child methods - - Bugfix: remove support for `CreditNoteLineItem.list`, `CustomerCashBalanceTransaction.list`, and `CustomerCashBalanceTransaction.retrieve`. These methods were included in the library unintentionally and never functioned. -- [#1232](https://github.com/stripe/stripe-python/pull/1232) Improve types in \_http_client.py +* [#1230](https://github.com/stripe/stripe-python/pull/1230) Update generated code + * Add support for `networks` on `Card`, `PaymentMethod.CreateParamsCard`, `PaymentMethod.ModifyParamsCard`, and `Token.CreateParamsCard` + * Add support for new value `no_voec` on enums `Checkout.Session.CustomerDetails.TaxId.type`, `Invoice.CustomerTaxId.type`, `Tax.Calculation.CustomerDetails.TaxId.type`, `Tax.Transaction.CustomerDetails.TaxId.type`, and `TaxId.type` + * Add support for new value `no_voec` on enums `Customer.CreateParams.tax_id_data[].type`, `Invoice.UpcomingLinesParams.customer_details.tax_ids[].type`, `Invoice.UpcomingParams.customer_details.tax_ids[].type`, and `Tax.Calculation.CreateParams.customer_details.tax_ids[].type` + * Add support for new value `financial_connections.account.refreshed_ownership` on enum `Event.type` + * Add support for `display_brand` on `PaymentMethod.card` + * Add support for new value `financial_connections.account.refreshed_ownership` on enums `WebhookEndpoint.CreateParams.enabled_events[]` and `WebhookEndpoint.UpdateParams.enabled_events[]` +* [#1237](https://github.com/stripe/stripe-python/pull/1237) Remove broken child methods + * Bugfix: remove support for `CreditNoteLineItem.list`, `CustomerCashBalanceTransaction.list`, and `CustomerCashBalanceTransaction.retrieve`. These methods were included in the library unintentionally and never functioned. +* [#1232](https://github.com/stripe/stripe-python/pull/1232) Improve types in _http_client.py ## 8.3.0b1 - 2024-02-08 - -- [#1226](https://github.com/stripe/stripe-python/pull/1226) Update generated code for beta - - Add support for `payment_method_options` on `ConfirmationToken` -- [#1228](https://github.com/stripe/stripe-python/pull/1228) Beta: add `_async` methods for StripeClient +* [#1226](https://github.com/stripe/stripe-python/pull/1226) Update generated code for beta + * Add support for `payment_method_options` on `ConfirmationToken` +* [#1228](https://github.com/stripe/stripe-python/pull/1228) Beta: add `_async` methods for StripeClient ## 8.2.0 - 2024-02-08 - -- [#1225](https://github.com/stripe/stripe-python/pull/1225) Update generated code - - Add support for `invoices` on `Account.Settings` - - Add support for new value `velobank` on various enums `PaymentMethodDetails.P24.bank` - - Add support for `setup_future_usage` on `PaymentMethodOptions.Blik` - - Add support for `require_cvc_recollection` on `PaymentMethodOptions.Card` - - Add support for `account_tax_ids` on various `InvoiceSettings` request parameters -- [#1223](https://github.com/stripe/stripe-python/pull/1223) Move StripeClient usage collection onto StripeService -- [#1220](https://github.com/stripe/stripe-python/pull/1220) Measure StripeClient usage +* [#1225](https://github.com/stripe/stripe-python/pull/1225) Update generated code + * Add support for `invoices` on `Account.Settings` + * Add support for new value `velobank` on various enums `PaymentMethodDetails.P24.bank` + * Add support for `setup_future_usage` on `PaymentMethodOptions.Blik` + * Add support for `require_cvc_recollection` on `PaymentMethodOptions.Card` + * Add support for `account_tax_ids` on various `InvoiceSettings` request parameters +* [#1223](https://github.com/stripe/stripe-python/pull/1223) Move StripeClient usage collection onto StripeService +* [#1220](https://github.com/stripe/stripe-python/pull/1220) Measure StripeClient usage ## 8.2.0b1 - 2024-02-05 - -- [#1218](https://github.com/stripe/stripe-python/pull/1218) Update generated code for beta - - Add support for new resources `Entitlements.Event` and `Entitlements.Feature` - - Add support for `create` method on resource `Event` - - Add support for `create` and `list` methods on resource `Feature` -- [#1171](https://github.com/stripe/stripe-python/pull/1171) Beta: codegenned async methods on resources -- [#1219](https://github.com/stripe/stripe-python/pull/1219) Beta: more async infrastructure -- [#1210](https://github.com/stripe/stripe-python/pull/1210) Beta: better support for trio in HTTPClientAsync - - Fixes support for `trio` on HttpClientAsync. -- [#1209](https://github.com/stripe/stripe-python/pull/1209) Beta: Fix HTTPXClient retries +* [#1218](https://github.com/stripe/stripe-python/pull/1218) Update generated code for beta + * Add support for new resources `Entitlements.Event` and `Entitlements.Feature` + * Add support for `create` method on resource `Event` + * Add support for `create` and `list` methods on resource `Feature` +* [#1171](https://github.com/stripe/stripe-python/pull/1171) Beta: codegenned async methods on resources +* [#1219](https://github.com/stripe/stripe-python/pull/1219) Beta: more async infrastructure +* [#1210](https://github.com/stripe/stripe-python/pull/1210) Beta: better support for trio in HTTPClientAsync + * Fixes support for `trio` on HttpClientAsync. +* [#1209](https://github.com/stripe/stripe-python/pull/1209) Beta: Fix HTTPXClient retries ## 8.1.0 - 2024-02-01 - -- [#1213](https://github.com/stripe/stripe-python/pull/1213) Update generated code - - Add support for `swish` payment method throughout the API - - Add support for `relationship` on parameter classes `Account.CreateParamsIndividual` and `Token.CreateParamsAccountIndividual` - - Add support for `jurisdiction_level` on resource `TaxRate` - - Change type from `str` to `Literal["offline", "online"]` of `status` on field `terminal.Reader` +* [#1213](https://github.com/stripe/stripe-python/pull/1213) Update generated code + * Add support for `swish` payment method throughout the API + * Add support for `relationship` on parameter classes `Account.CreateParamsIndividual` and `Token.CreateParamsAccountIndividual` + * Add support for `jurisdiction_level` on resource `TaxRate` + * Change type from `str` to `Literal["offline", "online"]` of `status` on field `terminal.Reader` ## 8.1.0b1 - 2024-01-25 - -- [#1198](https://github.com/stripe/stripe-python/pull/1198) Update generated code for beta - - Add support for `create_preview` method on resource `Invoice` -- [#1211](https://github.com/stripe/stripe-python/pull/1211) Merge master into beta +* [#1198](https://github.com/stripe/stripe-python/pull/1198) Update generated code for beta + * Add support for `create_preview` method on resource `Invoice` +* [#1211](https://github.com/stripe/stripe-python/pull/1211) Merge master into beta ## 8.0.0 - 2024-01-25 - -- [#1206](https://github.com/stripe/stripe-python/pull/1206) stripe-python v8 release - This release introduces `StripeClient` and a service-based call pattern. This new interface allows you to easily call Stripe APIs and has several benefits over the existing resource-based pattern: - - - No global config: you can simultaneously use multiple clients with different configuration options (such as API keys) - - No static methods for easier mocking - - For full migration instructions, please refer to the [v8 migration guide](). - - "⚠️" symbol highlights breaking changes - - ### ⚠️ Changed - - - ⚠️ **Request options like `api_key`, `stripe_account`, `stripe_version`, and `idempotency_key` can no longer be passed in positionally on resource methods. Please pass these in as keyword arguments.** - - **BEFORE** - - ```python - stripe.Customer.create( - "sk_test_123", # api key - "KG5LxwFBepaKHyUD", # idempotency key - "2022-11-15", # stripe version - "acct_123", # stripe account - ) - ``` - - **AFTER** - - ```python - stripe.Customer.create( - api_key="sk_test_123", - idempotency_key="KG5LxwFBepaKHyUD", - stripe_version="2022-11-15", - stripe_account="acct_123", - ) - ``` - - - ⚠️ Methods that turn a response stream (`Quote.pdf`) now returns a single value of type `StripeResponseStream` instead of a tuple containing `(StripeResponseStream, api_key)`. - - ⚠️ Removed public access to `APIRequestor`. `APIRequestor`'s main use is internal, and we don't have a good understanding of its external use cases. We had to make several breaking changes to its interface as part of this update, so rather than leaving it public we made it private. If you have a use case for `APIRequestor`, please open up a Github issue describing it. We'd rather you rely on something specifically designed for your use case than having to reach into the library's internals. - - ### ⚠️ Removed - - - ⚠️ Remove `api_version` from `File.create` parameters. Please use `stripe_version` instead. - - ⚠️ Remove `util.read_special_variable()` utility method (importing directly from `stripe.util` is deprecated as of [v7.8.0](https://github.com/stripe/stripe-python/blob/master/CHANGELOG.md#780---2023-12-07)) - - ⚠️ Remove `StripeError.construct_error_object()`. This method was intended for internal stripe-python use only. - - ⚠️ Remove `ListObject.empty_list()`. This method was intended for internal stripe-python use only. - - ⚠️ Remove `SearchResultObject.empty_search_result()`. This method was intended for internal stripe-python use only. - - ⚠️ Remove `StripeObject.ReprJSONEncoder`. This class was intended for internal stripe-python use only. - - ⚠️ Remove `StripeObject.api_base`. This property was defunct and returned `None`. +* [#1206](https://github.com/stripe/stripe-python/pull/1206) stripe-python v8 release + This release introduces `StripeClient` and a service-based call pattern. This new interface allows you to easily call Stripe APIs and has several benefits over the existing resource-based pattern: + + * No global config: you can simultaneously use multiple clients with different configuration options (such as API keys) + * No static methods for easier mocking + + For full migration instructions, please refer to the [v8 migration guide](https://github.com/stripe/stripe-python/wiki/Migration-guide-for-v8-(StripeClient)). + + "⚠️" symbol highlights breaking changes + + ### ⚠️ Changed + * ⚠️ **Request options like `api_key`, `stripe_account`, `stripe_version`, and `idempotency_key` can no longer be passed in positionally on resource methods. Please pass these in as keyword arguments.** + + **BEFORE** + ```python + stripe.Customer.create( + "sk_test_123", # api key + "KG5LxwFBepaKHyUD", # idempotency key + "2022-11-15", # stripe version + "acct_123", # stripe account + ) + ``` + + **AFTER** + ```python + stripe.Customer.create( + api_key="sk_test_123", + idempotency_key="KG5LxwFBepaKHyUD", + stripe_version="2022-11-15", + stripe_account="acct_123", + ) + ``` + * ⚠️ Methods that turn a response stream (`Quote.pdf`) now returns a single value of type `StripeResponseStream` instead of a tuple containing `(StripeResponseStream, api_key)`. + * ⚠️ Removed public access to `APIRequestor`. `APIRequestor`'s main use is internal, and we don't have a good understanding of its external use cases. We had to make several breaking changes to its interface as part of this update, so rather than leaving it public we made it private. If you have a use case for `APIRequestor`, please open up a Github issue describing it. We'd rather you rely on something specifically designed for your use case than having to reach into the library's internals. + + + ### ⚠️ Removed + * ⚠️ Remove `api_version` from `File.create` parameters. Please use `stripe_version` instead. + * ⚠️ Remove `util.read_special_variable()` utility method (importing directly from `stripe.util` is deprecated as of [v7.8.0](https://github.com/stripe/stripe-python/blob/master/CHANGELOG.md#780---2023-12-07)) + * ⚠️ Remove `StripeError.construct_error_object()`. This method was intended for internal stripe-python use only. + * ⚠️ Remove `ListObject.empty_list()`. This method was intended for internal stripe-python use only. + * ⚠️ Remove `SearchResultObject.empty_search_result()`. This method was intended for internal stripe-python use only. + * ⚠️ Remove `StripeObject.ReprJSONEncoder`. This class was intended for internal stripe-python use only. + * ⚠️ Remove `StripeObject.api_base`. This property was defunct and returned `None`. ## 7.14.0 - 2024-01-25 - -- [#1199](https://github.com/stripe/stripe-python/pull/1199) Update generated code - - Add support for `annual_revenue` and `estimated_worker_count` on `Account.business_profile`, `Account.CreateParams.business_profile`, and `Account.UpdateParams.business_profile` - - Add support for new value `registered_charity` on enums `Account.CreateParams.company.structure`, `Account.UpdateParams.company.structure`, and `Token.CreateParams.account.company.structure` - - Add support for `collection_options` on `AccountLink.CreateParams` - - Add support for `liability` on `Checkout.Session.automatic_tax`, `PaymentLink.automatic_tax`, `PaymentLink.CreateParams.automatic_tax`, `PaymentLink.UpdateParams.automatic_tax`, `Quote.automatic_tax`, `Quote.CreateParams.automatic_tax`, `Quote.UpdateParams.automatic_tax`, `SubscriptionSchedule.default_settings.automatic_tax`, `SubscriptionSchedule.phases[].automatic_tax`, `SubscriptionSchedule.CreateParams.default_settings.automatic_tax`, `SubscriptionSchedule.CreateParams.phases[].automatic_tax`, `SubscriptionSchedule.UpdateParams.default_settings.automatic_tax`, `SubscriptionSchedule.UpdateParams.phases[].automatic_tax`, and `checkout.Session.CreateParams.automatic_tax` - - Add support for `issuer` on `Checkout.Session.invoice_creation.invoice_data`, `PaymentLink.invoice_creation.invoice_data`, `PaymentLink.CreateParams.invoice_creation.invoice_data`, `PaymentLink.UpdateParams.invoice_creation.invoice_data`, `Quote.invoice_settings`, `Quote.CreateParams.invoice_settings`, `Quote.UpdateParams.invoice_settings`, `SubscriptionSchedule.default_settings.invoice_settings`, `SubscriptionSchedule.phases[].invoice_settings`, `SubscriptionSchedule.CreateParams.default_settings.invoice_settings`, `SubscriptionSchedule.CreateParams.phases[].invoice_settings`, `SubscriptionSchedule.UpdateParams.default_settings.invoice_settings`, `SubscriptionSchedule.UpdateParams.phases[].invoice_settings`, and `checkout.Session.CreateParams.invoice_creation.invoice_data` - - Add support for `invoice_settings` on `PaymentLink.subscription_data`, `PaymentLink.CreateParams.subscription_data`, `PaymentLink.UpdateParams.subscription_data`, and `checkout.Session.CreateParams.subscription_data` - - Add support for new value `challenge` on enums `Invoice.CreateParams.payment_settings.payment_method_options.card.request_three_d_secure`, `Invoice.UpdateParams.payment_settings.payment_method_options.card.request_three_d_secure`, `Subscription.CreateParams.payment_settings.payment_method_options.card.request_three_d_secure`, and `Subscription.UpdateParams.payment_settings.payment_method_options.card.request_three_d_secure` - - Add support for `promotion_code` on `Invoice.UpcomingLinesParams.discounts[]`, `Invoice.UpcomingLinesParams.invoice_items[].discounts[]`, `Invoice.UpcomingParams.discounts[]`, and `Invoice.UpcomingParams.invoice_items[].discounts[]` - - Add support for `account_type` on `PaymentMethod.UpdateParams.us_bank_account` +* [#1199](https://github.com/stripe/stripe-python/pull/1199) Update generated code + * Add support for `annual_revenue` and `estimated_worker_count` on `Account.business_profile`, `Account.CreateParams.business_profile`, and `Account.UpdateParams.business_profile` + * Add support for new value `registered_charity` on enums `Account.CreateParams.company.structure`, `Account.UpdateParams.company.structure`, and `Token.CreateParams.account.company.structure` + * Add support for `collection_options` on `AccountLink.CreateParams` + * Add support for `liability` on `Checkout.Session.automatic_tax`, `PaymentLink.automatic_tax`, `PaymentLink.CreateParams.automatic_tax`, `PaymentLink.UpdateParams.automatic_tax`, `Quote.automatic_tax`, `Quote.CreateParams.automatic_tax`, `Quote.UpdateParams.automatic_tax`, `SubscriptionSchedule.default_settings.automatic_tax`, `SubscriptionSchedule.phases[].automatic_tax`, `SubscriptionSchedule.CreateParams.default_settings.automatic_tax`, `SubscriptionSchedule.CreateParams.phases[].automatic_tax`, `SubscriptionSchedule.UpdateParams.default_settings.automatic_tax`, `SubscriptionSchedule.UpdateParams.phases[].automatic_tax`, and `checkout.Session.CreateParams.automatic_tax` + * Add support for `issuer` on `Checkout.Session.invoice_creation.invoice_data`, `PaymentLink.invoice_creation.invoice_data`, `PaymentLink.CreateParams.invoice_creation.invoice_data`, `PaymentLink.UpdateParams.invoice_creation.invoice_data`, `Quote.invoice_settings`, `Quote.CreateParams.invoice_settings`, `Quote.UpdateParams.invoice_settings`, `SubscriptionSchedule.default_settings.invoice_settings`, `SubscriptionSchedule.phases[].invoice_settings`, `SubscriptionSchedule.CreateParams.default_settings.invoice_settings`, `SubscriptionSchedule.CreateParams.phases[].invoice_settings`, `SubscriptionSchedule.UpdateParams.default_settings.invoice_settings`, `SubscriptionSchedule.UpdateParams.phases[].invoice_settings`, and `checkout.Session.CreateParams.invoice_creation.invoice_data` + * Add support for `invoice_settings` on `PaymentLink.subscription_data`, `PaymentLink.CreateParams.subscription_data`, `PaymentLink.UpdateParams.subscription_data`, and `checkout.Session.CreateParams.subscription_data` + * Add support for new value `challenge` on enums `Invoice.CreateParams.payment_settings.payment_method_options.card.request_three_d_secure`, `Invoice.UpdateParams.payment_settings.payment_method_options.card.request_three_d_secure`, `Subscription.CreateParams.payment_settings.payment_method_options.card.request_three_d_secure`, and `Subscription.UpdateParams.payment_settings.payment_method_options.card.request_three_d_secure` + * Add support for `promotion_code` on `Invoice.UpcomingLinesParams.discounts[]`, `Invoice.UpcomingLinesParams.invoice_items[].discounts[]`, `Invoice.UpcomingParams.discounts[]`, and `Invoice.UpcomingParams.invoice_items[].discounts[]` + * Add support for `account_type` on `PaymentMethod.UpdateParams.us_bank_account` ## 7.14.0b1 - 2024-01-18 - -- [#1197](https://github.com/stripe/stripe-python/pull/1197) Update generated code for beta - Release specs are identical. -- [#1192](https://github.com/stripe/stripe-python/pull/1192) Update generated code for beta - - Add support for new value `nn` on enum `ConfirmationToken.PaymentMethodPreview.Ideal.bank` - - Add support for new value `NNBANL2G` on enum `ConfirmationToken.PaymentMethodPreview.Ideal.bic` - - Change `Invoice.AutomaticTax.liability`, `Invoice.issuer`, and `Subscription.AutomaticTax.liability` to be required +* [#1197](https://github.com/stripe/stripe-python/pull/1197) Update generated code for beta + Release specs are identical. +* [#1192](https://github.com/stripe/stripe-python/pull/1192) Update generated code for beta + * Add support for new value `nn` on enum `ConfirmationToken.PaymentMethodPreview.Ideal.bank` + * Add support for new value `NNBANL2G` on enum `ConfirmationToken.PaymentMethodPreview.Ideal.bic` + * Change `Invoice.AutomaticTax.liability`, `Invoice.issuer`, and `Subscription.AutomaticTax.liability` to be required ## 7.13.0 - 2024-01-18 - -- [#1193](https://github.com/stripe/stripe-python/pull/1193) Update generated code - - Add support for providing details about `BankAccount`, `Card`, and `CardToken` on `Account.CreateExternalAccountParams.external_account` and `Account.CreateParams.external_account` - - Add support for new value `nn` on enums `Charge.PaymentMethodDetails.Ideal.bank`, `PaymentIntent.ConfirmParamsPaymentMethodDataIdeal.bank`, `PaymentIntent.CreateParamsPaymenMethodDataIdeal.bank`, `PaymentIntent.UpdateParamsPaymentMethodDataIdeal.bank`, `PaymentMethod.Ideal.bank`, `PaymentMethod.CreateParamsIdeal.bank`, `SetupAttempt.PaymentMethodDetails.Ideal.bank`, `SetupIntent.ConfirmParamsPaymenMethodDataIdeal.bank`, `SetupIntent.CreateParamsPaymenMethodDataIdeal.bank`, and `SetupIntent.UpdateParamsPaymenMethodDataIdeal.bank` - - Add support for new value `NNBANL2G` on enums `Charge.PaymentMethodDetails.Ideal.bic`, `PaymentMethod.Ideal.bic`, and `SetupAttempt.PaymentMethodDetails.Ideal.bic` - - Change `CustomerSession.Components.buy_button` and `CustomerSession.Components.pricing_table` to be required - - Add support for `issuer` on `Invoice.CreateParams`, `Invoice.UpcomingLinesParams`, `Invoice.UpcomingParams`, `Invoice.UpdateParams`, and `Invoice` - - Add support for `liability` on `Invoice.automatic_tax`, `Invoice.CreateParams.automatic_tax`, `Invoice.UpcomingLinesParams.automatic_tax`, `Invoice.UpcomingParams.automatic_tax`, `Invoice.UpdateParams.automatic_tax`, `Subscription.automatic_tax`, `Subscription.CreateParams.automatic_tax`, and `Subscription.UpdateParams.automatic_tax` - - Add support for `on_behalf_of` on `Invoice.UpcomingLinesParams` and `Invoice.UpcomingParams` - - Add support for `pin` on `issuing.Card.CreateParams` - - Add support for `revocation_reason` on `Mandate.PaymentMethodDetails.bacs_debit` - - Add support for `customer_balance` on `PaymentMethodConfiguration.CreateParams`, `PaymentMethodConfiguration.UpdateParams`, and `PaymentMethodConfiguration` - - Add support for `invoice_settings` on `Subscription.CreateParams` and `Subscription.UpdateParams` +* [#1193](https://github.com/stripe/stripe-python/pull/1193) Update generated code + * Add support for providing details about `BankAccount`, `Card`, and `CardToken` on `Account.CreateExternalAccountParams.external_account` and `Account.CreateParams.external_account` + * Add support for new value `nn` on enums `Charge.PaymentMethodDetails.Ideal.bank`, `PaymentIntent.ConfirmParamsPaymentMethodDataIdeal.bank`, `PaymentIntent.CreateParamsPaymenMethodDataIdeal.bank`, `PaymentIntent.UpdateParamsPaymentMethodDataIdeal.bank`, `PaymentMethod.Ideal.bank`, `PaymentMethod.CreateParamsIdeal.bank`, `SetupAttempt.PaymentMethodDetails.Ideal.bank`, `SetupIntent.ConfirmParamsPaymenMethodDataIdeal.bank`, `SetupIntent.CreateParamsPaymenMethodDataIdeal.bank`, and `SetupIntent.UpdateParamsPaymenMethodDataIdeal.bank` + * Add support for new value `NNBANL2G` on enums `Charge.PaymentMethodDetails.Ideal.bic`, `PaymentMethod.Ideal.bic`, and `SetupAttempt.PaymentMethodDetails.Ideal.bic` + * Change `CustomerSession.Components.buy_button` and `CustomerSession.Components.pricing_table` to be required + * Add support for `issuer` on `Invoice.CreateParams`, `Invoice.UpcomingLinesParams`, `Invoice.UpcomingParams`, `Invoice.UpdateParams`, and `Invoice` + * Add support for `liability` on `Invoice.automatic_tax`, `Invoice.CreateParams.automatic_tax`, `Invoice.UpcomingLinesParams.automatic_tax`, `Invoice.UpcomingParams.automatic_tax`, `Invoice.UpdateParams.automatic_tax`, `Subscription.automatic_tax`, `Subscription.CreateParams.automatic_tax`, and `Subscription.UpdateParams.automatic_tax` + * Add support for `on_behalf_of` on `Invoice.UpcomingLinesParams` and `Invoice.UpcomingParams` + * Add support for `pin` on `issuing.Card.CreateParams` + * Add support for `revocation_reason` on `Mandate.PaymentMethodDetails.bacs_debit` + * Add support for `customer_balance` on `PaymentMethodConfiguration.CreateParams`, `PaymentMethodConfiguration.UpdateParams`, and `PaymentMethodConfiguration` + * Add support for `invoice_settings` on `Subscription.CreateParams` and `Subscription.UpdateParams` ## 7.13.0b1 - 2024-01-12 - -- [#1189](https://github.com/stripe/stripe-python/pull/1189) Update generated code for beta -- [#1191](https://github.com/stripe/stripe-python/pull/1191) Beta: report `raw_request` usage -- [#1165](https://github.com/stripe/stripe-python/pull/1165) Beta: raw_request_async with HTTPX +* [#1189](https://github.com/stripe/stripe-python/pull/1189) Update generated code for beta +* [#1191](https://github.com/stripe/stripe-python/pull/1191) Beta: report `raw_request` usage +* [#1165](https://github.com/stripe/stripe-python/pull/1165) Beta: raw_request_async with HTTPX ## 7.12.0 - 2024-01-12 - -- [#1188](https://github.com/stripe/stripe-python/pull/1188) Update generated code - - Add support for new resource `CustomerSession` - - Add support for `create` method on resource `CustomerSession` - - Remove support for values `obligation_inbound`, `obligation_payout_failure`, `obligation_payout`, and `obligation_reversal_outbound` from enum `BalanceTransaction.type` - - Add support for new values `eps` and `p24` on enums `Invoice.payment_settings.payment_method_types[]`, `InvoiceCreateParams.payment_settings.payment_method_types[]`, `InvoiceUpdateParams.payment_settings.payment_method_types[]`, `Subscription.payment_settings.payment_method_types[]`, `SubscriptionCreateParams.payment_settings.payment_method_types[]`, and `SubscriptionUpdateParams.payment_settings.payment_method_types[]` - - Remove support for value `obligation` from enum `Reporting.ReportRunCreateParams.parameters.reporting_category` - - Add support for `billing_cycle_anchor_config` on `SubscriptionCreateParams` and `Subscription` +* [#1188](https://github.com/stripe/stripe-python/pull/1188) Update generated code + * Add support for new resource `CustomerSession` + * Add support for `create` method on resource `CustomerSession` + * Remove support for values `obligation_inbound`, `obligation_payout_failure`, `obligation_payout`, and `obligation_reversal_outbound` from enum `BalanceTransaction.type` + * Add support for new values `eps` and `p24` on enums `Invoice.payment_settings.payment_method_types[]`, `InvoiceCreateParams.payment_settings.payment_method_types[]`, `InvoiceUpdateParams.payment_settings.payment_method_types[]`, `Subscription.payment_settings.payment_method_types[]`, `SubscriptionCreateParams.payment_settings.payment_method_types[]`, and `SubscriptionUpdateParams.payment_settings.payment_method_types[]` + * Remove support for value `obligation` from enum `Reporting.ReportRunCreateParams.parameters.reporting_category` + * Add support for `billing_cycle_anchor_config` on `SubscriptionCreateParams` and `Subscription` ## 7.12.0b1 - 2024-01-04 - -- [#1187](https://github.com/stripe/stripe-python/pull/1187) Update generated code for beta - - Updated stable APIs to the latest version +* [#1187](https://github.com/stripe/stripe-python/pull/1187) Update generated code for beta + * Updated stable APIs to the latest version ## 7.11.0 - 2024-01-04 - -- [#1186](https://github.com/stripe/stripe-python/pull/1186) Update generated code - - Add support for `retrieve` on resource `tax.Registration` - - Change type from `Optional[PaymentDetails]` to `PaymentDetails` of `payment_details` on field `AccountSession.Components` - - Change type from `Optional[Payments]` to `Payments` of `payments` on field `AccountSession.Components` - - Change type from `Optional[Payouts]` to `Payouts` of `payouts` on field `AccountSession.Components` - - Change type from `Optional[Features]` to `Features` of `features` on fields `AccountSession.Components.PaymentDetails`, `AccountSession.Components.Payments`, and `AccountSession.Components.Payouts` - - Change type from `Optional[InvoiceSettings]` to `InvoiceSettings` of `invoice_settings` on field `SubscriptionSchedule.DefaultSettings` +* [#1186](https://github.com/stripe/stripe-python/pull/1186) Update generated code + * Add support for `retrieve` on resource `tax.Registration` + * Change type from `Optional[PaymentDetails]` to `PaymentDetails` of `payment_details` on field `AccountSession.Components` + * Change type from `Optional[Payments]` to `Payments` of `payments` on field `AccountSession.Components` + * Change type from `Optional[Payouts]` to `Payouts` of `payouts` on field `AccountSession.Components` + * Change type from `Optional[Features]` to `Features` of `features` on fields `AccountSession.Components.PaymentDetails`, `AccountSession.Components.Payments`, and `AccountSession.Components.Payouts` + * Change type from `Optional[InvoiceSettings]` to `InvoiceSettings` of `invoice_settings` on field `SubscriptionSchedule.DefaultSettings` ## 7.11.0b1 - 2023-12-22 - -- [#1177](https://github.com/stripe/stripe-python/pull/1177) Update generated code for beta +* [#1177](https://github.com/stripe/stripe-python/pull/1177) Update generated code for beta ## 7.10.0 - 2023-12-22 - -- [#1176](https://github.com/stripe/stripe-python/pull/1176) Update generated code - - - Add support for new resource `FinancialConnections.Transaction` - - Add support for `list` and `retrieve` methods on resource `Transaction` - - Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account` - - Add support for `features` on `AccountSessionCreateParams.components.payouts` - - Add support for `edit_payout_schedule`, `instant_payouts`, and `standard_payouts` on `AccountSession.components.payouts.features` - - Change type of `Checkout.Session.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `Checkout.SessionCreateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `Invoice.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `InvoiceCreateParams.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `InvoiceUpdateParams.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `PaymentIntent.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `PaymentIntentConfirmParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `PaymentIntentCreateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `PaymentIntentUpdateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SetupIntent.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SetupIntentConfirmParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SetupIntentCreateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SetupIntentUpdateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `Subscription.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SubscriptionCreateParams.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, and `SubscriptionUpdateParams.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]` from `literal('balances')` to `enum('balances'|'transactions')` - - Add support for new value `financial_connections.account.refreshed_transactions` on enum `Event.type` - - Add support for new value `transactions` on enum `FinancialConnections.AccountRefreshParams.features[]` - - Add support for `subscriptions` and `transaction_refresh` on `FinancialConnections.Account` - - Add support for `next_refresh_available_at` on `FinancialConnections.Account.balance_refresh` - - Add support for new value `transactions` on enums `FinancialConnections.Session.prefetch[]` and `FinancialConnections.SessionCreateParams.prefetch[]` - - Add support for new value `unknown` on enums `Issuing.Authorization.verification_data.authentication_exemption.type` and `Issuing.AuthorizationCreateParams.testHelpers.verification_data.authentication_exemption.type` - - Add support for new value `challenge` on enums `PaymentIntent.payment_method_options.card.request_three_d_secure`, `PaymentIntentConfirmParams.payment_method_options.card.request_three_d_secure`, `PaymentIntentCreateParams.payment_method_options.card.request_three_d_secure`, `PaymentIntentUpdateParams.payment_method_options.card.request_three_d_secure`, `SetupIntent.payment_method_options.card.request_three_d_secure`, `SetupIntentConfirmParams.payment_method_options.card.request_three_d_secure`, `SetupIntentCreateParams.payment_method_options.card.request_three_d_secure`, and `SetupIntentUpdateParams.payment_method_options.card.request_three_d_secure` - - Add support for `revolut_pay` on `PaymentMethodConfigurationCreateParams`, `PaymentMethodConfigurationUpdateParams`, and `PaymentMethodConfiguration` - - Change type of `Quote.invoice_settings` from `InvoiceSettingQuoteSetting | null` to `InvoiceSettingQuoteSetting` - - Add support for `destination_details` on `Refund` - - Add support for new value `financial_connections.account.refreshed_transactions` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]` - -- [#1185](https://github.com/stripe/stripe-python/pull/1185) Update generated code -- [#1184](https://github.com/stripe/stripe-python/pull/1184) Remove api_base from RequestOptions type -- [#1178](https://github.com/stripe/stripe-python/pull/1178) Support accessing reserved word resource properties via attribute +* [#1176](https://github.com/stripe/stripe-python/pull/1176) Update generated code + * Add support for new resource `FinancialConnections.Transaction` + * Add support for `list` and `retrieve` methods on resource `Transaction` + * Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account` + * Add support for `features` on `AccountSessionCreateParams.components.payouts` + * Add support for `edit_payout_schedule`, `instant_payouts`, and `standard_payouts` on `AccountSession.components.payouts.features` + * Change type of `Checkout.Session.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `Checkout.SessionCreateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `Invoice.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `InvoiceCreateParams.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `InvoiceUpdateParams.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `PaymentIntent.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `PaymentIntentConfirmParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `PaymentIntentCreateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `PaymentIntentUpdateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SetupIntent.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SetupIntentConfirmParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SetupIntentCreateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SetupIntentUpdateParams.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `Subscription.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, `SubscriptionCreateParams.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]`, and `SubscriptionUpdateParams.payment_settings.payment_method_options.us_bank_account.financial_connections.prefetch[]` from `literal('balances')` to `enum('balances'|'transactions')` + * Add support for new value `financial_connections.account.refreshed_transactions` on enum `Event.type` + * Add support for new value `transactions` on enum `FinancialConnections.AccountRefreshParams.features[]` + * Add support for `subscriptions` and `transaction_refresh` on `FinancialConnections.Account` + * Add support for `next_refresh_available_at` on `FinancialConnections.Account.balance_refresh` + * Add support for new value `transactions` on enums `FinancialConnections.Session.prefetch[]` and `FinancialConnections.SessionCreateParams.prefetch[]` + * Add support for new value `unknown` on enums `Issuing.Authorization.verification_data.authentication_exemption.type` and `Issuing.AuthorizationCreateParams.testHelpers.verification_data.authentication_exemption.type` + * Add support for new value `challenge` on enums `PaymentIntent.payment_method_options.card.request_three_d_secure`, `PaymentIntentConfirmParams.payment_method_options.card.request_three_d_secure`, `PaymentIntentCreateParams.payment_method_options.card.request_three_d_secure`, `PaymentIntentUpdateParams.payment_method_options.card.request_three_d_secure`, `SetupIntent.payment_method_options.card.request_three_d_secure`, `SetupIntentConfirmParams.payment_method_options.card.request_three_d_secure`, `SetupIntentCreateParams.payment_method_options.card.request_three_d_secure`, and `SetupIntentUpdateParams.payment_method_options.card.request_three_d_secure` + * Add support for `revolut_pay` on `PaymentMethodConfigurationCreateParams`, `PaymentMethodConfigurationUpdateParams`, and `PaymentMethodConfiguration` + * Change type of `Quote.invoice_settings` from `InvoiceSettingQuoteSetting | null` to `InvoiceSettingQuoteSetting` + * Add support for `destination_details` on `Refund` + * Add support for new value `financial_connections.account.refreshed_transactions` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]` + +* [#1185](https://github.com/stripe/stripe-python/pull/1185) Update generated code +* [#1184](https://github.com/stripe/stripe-python/pull/1184) Remove api_base from RequestOptions type +* [#1178](https://github.com/stripe/stripe-python/pull/1178) Support accessing reserved word resource properties via attribute ## 7.10.0b1 - 2023-12-14 - -- [#1166](https://github.com/stripe/stripe-python/pull/1166) Update generated code for beta -- [#1164](https://github.com/stripe/stripe-python/pull/1164) Beta: revert broken logger +* [#1166](https://github.com/stripe/stripe-python/pull/1166) Update generated code for beta +* [#1164](https://github.com/stripe/stripe-python/pull/1164) Beta: revert broken logger ## 7.9.0 - 2023-12-14 +* [#1161](https://github.com/stripe/stripe-python/pull/1161) Update generated code -- [#1161](https://github.com/stripe/stripe-python/pull/1161) Update generated code - - - Add support for `payment_method_reuse_agreement` on resource classes `PaymentLink.ConsentCollection` and `checkout.Session.ConsentCollection` and parameter classes `PaymentLink.CreateParamsConsentCollection` and `checkout.Session.CreateParamsConsentCollection` - - Add support for `after_submit` on parameter classes `PaymentLink.CreateParamsCustomText`, `PaymentLink.ModifyParamsCustomText`, and `checkout.Session.CreateParamsCustomText` and resource classes `PaymentLink.CustomText` and `checkout.Session.CustomText` - - Add support for `created` on parameter class `radar.EarlyFraudWarning.ListParams` - -- [#1146](https://github.com/stripe/stripe-python/pull/1146) Track usage of deprecated `save` - - Reports uses of the deprecated `.save` in `X-Stripe-Client-Telemetry`. (You can disable telemetry via `stripe.enable_telemetry = false`, see the [README](https://github.com/stripe/stripe-python/blob/master/README.md#telemetry).) -- [#1101](https://github.com/stripe/stripe-python/pull/1101) Mark defunct and internal methods as deprecated -- [#1169](https://github.com/stripe/stripe-python/pull/1169) Add more types to \_http_client.py + * Add support for `payment_method_reuse_agreement` on resource classes `PaymentLink.ConsentCollection` and `checkout.Session.ConsentCollection` and parameter classes `PaymentLink.CreateParamsConsentCollection` and `checkout.Session.CreateParamsConsentCollection` + * Add support for `after_submit` on parameter classes `PaymentLink.CreateParamsCustomText`, `PaymentLink.ModifyParamsCustomText`, and `checkout.Session.CreateParamsCustomText` and resource classes `PaymentLink.CustomText` and `checkout.Session.CustomText` + * Add support for `created` on parameter class `radar.EarlyFraudWarning.ListParams` +* [#1146](https://github.com/stripe/stripe-python/pull/1146) Track usage of deprecated `save` + * Reports uses of the deprecated `.save` in `X-Stripe-Client-Telemetry`. (You can disable telemetry via `stripe.enable_telemetry = false`, see the [README](https://github.com/stripe/stripe-python/blob/master/README.md#telemetry).) +* [#1101](https://github.com/stripe/stripe-python/pull/1101) Mark defunct and internal methods as deprecated +* [#1169](https://github.com/stripe/stripe-python/pull/1169) Add more types to _http_client.py ## 7.9.0b1 - 2023-12-08 - -- [#1163](https://github.com/stripe/stripe-python/pull/1163) Update generated code for beta - - Add support for `retrieve` method on resource `FinancialConnections.Transaction` +* [#1163](https://github.com/stripe/stripe-python/pull/1163) Update generated code for beta + * Add support for `retrieve` method on resource `FinancialConnections.Transaction` ## 7.8.2 - 2023-12-11 - -- [#1168](https://github.com/stripe/stripe-python/pull/1168) Do not raise a DeprecationWarning in `stripe.app_info` +* [#1168](https://github.com/stripe/stripe-python/pull/1168) Do not raise a DeprecationWarning in `stripe.app_info` ## 7.8.1 - 2023-12-08 - -- [#1159](https://github.com/stripe/stripe-python/pull/1159) Fix **getattr** to raise AttributeError rather than returning None. This fixes a regression in 7.8.0 that caused `stripe.checkout`/`stripe.issuing` etc. to return `None`. -- [#1157](https://github.com/stripe/stripe-python/pull/1157) Add missing explicit reexport for `OAuth`, `Webhook`, `WebhookSignature` +* [#1159](https://github.com/stripe/stripe-python/pull/1159) Fix __getattr__ to raise AttributeError rather than returning None. This fixes a regression in 7.8.0 that caused `stripe.checkout`/`stripe.issuing` etc. to return `None`. +* [#1157](https://github.com/stripe/stripe-python/pull/1157) Add missing explicit reexport for `OAuth`, `Webhook`, `WebhookSignature` ## 7.8.0 - 2023-12-07 - -- [#1155](https://github.com/stripe/stripe-python/pull/1155) Update generated code - - Add support for `payment_details`, `payments`, and `payouts` on `AccountSession.components` and `CreateParams.components` - - Add support for `features` on `AccountSession.components.account_onboarding` and `CreateParams.components.account_onboarding` - - Add support for new values `customer_tax_location_invalid` and `financial_connections_no_successful_transaction_refresh` on enums `Invoice.last_finalization_error.code`, `PaymentIntent.last_payment_error.code`, `SetupAttempt.setup_error.code`, `SetupIntent.last_setup_error.code`, and `StripeError.code` - - Add support for new values `payment_network_reserve_hold` and `payment_network_reserve_release` on enum `BalanceTransaction.type` - - Change `Climate.Product.metric_tons_available` to be required - - Remove support for value `various` from enum `Climate.Supplier.removal_pathway` - - Remove support for values `challenge_only` and `challenge` from enum `PaymentIntent.payment_method_options.card.request_three_d_secure` - - Add support for `inactive_message` and `restrictions` on `CreateParams`, `ModifyParams`, and `PaymentLink` - - Add support for `transfer_group` on `PaymentLink.payment_intent_data`, `CreateParams.payment_intent_data`, and `ModifyParams.payment_intent_data` - - Add support for `trial_settings` on `PaymentLink.subscription_data`, `CreateParams.subscription_data`, and `ModifyParams.subscription_data` -- [#1153](https://github.com/stripe/stripe-python/pull/1153) Move exports for more modules - - `stripe.app_info`, `stripe.http_client`, `stripe.oauth`, `stripe.util`, `stripe.version`, `stripe.webhook`, modules are deprecated. All types are available directly from `stripe` module now. - Before: - ```python - from stripe.util import convert_to_stripe_object - # or - stripe.util.convert_to_stripe_object - ``` - After: - ```python - from stripe import convert_to_stripe_object - # or - stripe.convert_to_stripe_object - ``` - - `stripe.api_version`, `stripe.multipart_data_generator`, `stripe.request_metrics` are deprecated and will be fully removed in the future. -- [#1142](https://github.com/stripe/stripe-python/pull/1142) Move resource type exports to stripe.\_\_\_ - - `stripe.error`, `stripe.stripe_object`, `stripe.api_requestor`, `stripe.stripe_response`, `stripe.request_options`, `stripe.api_resources.*`, `stripe.api_resources.abstract.*` modules are deprecated. All types are available directly from `stripe` module now. - Before: - ```python - from stripe.error import APIError - # or - stripe.error.APIError - ``` - After: - ```python - from stripe import APIError - # or - stripe.APIError - ``` +* [#1155](https://github.com/stripe/stripe-python/pull/1155) Update generated code + * Add support for `payment_details`, `payments`, and `payouts` on `AccountSession.components` and `CreateParams.components` + * Add support for `features` on `AccountSession.components.account_onboarding` and `CreateParams.components.account_onboarding` + * Add support for new values `customer_tax_location_invalid` and `financial_connections_no_successful_transaction_refresh` on enums `Invoice.last_finalization_error.code`, `PaymentIntent.last_payment_error.code`, `SetupAttempt.setup_error.code`, `SetupIntent.last_setup_error.code`, and `StripeError.code` + * Add support for new values `payment_network_reserve_hold` and `payment_network_reserve_release` on enum `BalanceTransaction.type` + * Change `Climate.Product.metric_tons_available` to be required + * Remove support for value `various` from enum `Climate.Supplier.removal_pathway` + * Remove support for values `challenge_only` and `challenge` from enum `PaymentIntent.payment_method_options.card.request_three_d_secure` + * Add support for `inactive_message` and `restrictions` on `CreateParams`, `ModifyParams`, and `PaymentLink` + * Add support for `transfer_group` on `PaymentLink.payment_intent_data`, `CreateParams.payment_intent_data`, and `ModifyParams.payment_intent_data` + * Add support for `trial_settings` on `PaymentLink.subscription_data`, `CreateParams.subscription_data`, and `ModifyParams.subscription_data` +* [#1153](https://github.com/stripe/stripe-python/pull/1153) Move exports for more modules + - `stripe.app_info`, `stripe.http_client`, `stripe.oauth`, `stripe.util`, `stripe.version`, `stripe.webhook`, modules are deprecated. All types are available directly from `stripe` module now. + Before: + ```python + from stripe.util import convert_to_stripe_object + # or + stripe.util.convert_to_stripe_object + ```` + After: + ```python + from stripe import convert_to_stripe_object + # or + stripe.convert_to_stripe_object + ``` + - `stripe.api_version`, `stripe.multipart_data_generator`, `stripe.request_metrics` are deprecated and will be fully removed in the future. +* [#1142](https://github.com/stripe/stripe-python/pull/1142) Move resource type exports to stripe.___ + - `stripe.error`, `stripe.stripe_object`, `stripe.api_requestor`, `stripe.stripe_response`, `stripe.request_options`, `stripe.api_resources.*`, `stripe.api_resources.abstract.*` modules are deprecated. All types are available directly from `stripe` module now. + Before: + ```python + from stripe.error import APIError + # or + stripe.error.APIError + ```` + After: + ```python + from stripe import APIError + # or + stripe.APIError + ``` ## 7.8.0b1 - 2023-11-30 - -- [#1148](https://github.com/stripe/stripe-python/pull/1148) Update generated code for beta +* [#1148](https://github.com/stripe/stripe-python/pull/1148) Update generated code for beta ## 7.7.0 - 2023-11-30 - -- [#1147](https://github.com/stripe/stripe-python/pull/1147) Update generated code - - Add support for new resources `Climate.Order`, `Climate.Product`, and `Climate.Supplier` - - Add support for `cancel`, `create`, `list`, `modify`, and `retrieve` methods on resource `Order` - - Add support for `list` and `retrieve` methods on resources `Product` and `Supplier` - - Add support for new value `financial_connections_account_inactive` on enums `Invoice.LastFinalizationError.code`, `PaymentIntent.LastPaymentError.code`, `SetupAttempt.SetupError.code`, and `SetupIntent.LastSetupError.code` - - Add support for new values `climate_order_purchase` and `climate_order_refund` on enum `BalanceTransaction.type` - - Add support for `created` on `Checkout.Session.ListParams` - - Add support for `validate_location` on `Customer.CreateParamsTax` and `Customer.ModifyParamsTax` - - Add support for new values `climate.order.canceled`, `climate.order.created`, `climate.order.delayed`, `climate.order.delivered`, `climate.order.product_substituted`, `climate.product.created`, and `climate.product.pricing_updated` on enum `Event.type` - - Add support for new value `challenge` on enums `PaymentIntent. PaymentMethodOptions.Card.request_three_d_secure` and `SetupIntent. PaymentMethodOptions.Card.request_three_d_secure` - - Add support for new values `climate_order_purchase` and `climate_order_refund` on enum `Reporting.ReportRun. CreateParamsParameters.reporting_category` - - Add support for new values `climate.order.canceled`, `climate.order.created`, `climate.order.delayed`, `climate.order.delivered`, `climate.order.product_substituted`, `climate.product.created`, and `climate.product.pricing_updated` on enums `WebhookEndpoint.CreateParams.enabled_events[]` and `WebhookEndpoint.ModifyParams.enabled_events[]` -- [#1145](https://github.com/stripe/stripe-python/pull/1145) Refactor integration test +* [#1147](https://github.com/stripe/stripe-python/pull/1147) Update generated code + * Add support for new resources `Climate.Order`, `Climate.Product`, and `Climate.Supplier` + * Add support for `cancel`, `create`, `list`, `modify`, and `retrieve` methods on resource `Order` + * Add support for `list` and `retrieve` methods on resources `Product` and `Supplier` + * Add support for new value `financial_connections_account_inactive` on enums `Invoice.LastFinalizationError.code`, `PaymentIntent.LastPaymentError.code`, `SetupAttempt.SetupError.code`, and `SetupIntent.LastSetupError.code` + * Add support for new values `climate_order_purchase` and `climate_order_refund` on enum `BalanceTransaction.type` + * Add support for `created` on `Checkout.Session.ListParams` + * Add support for `validate_location` on `Customer.CreateParamsTax` and `Customer.ModifyParamsTax` + * Add support for new values `climate.order.canceled`, `climate.order.created`, `climate.order.delayed`, `climate.order.delivered`, `climate.order.product_substituted`, `climate.product.created`, and `climate.product.pricing_updated` on enum `Event.type` + * Add support for new value `challenge` on enums `PaymentIntent. PaymentMethodOptions.Card.request_three_d_secure` and `SetupIntent. PaymentMethodOptions.Card.request_three_d_secure` + * Add support for new values `climate_order_purchase` and `climate_order_refund` on enum `Reporting.ReportRun. CreateParamsParameters.reporting_category` + * Add support for new values `climate.order.canceled`, `climate.order.created`, `climate.order.delayed`, `climate.order.delivered`, `climate.order.product_substituted`, `climate.product.created`, and `climate.product.pricing_updated` on enums `WebhookEndpoint.CreateParams.enabled_events[]` and `WebhookEndpoint.ModifyParams.enabled_events[]` +* [#1145](https://github.com/stripe/stripe-python/pull/1145) Refactor integration test ## 7.7.0b1 - 2023-11-21 - -- [#1141](https://github.com/stripe/stripe-python/pull/1141) Update generated code for beta -- Rename `receipient` to `recipient` beneath `PaymentDetails` on `Charge` and `PaymentIntent` APIs.\* Add support for `electronic_commerce_indicator` on resource classes `Charge.PaymentMethodDetails.Card.ThreeDSecure` and `SetupAttempt.PaymentMethodDetails.Card.ThreeDSecure` -- Add support for `components` on parameter class `CustomerSession.CreateParams` and resource `CustomerSession` +* [#1141](https://github.com/stripe/stripe-python/pull/1141) Update generated code for beta +* Rename `receipient` to `recipient` beneath `PaymentDetails` on `Charge` and `PaymentIntent` APIs.* Add support for `electronic_commerce_indicator` on resource classes `Charge.PaymentMethodDetails.Card.ThreeDSecure` and `SetupAttempt.PaymentMethodDetails.Card.ThreeDSecure` +* Add support for `components` on parameter class `CustomerSession.CreateParams` and resource `CustomerSession` ## 7.6.0 - 2023-11-21 - -- [#1138](https://github.com/stripe/stripe-python/pull/1138) Update generated code - - Add support for `electronic_commerce_indicator` on resource classes `Charge.PaymentMethodDetails.Card.ThreeDSecure` and `SetupAttempt.PaymentMethodDetails.Card.ThreeDSecure` - - Add support for `exemption_indicator` on resource class `Charge.PaymentMethodDetails.Card.ThreeDSecure` - - Add support for `transaction_id` on resource classes `Charge.PaymentMethodDetails.Card.ThreeDSecure`, `SetupAttempt.PaymentMethodDetails.Card.ThreeDSecure`, `issuing.Authorization.NetworkData`, and `issuing.Transaction.NetworkData` - - Add support for `offline` on resource class `Charge.PaymentMethodDetails.CardPresent` - - Add support for `transferred_to_balance` on resource `CustomerCashBalanceTransaction` - - Add support for `three_d_secure` on parameter classes `PaymentIntent.ConfirmParamsPaymentMethodOptionsCard`, `PaymentIntent.CreateParamsPaymentMethodOptionsCard`, `PaymentIntent.ModifyParamsPaymentMethodOptionsCard`, `SetupIntent.ConfirmParamsPaymentMethodOptionsCard`, `SetupIntent.CreateParamsPaymentMethodOptionsCard`, and `SetupIntent.ModifyParamsPaymentMethodOptionsCard` - - Add support for `system_trace_audit_number` on resource class `issuing.Authorization.NetworkData` - - Add support for `network_risk_score` on resource classes `issuing.Authorization.PendingRequest` and `issuing.Authorization.RequestHistory` - - Add support for `requested_at` on resource class `issuing.Authorization.RequestHistory` - - Add support for `authorization_code` on resource class `issuing.Transaction.NetworkData` +* [#1138](https://github.com/stripe/stripe-python/pull/1138) Update generated code + * Add support for `electronic_commerce_indicator` on resource classes `Charge.PaymentMethodDetails.Card.ThreeDSecure` and `SetupAttempt.PaymentMethodDetails.Card.ThreeDSecure` + * Add support for `exemption_indicator` on resource class `Charge.PaymentMethodDetails.Card.ThreeDSecure` + * Add support for `transaction_id` on resource classes `Charge.PaymentMethodDetails.Card.ThreeDSecure`, `SetupAttempt.PaymentMethodDetails.Card.ThreeDSecure`, `issuing.Authorization.NetworkData`, and `issuing.Transaction.NetworkData` + * Add support for `offline` on resource class `Charge.PaymentMethodDetails.CardPresent` + * Add support for `transferred_to_balance` on resource `CustomerCashBalanceTransaction` + * Add support for `three_d_secure` on parameter classes `PaymentIntent.ConfirmParamsPaymentMethodOptionsCard`, `PaymentIntent.CreateParamsPaymentMethodOptionsCard`, `PaymentIntent.ModifyParamsPaymentMethodOptionsCard`, `SetupIntent.ConfirmParamsPaymentMethodOptionsCard`, `SetupIntent.CreateParamsPaymentMethodOptionsCard`, and `SetupIntent.ModifyParamsPaymentMethodOptionsCard` + * Add support for `system_trace_audit_number` on resource class `issuing.Authorization.NetworkData` + * Add support for `network_risk_score` on resource classes `issuing.Authorization.PendingRequest` and `issuing.Authorization.RequestHistory` + * Add support for `requested_at` on resource class `issuing.Authorization.RequestHistory` + * Add support for `authorization_code` on resource class `issuing.Transaction.NetworkData` ## 7.6.0b1 - 2023-11-16 - -- [#1128](https://github.com/stripe/stripe-python/pull/1128) Update generated code for beta - - Add support for `issuing_card` and `issuing_cards_list` on `AccountSession.CreateParamsComponents` - - Add support for `event_details` and `subscription` on `payment_details` types - - Add support for `affiliate` and `delivery` on `payment_details.flight`, `payment_details.lodging`, and `payment_details.car_rental` types - - Add support for `drivers` on `payment_details.car_rental` types - - Add support for `passengers` on `payment_details.flight` and `payment_details.lodging` types - - Add support for `created` on `CustomerSession` +* [#1128](https://github.com/stripe/stripe-python/pull/1128) Update generated code for beta + * Add support for `issuing_card` and `issuing_cards_list` on `AccountSession.CreateParamsComponents` + * Add support for `event_details` and `subscription` on `payment_details` types + * Add support for `affiliate` and `delivery` on `payment_details.flight`, `payment_details.lodging`, and `payment_details.car_rental` types + * Add support for `drivers` on `payment_details.car_rental` types + * Add support for `passengers` on `payment_details.flight` and `payment_details.lodging` types + * Add support for `created` on `CustomerSession` ## 7.5.0 - 2023-11-16 - -- [#1127](https://github.com/stripe/stripe-python/pull/1127) Update generated code - - Add support for `bacs_debit_payments` on `Account.CreateParamsSettings` - - Add support for `service_user_number` on `Account.Settings.BacsDebitPayments` - - Add support for `capture_before` on `Charge.PaymentMethodDetails.Card.capture_before` - - Add support for `Paypal` on `Checkout.Session.PaymentMethodOptions` - - Add support for `tax_amounts` on `CreditNote.CreateParamsLine`, `CreditNote.PreviewParamsLine`, and `CreditNote.PreviewLinesParamsLine` - - Add support for `network_data` on `Issuing.Transaction` - - Add support for `status` on `Checkout.Session.ListParams` -- [#1135](https://github.com/stripe/stripe-python/pull/1135) Add initial tests for exports and run them in mypy and pyright -- [#1130](https://github.com/stripe/stripe-python/pull/1130) Mention types in README.md -- [#1134](https://github.com/stripe/stripe-python/pull/1134) Run pyright via tox -- [#1131](https://github.com/stripe/stripe-python/pull/1131) Upgrade black dependency -- [#1132](https://github.com/stripe/stripe-python/pull/1132) Fix unnecessary casts from pyright 1.1.336 -- [#1126](https://github.com/stripe/stripe-python/pull/1126) Suppress type errors from latest pyright -- [#1125](https://github.com/stripe/stripe-python/pull/1125) Add support for Python 3.11/3.12 -- [#1123](https://github.com/stripe/stripe-python/pull/1123) Move to python3 venv and update vscode settings +* [#1127](https://github.com/stripe/stripe-python/pull/1127) Update generated code + * Add support for `bacs_debit_payments` on `Account.CreateParamsSettings` + * Add support for `service_user_number` on `Account.Settings.BacsDebitPayments` + * Add support for `capture_before` on `Charge.PaymentMethodDetails.Card.capture_before` + * Add support for `Paypal` on `Checkout.Session.PaymentMethodOptions` + * Add support for `tax_amounts` on `CreditNote.CreateParamsLine`, `CreditNote.PreviewParamsLine`, and `CreditNote.PreviewLinesParamsLine` + * Add support for `network_data` on `Issuing.Transaction` + * Add support for `status` on `Checkout.Session.ListParams` +* [#1135](https://github.com/stripe/stripe-python/pull/1135) Add initial tests for exports and run them in mypy and pyright +* [#1130](https://github.com/stripe/stripe-python/pull/1130) Mention types in README.md +* [#1134](https://github.com/stripe/stripe-python/pull/1134) Run pyright via tox +* [#1131](https://github.com/stripe/stripe-python/pull/1131) Upgrade black dependency +* [#1132](https://github.com/stripe/stripe-python/pull/1132) Fix unnecessary casts from pyright 1.1.336 +* [#1126](https://github.com/stripe/stripe-python/pull/1126) Suppress type errors from latest pyright +* [#1125](https://github.com/stripe/stripe-python/pull/1125) Add support for Python 3.11/3.12 +* [#1123](https://github.com/stripe/stripe-python/pull/1123) Move to python3 venv and update vscode settings ## 7.5.0b1 - 2023-11-10 - -- [#1120](https://github.com/stripe/stripe-python/pull/1120) Update generated code for beta +* [#1120](https://github.com/stripe/stripe-python/pull/1120) Update generated code for beta ## 7.4.0 - 2023-11-09 - -- [#1119](https://github.com/stripe/stripe-python/pull/1119) Update generated code - - Add support for new value `terminal_reader_hardware_fault` on enums `Invoice.last_finalization_error.code`, `PaymentIntent.last_payment_error.code`, `SetupAttempt.setup_error.code`, `SetupIntent.last_setup_error.code`, and `StripeError.code` - - Add support for `metadata` on `Quote.subscription_data`, `QuoteCreateParams.subscription_data`, and `QuoteUpdateParams.subscription_data` -- [#1121](https://github.com/stripe/stripe-python/pull/1121) [types] Remove `None` from optional param types +* [#1119](https://github.com/stripe/stripe-python/pull/1119) Update generated code + * Add support for new value `terminal_reader_hardware_fault` on enums `Invoice.last_finalization_error.code`, `PaymentIntent.last_payment_error.code`, `SetupAttempt.setup_error.code`, `SetupIntent.last_setup_error.code`, and `StripeError.code` + * Add support for `metadata` on `Quote.subscription_data`, `QuoteCreateParams.subscription_data`, and `QuoteUpdateParams.subscription_data` +* [#1121](https://github.com/stripe/stripe-python/pull/1121) [types] Remove `None` from optional param types ## 7.4.0b1 - 2023-11-02 - -- [#1110](https://github.com/stripe/stripe-python/pull/1110) Update generated code for beta - - Add support for `attach_payment_intent` method on resource `Invoice` +* [#1110](https://github.com/stripe/stripe-python/pull/1110) Update generated code for beta + * Add support for `attach_payment_intent` method on resource `Invoice` ## 7.3.0 - 2023-11-02 - -- [#1112](https://github.com/stripe/stripe-python/pull/1112) Update generated code - - Add support for new resource `Tax.Registration` - - Add support for `create`, `list`, and `modify` methods on resource `Registration` +* [#1112](https://github.com/stripe/stripe-python/pull/1112) Update generated code + * Add support for new resource `Tax.Registration` + * Add support for `create`, `list`, and `modify` methods on resource `Registration` ## 7.2.0 - 2023-10-31 - -- [#1115](https://github.com/stripe/stripe-python/pull/1115) Types: Add types for `ErrorObject`. -- [#1116](https://github.com/stripe/stripe-python/pull/1116) Types: Use @staticmethod overloads instead of @classmethod to fix MyPy compatibility. +* [#1115](https://github.com/stripe/stripe-python/pull/1115) Types: Add types for `ErrorObject`. +* [#1116](https://github.com/stripe/stripe-python/pull/1116) Types: Use @staticmethod overloads instead of @classmethod to fix MyPy compatibility. ## 7.1.0 - 2023-10-26 +* [#1104](https://github.com/stripe/stripe-python/pull/1104) Include `py.typed` and enable type annotations for the package + * This PR includes `py.typed` and enables inline type annotations for stripe-python package. Inline type annotations will now take precedence over Typeshed for users who use a type checker or IDE. + * See a detailed guide on the [Github Wiki](https://github.com/stripe/stripe-python/wiki/Inline-type-annotations). +* [#1103](https://github.com/stripe/stripe-python/pull/1103) Inner resource classes + * Behavior change: nested json objects will now deserialize into instances of specific classes that subclass `StripeObject`, instead of into generic `StripeObject` instances. + * ⚠️ Behavior change: `PromotionCode.restrictions.currency_options` will now deserialize into `dict` and not `StripeObject`. +* [#1090](https://github.com/stripe/stripe-python/pull/1090) Update generated code + * Add support for new value `balance_invalid_parameter` on enums `Invoice.LastFinalizationError`, `PaymentIntent.LastPaymentError`, `SetupAttempt.SetupError`, and `SetupIntent.LastSetupError` +* [#1096](https://github.com/stripe/stripe-python/pull/1096) Add @util.deprecated decorator and deprecate `save`. +* [#1091](https://github.com/stripe/stripe-python/pull/1091) APIRequestor: don't mutate incoming multipart headers -- [#1104](https://github.com/stripe/stripe-python/pull/1104) Include `py.typed` and enable type annotations for the package - - This PR includes `py.typed` and enables inline type annotations for stripe-python package. Inline type annotations will now take precedence over Typeshed for users who use a type checker or IDE. - - See a detailed guide on the [Github Wiki](https://github.com/stripe/stripe-python/wiki/Inline-type-annotations). -- [#1103](https://github.com/stripe/stripe-python/pull/1103) Inner resource classes - - Behavior change: nested json objects will now deserialize into instances of specific classes that subclass `StripeObject`, instead of into generic `StripeObject` instances. - - ⚠️ Behavior change: `PromotionCode.restrictions.currency_options` will now deserialize into `dict` and not `StripeObject`. -- [#1090](https://github.com/stripe/stripe-python/pull/1090) Update generated code - - Add support for new value `balance_invalid_parameter` on enums `Invoice.LastFinalizationError`, `PaymentIntent.LastPaymentError`, `SetupAttempt.SetupError`, and `SetupIntent.LastSetupError` -- [#1096](https://github.com/stripe/stripe-python/pull/1096) Add @util.deprecated decorator and deprecate `save`. -- [#1091](https://github.com/stripe/stripe-python/pull/1091) APIRequestor: don't mutate incoming multipart headers # Changelog ## 7.2.0b1 - 2023-10-26 - -- [#1107](https://github.com/stripe/stripe-python/pull/1107) Update generated code for beta - - Add support for new resource `Margin` - - Add support for `create`, `list`, `modify`, and `retrieve` methods on resource `Margin` +* [#1107](https://github.com/stripe/stripe-python/pull/1107) Update generated code for beta + * Add support for new resource `Margin` + * Add support for `create`, `list`, `modify`, and `retrieve` methods on resource `Margin` ## 7.1.0b1 - 2023-10-17 - -- [#1084](https://github.com/stripe/stripe-python/pull/1084) Update generated code for beta - - Update pinned API version to `2023-10-16` -- [#1083](https://github.com/stripe/stripe-python/pull/1083) Update generated code for beta +* [#1084](https://github.com/stripe/stripe-python/pull/1084) Update generated code for beta + - Update pinned API version to `2023-10-16` +* [#1083](https://github.com/stripe/stripe-python/pull/1083) Update generated code for beta ## 7.0.0 - 2023-10-16 - -- This release changes the pinned API version to `2023-10-16`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2023-10-16) and carefully review the API changes before upgrading `stripe-python`. -- [#1085](https://github.com/stripe/stripe-python/pull/1085) Update generated code - - Updated pinned API version +* This release changes the pinned API version to `2023-10-16`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2023-10-16) and carefully review the API changes before upgrading `stripe-python`. +* [#1085](https://github.com/stripe/stripe-python/pull/1085) Update generated code + - Updated pinned API version ## 6.8.0b3 - 2023-10-13 -## 6.8.0b2 - 2023-10-11 -- [#1073](https://github.com/stripe/stripe-python/pull/1073) Update generated code for beta - Release specs are identical. -- [#1061](https://github.com/stripe/stripe-python/pull/1061) Types: inner resource classes +## 6.8.0b2 - 2023-10-11 +* [#1073](https://github.com/stripe/stripe-python/pull/1073) Update generated code for beta + Release specs are identical. +* [#1061](https://github.com/stripe/stripe-python/pull/1061) Types: inner resource classes ## 6.8.0b1 - 2023-10-05 - -- [#1066](https://github.com/stripe/stripe-python/pull/1066) Update generated code for beta - - Add support for `mark_draft` and `mark_stale` methods on resource `Quote` - - Remove support for `draft_quote` and `mark_stale_quote` methods on resource `Quote` - - Rename `preview_invoice_lines` to `list_preview_invoice_lines` on resource `Quote` -- [#1059](https://github.com/stripe/stripe-python/pull/1059) Update generated code for beta - - Rename resources `Issuing.CardDesign` and `Issuing.CardBundle` to `Issuing.PersonalizationDesign` and `Issuing.PhysicalBundle` +* [#1066](https://github.com/stripe/stripe-python/pull/1066) Update generated code for beta + * Add support for `mark_draft` and `mark_stale` methods on resource `Quote` + * Remove support for `draft_quote` and `mark_stale_quote` methods on resource `Quote` + * Rename `preview_invoice_lines` to `list_preview_invoice_lines` on resource `Quote` +* [#1059](https://github.com/stripe/stripe-python/pull/1059) Update generated code for beta + * Rename resources `Issuing.CardDesign` and `Issuing.CardBundle` to `Issuing.PersonalizationDesign` and `Issuing.PhysicalBundle` ## 6.7.0 - 2023-10-05 - -- [#1065](https://github.com/stripe/stripe-python/pull/1065) Update generated code - - Add support for new resource `Issuing.Token` - - Add support for `list`, `modify`, and `retrieve` methods on resource `Token` +* [#1065](https://github.com/stripe/stripe-python/pull/1065) Update generated code + * Add support for new resource `Issuing.Token` + * Add support for `list`, `modify`, and `retrieve` methods on resource `Token` ## 6.7.0b2 - 2023-09-28 - -- [#1059](https://github.com/stripe/stripe-python/pull/1059) Update generated code for beta - - Rename resources `Issuing.CardDesign` and `Issuing.CardBundle` to `Issuing.PersonalizationDesign` and `Issuing.PhysicalBundle` -- [#997](https://github.com/stripe/stripe-python/pull/997) Remove developer_message support +* [#1059](https://github.com/stripe/stripe-python/pull/1059) Update generated code for beta + * Rename resources `Issuing.CardDesign` and `Issuing.CardBundle` to `Issuing.PersonalizationDesign` and `Issuing.PhysicalBundle` +* [#997](https://github.com/stripe/stripe-python/pull/997) Remove developer_message support ## 6.7.0b1 - 2023-09-21 - -- [#1053](https://github.com/stripe/stripe-python/pull/1053) Update generated code for beta +* [#1053](https://github.com/stripe/stripe-python/pull/1053) Update generated code for beta ## 6.6.0 - 2023-09-21 +* [#1056](https://github.com/stripe/stripe-python/pull/1056) Update generated code -- [#1056](https://github.com/stripe/stripe-python/pull/1056) Update generated code - -- [#1055](https://github.com/stripe/stripe-python/pull/1055) Partially type resource methods (no \*\*params) -- [#1057](https://github.com/stripe/stripe-python/pull/1057) Add optional types to non-required fields -- [#1054](https://github.com/stripe/stripe-python/pull/1054) Types: add deleted field +* [#1055](https://github.com/stripe/stripe-python/pull/1055) Partially type resource methods (no **params) +* [#1057](https://github.com/stripe/stripe-python/pull/1057) Add optional types to non-required fields +* [#1054](https://github.com/stripe/stripe-python/pull/1054) Types: add deleted field ## 6.6.0b1 - 2023-09-14 - -- [#1048](https://github.com/stripe/stripe-python/pull/1048) Update generated code for beta - - Add support for new resource `ConfirmationToken` - - Add support for `retrieve` method on resource `ConfirmationToken` - - Add support for `create` method on resource `Issuing.CardDesign` - - Add support for `reject_testmode` test helper method on resource `Issuing.CardDesign` +* [#1048](https://github.com/stripe/stripe-python/pull/1048) Update generated code for beta + * Add support for new resource `ConfirmationToken` + * Add support for `retrieve` method on resource `ConfirmationToken` + * Add support for `create` method on resource `Issuing.CardDesign` + * Add support for `reject_testmode` test helper method on resource `Issuing.CardDesign` ## 6.5.0 - 2023-09-14 - -- [#1052](https://github.com/stripe/stripe-python/pull/1052) Update generated code - - Add support for new resource `PaymentMethodConfiguration` - - Add support for `create`, `list`, `modify`, and `retrieve` methods on resource `PaymentMethodConfiguration` -- [#1047](https://github.com/stripe/stripe-python/pull/1047) Update generated code - - Add support for `capture`, `create`, `expire`, `increment`, and `reverse` test helper methods on resource `Issuing.Authorization` - - Add support for `create_force_capture`, `create_unlinked_refund`, and `refund` test helper methods on resource `Issuing.Transaction` -- [#1049](https://github.com/stripe/stripe-python/pull/1049) Types: datetimes to ints, add enum support -- [#1030](https://github.com/stripe/stripe-python/pull/1030) Explicitly define CRUDL methods in each resource -- [#1050](https://github.com/stripe/stripe-python/pull/1050) Generate explicit nested resource class methods +* [#1052](https://github.com/stripe/stripe-python/pull/1052) Update generated code + * Add support for new resource `PaymentMethodConfiguration` + * Add support for `create`, `list`, `modify`, and `retrieve` methods on resource `PaymentMethodConfiguration` +* [#1047](https://github.com/stripe/stripe-python/pull/1047) Update generated code + * Add support for `capture`, `create`, `expire`, `increment`, and `reverse` test helper methods on resource `Issuing.Authorization` + * Add support for `create_force_capture`, `create_unlinked_refund`, and `refund` test helper methods on resource `Issuing.Transaction` +* [#1049](https://github.com/stripe/stripe-python/pull/1049) Types: datetimes to ints, add enum support +* [#1030](https://github.com/stripe/stripe-python/pull/1030) Explicitly define CRUDL methods in each resource +* [#1050](https://github.com/stripe/stripe-python/pull/1050) Generate explicit nested resource class methods ## 6.5.0b1 - 2023-09-07 - -- [#1045](https://github.com/stripe/stripe-python/pull/1045) Update generated code for beta - - Release specs are identical. -- [#1034](https://github.com/stripe/stripe-python/pull/1034) Update generated code for beta - - Remove support for `submit_card` test helper method on resource `Issuing.Card` +* [#1045](https://github.com/stripe/stripe-python/pull/1045) Update generated code for beta + * Release specs are identical. +* [#1034](https://github.com/stripe/stripe-python/pull/1034) Update generated code for beta + * Remove support for `submit_card` test helper method on resource `Issuing.Card` ## 6.4.0 - 2023-09-07 - -- [#1033](https://github.com/stripe/stripe-python/pull/1033) Update generated code - - Add support for new resource `PaymentMethodDomain` - - Add support for `create`, `list`, `modify`, `retrieve`, and `validate` methods on resource `PaymentMethodDomain` -- [#1044](https://github.com/stripe/stripe-python/pull/1044) Types: ExpandableField -- [#1043](https://github.com/stripe/stripe-python/pull/1043) Types: ListObject +* [#1033](https://github.com/stripe/stripe-python/pull/1033) Update generated code + * Add support for new resource `PaymentMethodDomain` + * Add support for `create`, `list`, `modify`, `retrieve`, and `validate` methods on resource `PaymentMethodDomain` +* [#1044](https://github.com/stripe/stripe-python/pull/1044) Types: ExpandableField +* [#1043](https://github.com/stripe/stripe-python/pull/1043) Types: ListObject ## 6.3.0 - 2023-09-05 - -- [#1042](https://github.com/stripe/stripe-python/pull/1042) Require typing_extensions >= 4.0.0 -- [#1026](https://github.com/stripe/stripe-python/pull/1026) Types: annotate resource properties +* [#1042](https://github.com/stripe/stripe-python/pull/1042) Require typing_extensions >= 4.0.0 +* [#1026](https://github.com/stripe/stripe-python/pull/1026) Types: annotate resource properties ## 6.3.0b1 - 2023-08-31 - -- [#1029](https://github.com/stripe/stripe-python/pull/1029) Update generated code for beta - - Rename `Quote.preview_invoices` and `Quote.preview_subscription_schedules` to `Quote.list_preview_invoices` and `Quote.list_preview_schedules`. +* [#1029](https://github.com/stripe/stripe-python/pull/1029) Update generated code for beta + * Rename `Quote.preview_invoices` and `Quote.preview_subscription_schedules` to `Quote.list_preview_invoices` and `Quote.list_preview_schedules`. ## 6.2.0 - 2023-08-31 - -- [#1024](https://github.com/stripe/stripe-python/pull/1024) Update generated code - - Add support for new resource `AccountSession` - - Add support for `create` method on resource `AccountSession` -- [#1032](https://github.com/stripe/stripe-python/pull/1032) Types for CRUDL methods on parents +* [#1024](https://github.com/stripe/stripe-python/pull/1024) Update generated code + * Add support for new resource `AccountSession` + * Add support for `create` method on resource `AccountSession` +* [#1032](https://github.com/stripe/stripe-python/pull/1032) Types for CRUDL methods on parents ## 6.1.0 - 2023-08-24 - -- [#1016](https://github.com/stripe/stripe-python/pull/1016) Update generated code -- [#1020](https://github.com/stripe/stripe-python/pull/1020) Adds type annotations, and dependency on `typing_extensions`. +* [#1016](https://github.com/stripe/stripe-python/pull/1016) Update generated code +* [#1020](https://github.com/stripe/stripe-python/pull/1020) Adds type annotations, and dependency on `typing_extensions`. ## 6.1.0b2 - 2023-08-23 - -- [#1006](https://github.com/stripe/stripe-python/pull/1006) [#1017](https://github.com/stripe/stripe-python/pull/1017) Update generated code for beta -- [#1020](https://github.com/stripe/stripe-python/pull/1020) Adds type_annotations, and dependency on `typing_extensions`. +* [#1006](https://github.com/stripe/stripe-python/pull/1006) [#1017](https://github.com/stripe/stripe-python/pull/1017) Update generated code for beta +* [#1020](https://github.com/stripe/stripe-python/pull/1020) Adds type_annotations, and dependency on `typing_extensions`. ## 6.1.0b1 - 2023-08-23 - -- Updated stable APIs to the latest version + * Updated stable APIs to the latest version ## 6.0.0 - 2023-08-16 - **⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️** +* [#1001](https://github.com/stripe/stripe-python/pull/1001) [#1008](https://github.com/stripe/stripe-python/pull/1008) Remove support for Python 2. + * The last version of stripe-python that supports Python 2 is 5.5.0. [The Python Software Foundation (PSF)](https://www.python.org/psf-landing/) community [announced the end of support of Python 2](https://www.python.org/doc/sunset-python-2/) on 01 January 2020. To continue to get new features and security updates, please make sure to update your Python runtime to Python 3.6+. +* [#987](https://github.com/stripe/stripe-python/pull/987) ⚠️⚠️Pin to the latest API version⚠️⚠️ -- [#1001](https://github.com/stripe/stripe-python/pull/1001) [#1008](https://github.com/stripe/stripe-python/pull/1008) Remove support for Python 2. - - The last version of stripe-python that supports Python 2 is 5.5.0. [The Python Software Foundation (PSF)](https://www.python.org/psf-landing/) community [announced the end of support of Python 2](https://www.python.org/doc/sunset-python-2/) on 01 January 2020. To continue to get new features and security updates, please make sure to update your Python runtime to Python 3.6+. -- [#987](https://github.com/stripe/stripe-python/pull/987) ⚠️⚠️Pin to the latest API version⚠️⚠️ - - In this release, Stripe API Version `2023-08-16` (the latest at time of release) will be sent by default on all requests. - The previous default was to use your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). + In this release, Stripe API Version `2023-08-16` (the latest at time of release) will be sent by default on all requests. + The previous default was to use your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). - To successfully upgrade to stripe-python v6, you must either + To successfully upgrade to stripe-python v6, you must either - 1. **(Recommended) Upgrade your integration to be compatible with API Version `2023-08-16`.** + 1. **(Recommended) Upgrade your integration to be compatible with API Version `2023-08-16`.** - Please read the API Changelog carefully for each API Version from `2023-08-16` back to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). Determine if you are using any of the APIs that have changed in a breaking way, and adjust your integration accordingly. Carefully test your changes with Stripe [Test Mode](https://stripe.com/docs/keys#test-live-modes) before deploying them to production. + Please read the API Changelog carefully for each API Version from `2023-08-16` back to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). Determine if you are using any of the APIs that have changed in a breaking way, and adjust your integration accordingly. Carefully test your changes with Stripe [Test Mode](https://stripe.com/docs/keys#test-live-modes) before deploying them to production. - You can read the [v6 migration guide](https://github.com/stripe/stripe-python/wiki/Migration-guide-for-v6) for more detailed instructions. + You can read the [v6 migration guide](https://github.com/stripe/stripe-python/wiki/Migration-guide-for-v6) for more detailed instructions. - 2. **(Alternative option) Specify a version other than `2023-08-16` when initializing `stripe-python`.** + 2. **(Alternative option) Specify a version other than `2023-08-16` when initializing `stripe-python`.** - If you were previously initializing stripe-python without an explicit API Version, you can postpone modifying your integration by specifying a version equal to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). For example: + If you were previously initializing stripe-python without an explicit API Version, you can postpone modifying your integration by specifying a version equal to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). For example: - ```diff - import stripe - stripe.api_key = "sk_test_..." - + stripe.api_version = '2020-08-27' - ``` + ```diff + import stripe + stripe.api_key = "sk_test_..." + + stripe.api_version = '2020-08-27' + ``` - If you were already initializing stripe-python with an explicit API Version, upgrading to v6 will not affect your integration. + If you were already initializing stripe-python with an explicit API Version, upgrading to v6 will not affect your integration. - Read the [v6 migration guide](https://github.com/stripe/stripe-python/wiki/Migration-guide-for-v6) for more details. + Read the [v6 migration guide](https://github.com/stripe/stripe-python/wiki/Migration-guide-for-v6) for more details. - Going forward, each major release of this library will be _pinned_ by default to the latest Stripe API Version at the time of release. + Going forward, each major release of this library will be *pinned* by default to the latest Stripe API Version at the time of release. - That is, instead of upgrading stripe-python and separately upgrading your Stripe API Version through the Stripe Dashboard, whenever you upgrade major versions of stripe-python, you should also upgrade your integration to be compatible with the latest Stripe API version. + That is, instead of upgrading stripe-python and separately upgrading your Stripe API Version through the Stripe Dashboard, whenever you upgrade major versions of stripe-python, you should also upgrade your integration to be compatible with the latest Stripe API version. -- [#1013](https://github.com/stripe/stripe-python/pull/1013) ⚠️Removed @test_helper decorator - - This is technically breaking but unlikely to affect most users. -- [#1015](https://github.com/stripe/stripe-python/pull/1015) ⚠️Assert types of pagination responses - - Pagination will raise an exception if the API response is not of the correct type. This should never happen in production use but may break tests that use mock data. +* [#1013](https://github.com/stripe/stripe-python/pull/1013) ⚠️Removed @test_helper decorator + * This is technically breaking but unlikely to affect most users. +* [#1015](https://github.com/stripe/stripe-python/pull/1015) ⚠️Assert types of pagination responses + * Pagination will raise an exception if the API response is not of the correct type. This should never happen in production use but may break tests that use mock data. ## 5.6.0b3 - 2023-08-03 +* [#1004](https://github.com/stripe/stripe-python/pull/1004) Update generated code for beta + * Add support for `submit_card` test helper method on resource `Issuing.Card` +* [#999](https://github.com/stripe/stripe-python/pull/999) Update generated code for beta -- [#1004](https://github.com/stripe/stripe-python/pull/1004) Update generated code for beta - - Add support for `submit_card` test helper method on resource `Issuing.Card` -- [#999](https://github.com/stripe/stripe-python/pull/999) Update generated code for beta - -- [#997](https://github.com/stripe/stripe-python/pull/997) Remove developer_message support +* [#997](https://github.com/stripe/stripe-python/pull/997) Remove developer_message support ## 5.6.0b2 - 2023-07-28 - -- [#995](https://github.com/stripe/stripe-python/pull/995) Update generated code for beta - - Add support for new resource `Tax.Form` - - Add support for `list`, `pdf`, and `retrieve` methods on resource `Form` -- [#992](https://github.com/stripe/stripe-python/pull/992) Update generated code for beta +* [#995](https://github.com/stripe/stripe-python/pull/995) Update generated code for beta + * Add support for new resource `Tax.Form` + * Add support for `list`, `pdf`, and `retrieve` methods on resource `Form` +* [#992](https://github.com/stripe/stripe-python/pull/992) Update generated code for beta ## 5.6.0b1 - 2023-07-13 +* [#991](https://github.com/stripe/stripe-python/pull/991) Update generated code for beta + Release specs are identical. +* [#989](https://github.com/stripe/stripe-python/pull/989) Update generated code for beta + * Add support for new resource `PaymentMethodConfiguration` + * Add support for `create`, `list`, `modify`, and `retrieve` methods on resource `PaymentMethodConfiguration` +* [#985](https://github.com/stripe/stripe-python/pull/985) Update generated code for beta -- [#991](https://github.com/stripe/stripe-python/pull/991) Update generated code for beta - Release specs are identical. -- [#989](https://github.com/stripe/stripe-python/pull/989) Update generated code for beta - - Add support for new resource `PaymentMethodConfiguration` - - Add support for `create`, `list`, `modify`, and `retrieve` methods on resource `PaymentMethodConfiguration` -- [#985](https://github.com/stripe/stripe-python/pull/985) Update generated code for beta - -- [#986](https://github.com/stripe/stripe-python/pull/986) Consolidate beta SDKs section +* [#986](https://github.com/stripe/stripe-python/pull/986) Consolidate beta SDKs section ## 5.5.0 - 2023-07-13 - -- [#990](https://github.com/stripe/stripe-python/pull/990) Update generated code - - Add support for new resource `Tax.Settings` - - Add support for `modify` and `retrieve` methods on resource `Settings` +* [#990](https://github.com/stripe/stripe-python/pull/990) Update generated code + * Add support for new resource `Tax.Settings` + * Add support for `modify` and `retrieve` methods on resource `Settings` ## 5.5.0b5 - 2023-06-22 - -- [#982](https://github.com/stripe/stripe-python/pull/982) Update generated code for beta - - Add support for new resource `CustomerSession` - - Add support for `create` method on resource `CustomerSession` -- [#979](https://github.com/stripe/stripe-python/pull/979) Update generated code for beta -- [#976](https://github.com/stripe/stripe-python/pull/976) Update generated code for beta +* [#982](https://github.com/stripe/stripe-python/pull/982) Update generated code for beta + * Add support for new resource `CustomerSession` + * Add support for `create` method on resource `CustomerSession` +* [#979](https://github.com/stripe/stripe-python/pull/979) Update generated code for beta +* [#976](https://github.com/stripe/stripe-python/pull/976) Update generated code for beta ## 5.5.0b4 - 2023-06-02 - -- [#973](https://github.com/stripe/stripe-python/pull/973) Update generated code for beta -- [#969](https://github.com/stripe/stripe-python/pull/969) Update generated code for beta -- [#971](https://github.com/stripe/stripe-python/pull/971) Handle developer message in preview error responses +* [#973](https://github.com/stripe/stripe-python/pull/973) Update generated code for beta +* [#969](https://github.com/stripe/stripe-python/pull/969) Update generated code for beta +* [#971](https://github.com/stripe/stripe-python/pull/971) Handle developer message in preview error responses ## 5.5.0b3 - 2023-05-19 - -- [#966](https://github.com/stripe/stripe-python/pull/966) Update generated code for beta - - Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account` -- [#965](https://github.com/stripe/stripe-python/pull/965) Add raw_request -- [#964](https://github.com/stripe/stripe-python/pull/964) Update generated code for beta -- [#961](https://github.com/stripe/stripe-python/pull/961) Update generated code for beta +* [#966](https://github.com/stripe/stripe-python/pull/966) Update generated code for beta + * Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account` +* [#965](https://github.com/stripe/stripe-python/pull/965) Add raw_request +* [#964](https://github.com/stripe/stripe-python/pull/964) Update generated code for beta +* [#961](https://github.com/stripe/stripe-python/pull/961) Update generated code for beta ## 5.5.0b2 - 2023-04-13 - -- [#954](https://github.com/stripe/stripe-python/pull/954) Update generated code for beta - - Add support for `collect_payment_method` and `confirm_payment_intent` methods on resource `Terminal.Reader` -- [#953](https://github.com/stripe/stripe-python/pull/953) Update generated code for beta +* [#954](https://github.com/stripe/stripe-python/pull/954) Update generated code for beta + * Add support for `collect_payment_method` and `confirm_payment_intent` methods on resource `Terminal.Reader` +* [#953](https://github.com/stripe/stripe-python/pull/953) Update generated code for beta ## 5.5.0b1 - 2023-03-30 - -- [#950](https://github.com/stripe/stripe-python/pull/950) Update generated code for beta +* [#950](https://github.com/stripe/stripe-python/pull/950) Update generated code for beta ## 5.4.0 - 2023-03-30 - -- [#951](https://github.com/stripe/stripe-python/pull/951) Update generated code - - Remove support for `create` method on resource `Tax.Transaction` - - This is not a breaking change, as this method was deprecated before the Tax Transactions API was released in favor of the `create_from_calculation` method. +* [#951](https://github.com/stripe/stripe-python/pull/951) Update generated code + * Remove support for `create` method on resource `Tax.Transaction` + * This is not a breaking change, as this method was deprecated before the Tax Transactions API was released in favor of the `create_from_calculation` method. ## 5.4.0b1 - 2023-03-23 - -- [#941](https://github.com/stripe/stripe-python/pull/941) Update generated code for beta (new) - - Add support for new resources `Tax.CalculationLineItem` and `Tax.TransactionLineItem` - - Add support for `collect_inputs` method on resource `Terminal.Reader` +* [#941](https://github.com/stripe/stripe-python/pull/941) Update generated code for beta (new) + * Add support for new resources `Tax.CalculationLineItem` and `Tax.TransactionLineItem` + * Add support for `collect_inputs` method on resource `Terminal.Reader` ## 5.3.0 - 2023-03-23 - -- [#947](https://github.com/stripe/stripe-python/pull/947) Update generated code - - Add support for new resources `Tax.CalculationLineItem`, `Tax.Calculation`, `Tax.TransactionLineItem`, and `Tax.Transaction` - - Add support for `create` and `list_line_items` methods on resource `Calculation` - - Add support for `create_from_calculation`, `create_reversal`, `create`, `list_line_items`, and `retrieve` methods on resource `Transaction` +* [#947](https://github.com/stripe/stripe-python/pull/947) Update generated code + * Add support for new resources `Tax.CalculationLineItem`, `Tax.Calculation`, `Tax.TransactionLineItem`, and `Tax.Transaction` + * Add support for `create` and `list_line_items` methods on resource `Calculation` + * Add support for `create_from_calculation`, `create_reversal`, `create`, `list_line_items`, and `retrieve` methods on resource `Transaction` ## 5.3.0b4 - 2023-03-16 - -- [#940](https://github.com/stripe/stripe-python/pull/940) Update generated code for beta (new) - - Add support for `create_from_calculation` method on resource `Tax.Transaction` -- [#938](https://github.com/stripe/stripe-python/pull/938) Update generated code for beta (new) - - Remove support for resources `Capital.FinancingOffer` and `Capital.FinancingSummary` - - Remove support for `list`, `mark_delivered`, and `retrieve` methods on resource `FinancingOffer` - - Remove support for `retrieve` method on resource `FinancingSummary` +* [#940](https://github.com/stripe/stripe-python/pull/940) Update generated code for beta (new) + * Add support for `create_from_calculation` method on resource `Tax.Transaction` +* [#938](https://github.com/stripe/stripe-python/pull/938) Update generated code for beta (new) + * Remove support for resources `Capital.FinancingOffer` and `Capital.FinancingSummary` + * Remove support for `list`, `mark_delivered`, and `retrieve` methods on resource `FinancingOffer` + * Remove support for `retrieve` method on resource `FinancingSummary` ## 5.3.0b3 - 2023-03-09 - -- [#936](https://github.com/stripe/stripe-python/pull/936) API Updates for beta branch - - Updated stable APIs to the latest version - - Remove support for `list_transactions` method on resource `Tax.Transaction` +* [#936](https://github.com/stripe/stripe-python/pull/936) API Updates for beta branch + * Updated stable APIs to the latest version + * Remove support for `list_transactions` method on resource `Tax.Transaction` ## 5.3.0b2 - 2023-03-03 - -- [#935](https://github.com/stripe/stripe-python/pull/935) API Updates for beta branch - - Updated stable APIs to the latest version - - Add support for new resources `Issuing.CardBundle` and `Issuing.CardDesign` - - Add support for `list` and `retrieve` methods on resource `CardBundle` - - Add support for `list`, `modify`, and `retrieve` methods on resource `CardDesign` +* [#935](https://github.com/stripe/stripe-python/pull/935) API Updates for beta branch + * Updated stable APIs to the latest version + * Add support for new resources `Issuing.CardBundle` and `Issuing.CardDesign` + * Add support for `list` and `retrieve` methods on resource `CardBundle` + * Add support for `list`, `modify`, and `retrieve` methods on resource `CardDesign` ## 5.3.0b1 - 2023-02-23 - -- [#931](https://github.com/stripe/stripe-python/pull/931) API Updates for beta branch - - Updated stable APIs to the latest version +* [#931](https://github.com/stripe/stripe-python/pull/931) API Updates for beta branch + * Updated stable APIs to the latest version ## 5.2.0 - 2023-02-16 - -- [#924](https://github.com/stripe/stripe-python/pull/924) API Updates - - Add support for `refund_payment` method on resource `Terminal.Reader` +* [#924](https://github.com/stripe/stripe-python/pull/924) API Updates + * Add support for `refund_payment` method on resource `Terminal.Reader` ## 5.2.0b1 - 2023-02-02 - -- [#921](https://github.com/stripe/stripe-python/pull/921) API Updates for beta branch - - Updated stable APIs to the latest version - - Add support for new resource `FinancialConnections.Transaction` - - Add support for `list` method on resource `Transaction` +* [#921](https://github.com/stripe/stripe-python/pull/921) API Updates for beta branch + * Updated stable APIs to the latest version + * Add support for new resource `FinancialConnections.Transaction` + * Add support for `list` method on resource `Transaction` ## 5.1.1 - 2023-02-06 - -- [#923](https://github.com/stripe/stripe-python/pull/923) Bugfix: revert "Pass params into logger.{info,debug}" +* [#923](https://github.com/stripe/stripe-python/pull/923) Bugfix: revert "Pass params into logger.{info,debug}" ## 5.1.0 - 2023-02-02 - -- [#920](https://github.com/stripe/stripe-python/pull/920) API Updates - - Add support for `resume` method on resource `Subscription` -- [#913](https://github.com/stripe/stripe-python/pull/913) Pass params into logger.{info,debug} +* [#920](https://github.com/stripe/stripe-python/pull/920) API Updates + * Add support for `resume` method on resource `Subscription` +* [#913](https://github.com/stripe/stripe-python/pull/913) Pass params into logger.{info,debug} ## 5.1.0b7 - 2023-01-26 - -- [#917](https://github.com/stripe/stripe-python/pull/917) API Updates for beta branch - - Updated stable APIs to the latest version - - Add support for `list_transactions` method on resource `Tax.Transaction` +* [#917](https://github.com/stripe/stripe-python/pull/917) API Updates for beta branch + * Updated stable APIs to the latest version + * Add support for `list_transactions` method on resource `Tax.Transaction` ## 5.1.0b6 - 2023-01-19 - -- [#915](https://github.com/stripe/stripe-python/pull/915) API Updates for beta branch - - Updated stable APIs to the latest version - - Add support for `Tax.Settings` resource. +* [#915](https://github.com/stripe/stripe-python/pull/915) API Updates for beta branch + * Updated stable APIs to the latest version + * Add support for `Tax.Settings` resource. ## 5.1.0b5 - 2023-01-12 - -- [#914](https://github.com/stripe/stripe-python/pull/914) API Updates for beta branch - - Updated stable APIs to the latest version - - Change `quote.draft_quote` implementation to from calling `POST /v1/quotes/{quote}/draft` to `POST /v1/quotes/{quote}/mark_draft` - - Add support for `tax.Registration` resource +* [#914](https://github.com/stripe/stripe-python/pull/914) API Updates for beta branch + * Updated stable APIs to the latest version + * Change `quote.draft_quote` implementation to from calling `POST /v1/quotes/{quote}/draft` to `POST /v1/quotes/{quote}/mark_draft` + * Add support for `tax.Registration` resource ## 5.1.0b4 - 2023-01-05 - -- [#912](https://github.com/stripe/stripe-python/pull/912) API Updates for beta branch - - Updated stable APIs to the latest version - - Add support for `mark_stale_quote` method on resource `Quote` +* [#912](https://github.com/stripe/stripe-python/pull/912) API Updates for beta branch + * Updated stable APIs to the latest version + * Add support for `mark_stale_quote` method on resource `Quote` ## 5.1.0b3 - 2022-12-22 - -- [#910](https://github.com/stripe/stripe-python/pull/910) API Updates for beta branch - - Updated stable APIs to the latest version - - Move `stripe.TaxCalculation` and `stripe.TaxTranscation` to `stripe.tax.Calculation` and `stripe.tax.Transaction`. +* [#910](https://github.com/stripe/stripe-python/pull/910) API Updates for beta branch + * Updated stable APIs to the latest version + * Move `stripe.TaxCalculation` and `stripe.TaxTranscation` to `stripe.tax.Calculation` and `stripe.tax.Transaction`. ## 5.1.0b2 - 2022-12-15 - -- [#906](https://github.com/stripe/stripe-python/pull/906) API Updates for beta branch - - Updated stable APIs to the latest version - - Add support for new resources `QuoteLine`, `TaxCalculation`, and `TaxTransaction` - - Add support for `create` and `list_line_items` methods on resource `TaxCalculation` - - Add support for `create_reversal`, `create`, and `retrieve` methods on resource `TaxTransaction` +* [#906](https://github.com/stripe/stripe-python/pull/906) API Updates for beta branch + * Updated stable APIs to the latest version + * Add support for new resources `QuoteLine`, `TaxCalculation`, and `TaxTransaction` + * Add support for `create` and `list_line_items` methods on resource `TaxCalculation` + * Add support for `create_reversal`, `create`, and `retrieve` methods on resource `TaxTransaction` ## 5.1.0b1 - 2022-12-08 - -- [#902](https://github.com/stripe/stripe-python/pull/902) API Updates for beta branch - - Updated stable APIs to the latest version -- [#898](https://github.com/stripe/stripe-python/pull/898) API Updates for beta branch - - Updated stable APIs to the latest version +* [#902](https://github.com/stripe/stripe-python/pull/902) API Updates for beta branch + * Updated stable APIs to the latest version +* [#898](https://github.com/stripe/stripe-python/pull/898) API Updates for beta branch + * Updated stable APIs to the latest version ## 5.0.0 - 2022-11-16 @@ -1610,73 +1454,63 @@ Breaking changes that arose during code generation of the library that we postpo "⚠️" symbol highlights breaking changes. -- [#895](https://github.com/stripe/stripe-python/pull/895) Next major release changes -- [#889](https://github.com/stripe/stripe-python/pull/889) API Updates +* [#895](https://github.com/stripe/stripe-python/pull/895) Next major release changes +* [#889](https://github.com/stripe/stripe-python/pull/889) API Updates -- [#888](https://github.com/stripe/stripe-python/pull/888) Do not run Coveralls if secret token is not available -- [#875](https://github.com/stripe/stripe-python/pull/875) hide misleading ssl security warning in python>=2.7.9 +* [#888](https://github.com/stripe/stripe-python/pull/888) Do not run Coveralls if secret token is not available +* [#875](https://github.com/stripe/stripe-python/pull/875) hide misleading ssl security warning in python>=2.7.9 ## 4.3.0b3 - 2022-11-02 - -- [#890](https://github.com/stripe/stripe-python/pull/890) API Updates for beta branch - - Updated beta APIs to the latest stable version -- [#885](https://github.com/stripe/stripe-python/pull/885) Update changelog for the Gift Card API -- [#884](https://github.com/stripe/stripe-python/pull/884) API Updates for beta branch - - Updated stable APIs to the latest version +* [#890](https://github.com/stripe/stripe-python/pull/890) API Updates for beta branch + * Updated beta APIs to the latest stable version +* [#885](https://github.com/stripe/stripe-python/pull/885) Update changelog for the Gift Card API +* [#884](https://github.com/stripe/stripe-python/pull/884) API Updates for beta branch + * Updated stable APIs to the latest version ## 4.3.0b1 - 2022-09-26 - -- [#878](https://github.com/stripe/stripe-python/pull/878) API Updates for beta branch - - Updated stable APIs to the latest version - - Add `FinancingOffer`, `FinancingSummary` and `FinancingTransaction` resources. +* [#878](https://github.com/stripe/stripe-python/pull/878) API Updates for beta branch + * Updated stable APIs to the latest version + * Add `FinancingOffer`, `FinancingSummary` and `FinancingTransaction` resources. ## 4.2.0 - 2022-09-23 - -- [#877](https://github.com/stripe/stripe-python/pull/877) API Updates - - Add `upcoming_lines` method to the `Invoice` resource. -- [#873](https://github.com/stripe/stripe-python/pull/873) Add abstract methods for SearchableAPIResource -- [#867](https://github.com/stripe/stripe-python/pull/867) API Updates - - Update links in documentation to be absolute. +* [#877](https://github.com/stripe/stripe-python/pull/877) API Updates + * Add `upcoming_lines` method to the `Invoice` resource. +* [#873](https://github.com/stripe/stripe-python/pull/873) Add abstract methods for SearchableAPIResource +* [#867](https://github.com/stripe/stripe-python/pull/867) API Updates + * Update links in documentation to be absolute. ## 4.2.0b2 - 2022-08-26 - -- [#869](https://github.com/stripe/stripe-python/pull/869) API Updates for beta branch - - Updated stable APIs to the latest version - - Add support for the beta [Gift Card API](https://stripe.com/docs/gift-cards). +* [#869](https://github.com/stripe/stripe-python/pull/869) API Updates for beta branch + * Updated stable APIs to the latest version + * Add support for the beta [Gift Card API](https://stripe.com/docs/gift-cards). ## 4.2.0b1 - 2022-08-23 - -- [#866](https://github.com/stripe/stripe-python/pull/866) API Updates for beta branch - - Updated stable APIs to the latest version - - `Stripe-Version` beta headers are not pinned by-default and need to be manually specified, please refer to [beta SDKs README section](https://github.com/stripe/stripe-dotnet/blob/master/README.md#beta-sdks) +* [#866](https://github.com/stripe/stripe-python/pull/866) API Updates for beta branch + - Updated stable APIs to the latest version + - `Stripe-Version` beta headers are not pinned by-default and need to be manually specified, please refer to [beta SDKs README section](https://github.com/stripe/stripe-dotnet/blob/master/README.md#beta-sdks) ## 4.1.0 - 2022-08-19 - -- [#861](https://github.com/stripe/stripe-python/pull/861) API Updates - - Add support for new resource `CustomerCashBalanceTransaction` -- [#860](https://github.com/stripe/stripe-python/pull/860) Add a support section to the readme -- [#717](https://github.com/stripe/stripe-python/pull/717) Fix test TestCharge.test_is_saveable(). +* [#861](https://github.com/stripe/stripe-python/pull/861) API Updates + * Add support for new resource `CustomerCashBalanceTransaction` +* [#860](https://github.com/stripe/stripe-python/pull/860) Add a support section to the readme +* [#717](https://github.com/stripe/stripe-python/pull/717) Fix test TestCharge.test_is_saveable(). ## 4.1.0b2 - 2022-08-11 - -- [#859](https://github.com/stripe/stripe-python/pull/859) API Updates for beta branch - - Updated stable APIs to the latest version - - Add `refund_payment` method to Terminal resource +* [#859](https://github.com/stripe/stripe-python/pull/859) API Updates for beta branch + - Updated stable APIs to the latest version + - Add `refund_payment` method to Terminal resource ## 4.1.0b1 - 2022-08-03 - -- [#848](https://github.com/stripe/stripe-python/pull/848) API Updates for beta branch - - Updated stable APIs to the latest version - - Added the `Order` resource support +* [#848](https://github.com/stripe/stripe-python/pull/848) API Updates for beta branch + - Updated stable APIs to the latest version + - Added the `Order` resource support ## 4.0.2 - 2022-08-03 - -- [#855](https://github.com/stripe/stripe-python/pull/855) Fix issue where auto_paging_iter failed on nested list objects. +* [#855](https://github.com/stripe/stripe-python/pull/855) Fix issue where auto_paging_iter failed on nested list objects. ## 4.0.1 - 2022-08-02 - -- [#850](https://github.com/stripe/stripe-python/pull/850) Fix incorrect handling of additional request parameters - - Fixes issue where using special parameter like `api_key`, `idempotency_key`, `stripe_version`, `stripe_account`, `headers` can cause a `Received unknown parameter error`. +* [#850](https://github.com/stripe/stripe-python/pull/850) Fix incorrect handling of additional request parameters + * Fixes issue where using special parameter like `api_key`, `idempotency_key`, `stripe_version`, `stripe_account`, `headers` can cause a `Received unknown parameter error`. ## 4.0.0 - 2022-08-02 @@ -1684,1120 +1518,874 @@ Breaking changes that arose during code generation of the library that we postpo "⚠️" symbol highlights breaking changes. -- [#847](https://github.com/stripe/stripe-python/pull/847) API Updates -- [#845](https://github.com/stripe/stripe-python/pull/845) Next major release changes -- [#836](https://github.com/stripe/stripe-python/pull/836) API Updates. Add Price.create tests. -- [#835](https://github.com/stripe/stripe-python/pull/835) API Updates. Use auto-generation for credit_note and invoice methods. +* [#847](https://github.com/stripe/stripe-python/pull/847) API Updates +* [#845](https://github.com/stripe/stripe-python/pull/845) Next major release changes +* [#836](https://github.com/stripe/stripe-python/pull/836) API Updates. Add Price.create tests. +* [#835](https://github.com/stripe/stripe-python/pull/835) API Updates. Use auto-generation for credit_note and invoice methods. ## 3.6.0b1 - 2022-07-22 - -- [#843](https://github.com/stripe/stripe-python/pull/843) API Updates for beta branch - - Updated stable APIs to the latest version - - Add `QuotePhase` resource -- [#840](https://github.com/stripe/stripe-python/pull/840) API Updates for beta branch - - Updated stable APIs to the latest version - - Add `SubscriptionSchedule.amend` method. -- [#837](https://github.com/stripe/stripe-python/pull/837) API Updates for beta branch - - Include `server_side_confirmation_beta=v1` beta - - Add `secretKeyConfirmation` to `PaymentIntent` -- [#834](https://github.com/stripe/stripe-python/pull/834) API Updates for beta branch - - Updated stable APIs to the latest version -- [#826](https://github.com/stripe/stripe-python/pull/826) Use the generated API version +* [#843](https://github.com/stripe/stripe-python/pull/843) API Updates for beta branch + - Updated stable APIs to the latest version + - Add `QuotePhase` resource +* [#840](https://github.com/stripe/stripe-python/pull/840) API Updates for beta branch + - Updated stable APIs to the latest version + - Add `SubscriptionSchedule.amend` method. +* [#837](https://github.com/stripe/stripe-python/pull/837) API Updates for beta branch + - Include `server_side_confirmation_beta=v1` beta + - Add `secretKeyConfirmation` to `PaymentIntent` +* [#834](https://github.com/stripe/stripe-python/pull/834) API Updates for beta branch + - Updated stable APIs to the latest version +* [#826](https://github.com/stripe/stripe-python/pull/826) Use the generated API version ## 3.5.0 - 2022-06-30 - -- [#831](https://github.com/stripe/stripe-python/pull/831) API Updates - - Add support for `deliver_card`, `fail_card`, `return_card`, and `ship_card` test helper methods on resource `Issuing.Card` - - Switch from using `instance_url` to computing method path in place for custom methods. - - Switch from using explicit class methods for test helpers instead of using meta-programming. +* [#831](https://github.com/stripe/stripe-python/pull/831) API Updates + * Add support for `deliver_card`, `fail_card`, `return_card`, and `ship_card` test helper methods on resource `Issuing.Card` + * Switch from using `instance_url` to computing method path in place for custom methods. + * Switch from using explicit class methods for test helpers instead of using meta-programming. ## 3.4.0 - 2022-06-17 - -- [#824](https://github.com/stripe/stripe-python/pull/824) API Updates - - Add support for `fund_cash_balance` test helper method on resource `Customer` -- [#823](https://github.com/stripe/stripe-python/pull/823) Trigger workflows on beta branches +* [#824](https://github.com/stripe/stripe-python/pull/824) API Updates + * Add support for `fund_cash_balance` test helper method on resource `Customer` +* [#823](https://github.com/stripe/stripe-python/pull/823) Trigger workflows on beta branches ## 3.3.0 - 2022-06-08 - -- [#818](https://github.com/stripe/stripe-python/pull/818) fix: Update cash balance methods to no longer require nested ID. +* [#818](https://github.com/stripe/stripe-python/pull/818) fix: Update cash balance methods to no longer require nested ID. ## 3.2.0 - 2022-05-23 - -- [#812](https://github.com/stripe/stripe-python/pull/812) API Updates - - Add support for new resource `Apps.Secret` +* [#812](https://github.com/stripe/stripe-python/pull/812) API Updates + * Add support for new resource `Apps.Secret` ## 3.1.0 - 2022-05-19 - -- [#810](https://github.com/stripe/stripe-python/pull/810) API Updates - - Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction` - - Add support for `retrieve_payment_method` method on resource `Customer` - - Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account` -- [#719](https://github.com/stripe/stripe-python/pull/719) Set daemon attribute instead of using setDaemon method that was deprecated in Python 3.10 -- [#767](https://github.com/stripe/stripe-python/pull/767) Bump vendored six to 1.16.0 -- [#806](https://github.com/stripe/stripe-python/pull/806) Start testing on pypy-3.8 -- [#811](https://github.com/stripe/stripe-python/pull/811) Add sanitize_id method +* [#810](https://github.com/stripe/stripe-python/pull/810) API Updates + * Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction` + * Add support for `retrieve_payment_method` method on resource `Customer` + * Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account` +* [#719](https://github.com/stripe/stripe-python/pull/719) Set daemon attribute instead of using setDaemon method that was deprecated in Python 3.10 +* [#767](https://github.com/stripe/stripe-python/pull/767) Bump vendored six to 1.16.0 +* [#806](https://github.com/stripe/stripe-python/pull/806) Start testing on pypy-3.8 +* [#811](https://github.com/stripe/stripe-python/pull/811) Add sanitize_id method ## 3.0.0 - 2022-05-09 - -- [#809](https://github.com/stripe/stripe-python/pull/809) Release of major version v3.0.0. The [migration guide](https://github.com/stripe/stripe-python/wiki/Migration-Guide-for-v3) contains more information. - (⚠️ = breaking changes): - - ⚠️ Replace the legacy `Order` API with the new `Order` API. - - New methods: `cancel`, `list_line_items`, `reopen`, and `submit` - - Removed methods: `pay` and `return_order` - - Removed resources: `OrderItem` and `OrderReturn` - - ⚠️ Rename `financial_connections.account.refresh` to `financial_connections.refresh_account` - - Add support for `amount_discount`, `amount_tax`, and `product` on `LineItem` +* [#809](https://github.com/stripe/stripe-python/pull/809) Release of major version v3.0.0. The [migration guide](https://github.com/stripe/stripe-python/wiki/Migration-Guide-for-v3) contains more information. + (⚠️ = breaking changes): + * ⚠️ Replace the legacy `Order` API with the new `Order` API. + * New methods: `cancel`, `list_line_items`, `reopen`, and `submit` + * Removed methods: `pay` and `return_order` + * Removed resources: `OrderItem` and `OrderReturn` + * ⚠️ Rename `financial_connections.account.refresh` to `financial_connections.refresh_account` + * Add support for `amount_discount`, `amount_tax`, and `product` on `LineItem` ## 2.76.0 - 2022-05-05 - -- [#808](https://github.com/stripe/stripe-python/pull/808) API Updates - - Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session` +* [#808](https://github.com/stripe/stripe-python/pull/808) API Updates + * Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session` ## 2.75.0 - 2022-05-03 - -- [#805](https://github.com/stripe/stripe-python/pull/805) API Updates - - Add support for new resource `CashBalance` +* [#805](https://github.com/stripe/stripe-python/pull/805) API Updates + * Add support for new resource `CashBalance` ## 2.74.0 - 2022-04-21 - -- [#796](https://github.com/stripe/stripe-python/pull/796) API Updates - - Add support for `expire` test helper method on resource `Refund` +* [#796](https://github.com/stripe/stripe-python/pull/796) API Updates + * Add support for `expire` test helper method on resource `Refund` ## 2.73.0 - 2022-04-18 - -- [#792](https://github.com/stripe/stripe-python/pull/792) [#794](https://github.com/stripe/stripe-python/pull/794) [#795](https://github.com/stripe/stripe-python/pull/795) API Updates - - Add support for new resources `FundingInstructions` and `Terminal.Configuration` +* [#792](https://github.com/stripe/stripe-python/pull/792) [#794](https://github.com/stripe/stripe-python/pull/794) [#795](https://github.com/stripe/stripe-python/pull/795) API Updates + * Add support for new resources `FundingInstructions` and `Terminal.Configuration` ## 2.72.0 - 2022-04-13 - -- [#791](https://github.com/stripe/stripe-python/pull/791) API Updates - - Add support for `increment_authorization` method on resource `PaymentIntent` +* [#791](https://github.com/stripe/stripe-python/pull/791) API Updates + * Add support for `increment_authorization` method on resource `PaymentIntent` ## 2.71.0 - 2022-04-08 - -- [#788](https://github.com/stripe/stripe-python/pull/788) API Updates - - Add support for `apply_customer_balance` method on resource `PaymentIntent` +* [#788](https://github.com/stripe/stripe-python/pull/788) API Updates + * Add support for `apply_customer_balance` method on resource `PaymentIntent` ## 2.70.0 - 2022-03-30 - -- [#785](https://github.com/stripe/stripe-python/pull/785) API Updates - - Add support for `cancel_action`, `process_payment_intent`, `process_setup_intent`, and `set_reader_display` methods on resource `Terminal.Reader` +* [#785](https://github.com/stripe/stripe-python/pull/785) API Updates + * Add support for `cancel_action`, `process_payment_intent`, `process_setup_intent`, and `set_reader_display` methods on resource `Terminal.Reader` ## 2.69.0 - 2022-03-29 - -- [#783](https://github.com/stripe/stripe-python/pull/783) API Updates - - Add support for Search API - - Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription` -- [#784](https://github.com/stripe/stripe-python/pull/784) Pin click dependency to 8.0.4 to avoid breakage in black -- [#773](https://github.com/stripe/stripe-python/pull/773) Add infrastructure for test-helper methods -- [#782](https://github.com/stripe/stripe-python/pull/782) Revert Orders to use qualified name for upload_api_base +* [#783](https://github.com/stripe/stripe-python/pull/783) API Updates + * Add support for Search API + * Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription` +* [#784](https://github.com/stripe/stripe-python/pull/784) Pin click dependency to 8.0.4 to avoid breakage in black +* [#773](https://github.com/stripe/stripe-python/pull/773) Add infrastructure for test-helper methods +* [#782](https://github.com/stripe/stripe-python/pull/782) Revert Orders to use qualified name for upload_api_base ## 2.68.0 - 2022-03-23 - -- [#781](https://github.com/stripe/stripe-python/pull/781) API Updates - - Add support for `cancel` method on resource `Refund` -- [#777](https://github.com/stripe/stripe-python/pull/777) Add support for SearchResult. +* [#781](https://github.com/stripe/stripe-python/pull/781) API Updates + * Add support for `cancel` method on resource `Refund` +* [#777](https://github.com/stripe/stripe-python/pull/777) Add support for SearchResult. ## 2.67.0 - 2022-03-01 - -- [#774](https://github.com/stripe/stripe-python/pull/774) API Updates - - Add support for new resource `TestHelpers.TestClock` +* [#774](https://github.com/stripe/stripe-python/pull/774) API Updates + * Add support for new resource `TestHelpers.TestClock` ## 2.66.0 - 2022-02-16 - -- [#771](https://github.com/stripe/stripe-python/pull/771) API Updates - - Add support for `verify_microdeposits` method on resources `PaymentIntent` and `SetupIntent` +* [#771](https://github.com/stripe/stripe-python/pull/771) API Updates + * Add support for `verify_microdeposits` method on resources `PaymentIntent` and `SetupIntent` ## 2.65.0 - 2022-01-20 - -- [#766](https://github.com/stripe/stripe-python/pull/766) API Updates - - Add support for new resource `PaymentLink` -- [#763](https://github.com/stripe/stripe-python/pull/763) Start testing Python 3.10 +* [#766](https://github.com/stripe/stripe-python/pull/766) API Updates + * Add support for new resource `PaymentLink` +* [#763](https://github.com/stripe/stripe-python/pull/763) Start testing Python 3.10 ## 2.64.0 - 2021-12-21 - -- [#757](https://github.com/stripe/stripe-python/pull/757) Update class custom methods to save list object parameters. -- [#756](https://github.com/stripe/stripe-python/pull/756) Introduce custom listing methods on objects. -- [#754](https://github.com/stripe/stripe-python/pull/754) Clarify metadata deletion message. +* [#757](https://github.com/stripe/stripe-python/pull/757) Update class custom methods to save list object parameters. +* [#756](https://github.com/stripe/stripe-python/pull/756) Introduce custom listing methods on objects. +* [#754](https://github.com/stripe/stripe-python/pull/754) Clarify metadata deletion message. ## 2.63.0 - 2021-11-16 - -- [#748](https://github.com/stripe/stripe-python/pull/748) API Updates - - Add support for new resource `ShippingRate` +* [#748](https://github.com/stripe/stripe-python/pull/748) API Updates + * Add support for new resource `ShippingRate` ## 2.62.0 - 2021-11-11 - -- [#745](https://github.com/stripe/stripe-python/pull/745) API Updates - - Add support for `expire` method on resource `Checkout.Session` +* [#745](https://github.com/stripe/stripe-python/pull/745) API Updates + * Add support for `expire` method on resource `Checkout.Session` ## 2.61.0 - 2021-10-11 - -- [#738](https://github.com/stripe/stripe-python/pull/738) API Updates - - Add support for `list_payment_methods` method on resource `Customer` -- [#736](https://github.com/stripe/stripe-python/pull/736) Stop sending raw exception message as part of Stripe user agent. +* [#738](https://github.com/stripe/stripe-python/pull/738) API Updates + * Add support for `list_payment_methods` method on resource `Customer` +* [#736](https://github.com/stripe/stripe-python/pull/736) Stop sending raw exception message as part of Stripe user agent. ## 2.60.0 - 2021-07-14 - -- [#728](https://github.com/stripe/stripe-python/pull/728) API Updates - - Add support for `list_computed_upfront_line_items` method on resource `Quote` +* [#728](https://github.com/stripe/stripe-python/pull/728) API Updates + * Add support for `list_computed_upfront_line_items` method on resource `Quote` ## 2.59.0 - 2021-07-09 - -- [#727](https://github.com/stripe/stripe-python/pull/727) [#725](https://github.com/stripe/stripe-python/pull/725) Add support for new `Quote` API. +* [#727](https://github.com/stripe/stripe-python/pull/727) [#725](https://github.com/stripe/stripe-python/pull/725) Add support for new `Quote` API. ## 2.58.0 - 2021-06-04 - -- [#722](https://github.com/stripe/stripe-python/pull/722) API Updates - - Add support for new `TaxCode` API. +* [#722](https://github.com/stripe/stripe-python/pull/722) API Updates + * Add support for new `TaxCode` API. ## 2.57.0 - 2021-05-19 - -- [#720](https://github.com/stripe/stripe-python/pull/720) Add support for Identity VerificationSession and VerificationReport APIs +* [#720](https://github.com/stripe/stripe-python/pull/720) Add support for Identity VerificationSession and VerificationReport APIs ## 2.56.0 - 2021-02-22 - -- [#713](https://github.com/stripe/stripe-python/pull/713) Add support for the Billing Portal Configuration API +* [#713](https://github.com/stripe/stripe-python/pull/713) Add support for the Billing Portal Configuration API ## 2.55.2 - 2021-02-05 - -- [#704](https://github.com/stripe/stripe-python/pull/704) Fix CA bundle path issue +* [#704](https://github.com/stripe/stripe-python/pull/704) Fix CA bundle path issue ## 2.55.1 - 2020-12-01 - -- [#698](https://github.com/stripe/stripe-python/pull/698) Fix issue where StripeObjects in lists would not be converted to dicts -- [#699](https://github.com/stripe/stripe-python/pull/699) Start testing Python 3.9 -- [#691](https://github.com/stripe/stripe-python/pull/691) Include the examples in the built sources +* [#698](https://github.com/stripe/stripe-python/pull/698) Fix issue where StripeObjects in lists would not be converted to dicts +* [#699](https://github.com/stripe/stripe-python/pull/699) Start testing Python 3.9 +* [#691](https://github.com/stripe/stripe-python/pull/691) Include the examples in the built sources ## 2.55.0 - 2020-10-14 - -- [#684](https://github.com/stripe/stripe-python/pull/684) Add support for the Payout Reverse API +* [#684](https://github.com/stripe/stripe-python/pull/684) Add support for the Payout Reverse API ## 2.54.0 - 2020-09-29 - -- [#681](https://github.com/stripe/stripe-python/pull/681) Add support for the `SetupAttempt` resource and List API -- 2.52.0 and 2.53.0 were empty releases that contained no additional changes. +* [#681](https://github.com/stripe/stripe-python/pull/681) Add support for the `SetupAttempt` resource and List API +* 2.52.0 and 2.53.0 were empty releases that contained no additional changes. ## 2.51.0 - 2020-09-02 - -- [#676](https://github.com/stripe/stripe-python/pull/676) Add support for the Issuing Dispute Submit API +* [#676](https://github.com/stripe/stripe-python/pull/676) Add support for the Issuing Dispute Submit API ## 2.50.0 - 2020-08-05 - -- [#669](https://github.com/stripe/stripe-python/pull/669) Add support for the `PromotionCode` resource and APIs +* [#669](https://github.com/stripe/stripe-python/pull/669) Add support for the `PromotionCode` resource and APIs ## 2.49.0 - 2020-07-17 - -- [#665](https://github.com/stripe/stripe-python/pull/665) Support stripe.File.create(stripe_version='...') +* [#665](https://github.com/stripe/stripe-python/pull/665) Support stripe.File.create(stripe_version='...') ## 2.48.0 - 2020-05-11 - -- [#655](https://github.com/stripe/stripe-python/pull/655) Add support for the `LineItem` resource and APIs +* [#655](https://github.com/stripe/stripe-python/pull/655) Add support for the `LineItem` resource and APIs ## 2.47.0 - 2020-04-29 - -- [#652](https://github.com/stripe/stripe-python/pull/652) Add support for the `Price` resource and APIs +* [#652](https://github.com/stripe/stripe-python/pull/652) Add support for the `Price` resource and APIs ## 2.46.0 - 2020-04-22 - -- [#651](https://github.com/stripe/stripe-python/pull/651) Add support for `billing_portal` namespace and `Session` resource and APIs +* [#651](https://github.com/stripe/stripe-python/pull/651) Add support for `billing_portal` namespace and `Session` resource and APIs ## 2.45.0 - 2020-04-06 - -- [#648](https://github.com/stripe/stripe-python/pull/648) Add support for Express links in `authorize_url` for `OAuth` +* [#648](https://github.com/stripe/stripe-python/pull/648) Add support for Express links in `authorize_url` for `OAuth` ## 2.44.0 - 2020-03-23 - -- [#646](https://github.com/stripe/stripe-python/pull/646) Allow overriding API key in OAuth methods +* [#646](https://github.com/stripe/stripe-python/pull/646) Allow overriding API key in OAuth methods ## 2.43.0 - 2020-02-26 - -- [#644](https://github.com/stripe/stripe-python/pull/644) Add support for listing Checkout `Session` +* [#644](https://github.com/stripe/stripe-python/pull/644) Add support for listing Checkout `Session` ## 2.42.0 - 2020-01-14 - -- [#640](https://github.com/stripe/stripe-python/pull/640) Add support for `CreditNoteLineItem` -- [#639](https://github.com/stripe/stripe-python/pull/639) Pin black version -- [#637](https://github.com/stripe/stripe-python/pull/637) Start testing Python 3.8 +* [#640](https://github.com/stripe/stripe-python/pull/640) Add support for `CreditNoteLineItem` +* [#639](https://github.com/stripe/stripe-python/pull/639) Pin black version +* [#637](https://github.com/stripe/stripe-python/pull/637) Start testing Python 3.8 ## 2.41.1 - 2019-12-30 - -- [#636](https://github.com/stripe/stripe-python/pull/636) Fix uploading files with Unicode names (Python 2.7) -- [#635](https://github.com/stripe/stripe-python/pull/635) Update Python API docs inline link -- [#631](https://github.com/stripe/stripe-python/pull/631) Update `proxy.py` +* [#636](https://github.com/stripe/stripe-python/pull/636) Fix uploading files with Unicode names (Python 2.7) +* [#635](https://github.com/stripe/stripe-python/pull/635) Update Python API docs inline link +* [#631](https://github.com/stripe/stripe-python/pull/631) Update `proxy.py` ## 2.41.0 - 2019-11-26 - -- [#630](https://github.com/stripe/stripe-python/pull/630) Add support for `CreditNote` preview +* [#630](https://github.com/stripe/stripe-python/pull/630) Add support for `CreditNote` preview ## 2.40.0 - 2019-11-08 - -- [#627](https://github.com/stripe/stripe-python/pull/627) Add list_usage_record_summaries and list_source_transactions +* [#627](https://github.com/stripe/stripe-python/pull/627) Add list_usage_record_summaries and list_source_transactions ## 2.39.0 - 2019-11-06 - -- [#625](https://github.com/stripe/stripe-python/pull/625) Add support for `Mandate` +* [#625](https://github.com/stripe/stripe-python/pull/625) Add support for `Mandate` ## 2.38.0 - 2019-10-29 - -- [#623](https://github.com/stripe/stripe-python/pull/623) Add support for reverse pagination -- [#624](https://github.com/stripe/stripe-python/pull/624) Contributor Convenant +* [#623](https://github.com/stripe/stripe-python/pull/623) Add support for reverse pagination +* [#624](https://github.com/stripe/stripe-python/pull/624) Contributor Convenant ## 2.37.2 - 2019-10-04 - -- [#621](https://github.com/stripe/stripe-python/pull/621) Implement support for stripe-should-retry and retry-after headers +* [#621](https://github.com/stripe/stripe-python/pull/621) Implement support for stripe-should-retry and retry-after headers ## 2.37.1 - 2019-09-26 - -- [#620](https://github.com/stripe/stripe-python/pull/620) Check that `error` is a dict before trying to use it to create a `StripeError` +* [#620](https://github.com/stripe/stripe-python/pull/620) Check that `error` is a dict before trying to use it to create a `StripeError` ## 2.37.0 - 2019-09-26 - -- [#619](https://github.com/stripe/stripe-python/pull/619) Add `ErrorObject` to `StripeError` exceptions -- [#616](https://github.com/stripe/stripe-python/pull/616) Pass `CFLAGS` and `LDFLAGS` when running tests +* [#619](https://github.com/stripe/stripe-python/pull/619) Add `ErrorObject` to `StripeError` exceptions +* [#616](https://github.com/stripe/stripe-python/pull/616) Pass `CFLAGS` and `LDFLAGS` when running tests ## 2.36.2 - 2019-09-12 - -- [#614](https://github.com/stripe/stripe-python/pull/614) Use `OrderedDict` to maintain key order in API requests and responses +* [#614](https://github.com/stripe/stripe-python/pull/614) Use `OrderedDict` to maintain key order in API requests and responses ## 2.36.1 - 2019-09-11 - -- [#612](https://github.com/stripe/stripe-python/pull/612) Use `ListObject` properties as default values in request methods +* [#612](https://github.com/stripe/stripe-python/pull/612) Use `ListObject` properties as default values in request methods ## 2.36.0 - 2019-09-10 - -- [#610](https://github.com/stripe/stripe-python/pull/610) Add support for header parameters in `ListObject` request methods +* [#610](https://github.com/stripe/stripe-python/pull/610) Add support for header parameters in `ListObject` request methods ## 2.35.1 - 2019-08-20 - -- [#605](https://github.com/stripe/stripe-python/pull/605) Fix automatic retries of failed requests -- [#606](https://github.com/stripe/stripe-python/pull/606) Clarify what `max_network_retries` does +* [#605](https://github.com/stripe/stripe-python/pull/605) Fix automatic retries of failed requests +* [#606](https://github.com/stripe/stripe-python/pull/606) Clarify what `max_network_retries` does ## 2.35.0 - 2019-08-12 - -- [#607](https://github.com/stripe/stripe-python/pull/607) Add `SubscriptionItem.create_usage_record` method +* [#607](https://github.com/stripe/stripe-python/pull/607) Add `SubscriptionItem.create_usage_record` method ## 2.34.0 - 2019-08-09 - -- [#604](https://github.com/stripe/stripe-python/pull/604) Remove subscription schedule revisions - - This is technically a breaking change. We've chosen to release it as a minor vesion bump because the associated API is unused. +* [#604](https://github.com/stripe/stripe-python/pull/604) Remove subscription schedule revisions + - This is technically a breaking change. We've chosen to release it as a minor vesion bump because the associated API is unused. ## 2.33.2 - 2019-08-06 - -- [#601](https://github.com/stripe/stripe-python/pull/601) Add support for passing full objects instead of IDs to custom methods -- [#603](https://github.com/stripe/stripe-python/pull/603) Bump vendored six to latest version +* [#601](https://github.com/stripe/stripe-python/pull/601) Add support for passing full objects instead of IDs to custom methods +* [#603](https://github.com/stripe/stripe-python/pull/603) Bump vendored six to latest version ## 2.33.1 - 2019-08-06 - -- [#599](https://github.com/stripe/stripe-python/pull/599) Fix `del` statement to not raise `KeyError` +* [#599](https://github.com/stripe/stripe-python/pull/599) Fix `del` statement to not raise `KeyError` ## 2.33.0 - 2019-07-30 - -- [#595](https://github.com/stripe/stripe-python/pull/595) Listing `BalanceTransaction` objects now uses `/v1/balance_transactions` instead of `/v1/balance/history` +* [#595](https://github.com/stripe/stripe-python/pull/595) Listing `BalanceTransaction` objects now uses `/v1/balance_transactions` instead of `/v1/balance/history` ## 2.32.1 - 2019-07-08 - -- [#592](https://github.com/stripe/stripe-python/pull/592) Fix argument name conflict +* [#592](https://github.com/stripe/stripe-python/pull/592) Fix argument name conflict ## 2.32.0 - 2019-06-27 - -- [#590](https://github.com/stripe/stripe-python/pull/590) Add support for the `SetupIntent` resource and APIs +* [#590](https://github.com/stripe/stripe-python/pull/590) Add support for the `SetupIntent` resource and APIs ## 2.31.0 - 2019-06-24 - -- [#587](https://github.com/stripe/stripe-python/pull/587) Enable request latency telemetry by default +* [#587](https://github.com/stripe/stripe-python/pull/587) Enable request latency telemetry by default ## 2.30.1 - 2019-06-20 - -- [#589](https://github.com/stripe/stripe-python/pull/589) Fix support for `CustomerBalanceTransaction` +* [#589](https://github.com/stripe/stripe-python/pull/589) Fix support for `CustomerBalanceTransaction` ## 2.30.0 - 2019-06-17 - -- [#564](https://github.com/stripe/stripe-python/pull/564) Add support for `CustomerBalanceTransaction` resource and APIs +* [#564](https://github.com/stripe/stripe-python/pull/564) Add support for `CustomerBalanceTransaction` resource and APIs ## 2.29.4 - 2019-06-03 - -- [#583](https://github.com/stripe/stripe-python/pull/583) Remove Poetry and reinstate `setup.py` +* [#583](https://github.com/stripe/stripe-python/pull/583) Remove Poetry and reinstate `setup.py` ## 2.29.3 - 2019-05-31 - Version 2.29.2 was non-functional due to a bugged `version.py` file. This release is identical to 2.29.2 save for the version number. ## 2.29.2 - 2019-05-31 - -- [#561](https://github.com/stripe/stripe-python/pull/561) Replace pipenv with poetry +* [#561](https://github.com/stripe/stripe-python/pull/561) Replace pipenv with poetry ## 2.29.1 - 2019-05-31 - -- [#578](https://github.com/stripe/stripe-python/pull/578) Verify signatures before deserializing events +* [#578](https://github.com/stripe/stripe-python/pull/578) Verify signatures before deserializing events ## 2.29.0 - 2019-05-23 - -- [#575](https://github.com/stripe/stripe-python/pull/575) Add support for `radar.early_fraud_warning` resource +* [#575](https://github.com/stripe/stripe-python/pull/575) Add support for `radar.early_fraud_warning` resource ## 2.28.2 - 2019-05-23 - -- [#574](https://github.com/stripe/stripe-python/pull/574) Fix a few more code quality issues +* [#574](https://github.com/stripe/stripe-python/pull/574) Fix a few more code quality issues ## 2.28.1 - 2019-05-20 - -- [#572](https://github.com/stripe/stripe-python/pull/572) Fix a few code quality issues +* [#572](https://github.com/stripe/stripe-python/pull/572) Fix a few code quality issues ## 2.28.0 - 2019-05-14 - -- [#566](https://github.com/stripe/stripe-python/pull/566) Add support for the `Capability` resource and APIs +* [#566](https://github.com/stripe/stripe-python/pull/566) Add support for the `Capability` resource and APIs ## 2.27.0 - 2019-04-24 - -- [#554](https://github.com/stripe/stripe-python/pull/554) Add support for the `TaxRate` resource and APIs +* [#554](https://github.com/stripe/stripe-python/pull/554) Add support for the `TaxRate` resource and APIs ## 2.26.0 - 2019-04-22 - -- [#555](https://github.com/stripe/stripe-python/pull/555) Add support for the `TaxId` resource and APIs +* [#555](https://github.com/stripe/stripe-python/pull/555) Add support for the `TaxId` resource and APIs ## 2.25.0 - 2019-04-18 - -- [#551](https://github.com/stripe/stripe-python/pull/551) Add support for the `CreditNote` resource and APIs +* [#551](https://github.com/stripe/stripe-python/pull/551) Add support for the `CreditNote` resource and APIs ## 2.24.1 - 2019-04-08 - -- [#550](https://github.com/stripe/stripe-python/pull/550) Fix encoding of nested parameters in multipart requests +* [#550](https://github.com/stripe/stripe-python/pull/550) Fix encoding of nested parameters in multipart requests ## 2.24.0 - 2019-04-03 - -- [#543](https://github.com/stripe/stripe-python/pull/543) Add `delete` class method on deletable API resources -- [#547](https://github.com/stripe/stripe-python/pull/547) Add class methods for all custom API requests (e.g. `Charge.capture`) +* [#543](https://github.com/stripe/stripe-python/pull/543) Add `delete` class method on deletable API resources +* [#547](https://github.com/stripe/stripe-python/pull/547) Add class methods for all custom API requests (e.g. `Charge.capture`) ## 2.23.0 - 2019-03-18 - -- [#537](https://github.com/stripe/stripe-python/pull/537) Add support for the `PaymentMethod` resource and APIs -- [#540](https://github.com/stripe/stripe-python/pull/540) Add support for retrieving a Checkout `Session` -- [#542](https://github.com/stripe/stripe-python/pull/542) Add support for deleting a Terminal `Location` and `Reader` +* [#537](https://github.com/stripe/stripe-python/pull/537) Add support for the `PaymentMethod` resource and APIs +* [#540](https://github.com/stripe/stripe-python/pull/540) Add support for retrieving a Checkout `Session` +* [#542](https://github.com/stripe/stripe-python/pull/542) Add support for deleting a Terminal `Location` and `Reader` ## 2.22.0 - 2019-03-14 - -- [#541](https://github.com/stripe/stripe-python/pull/541) Add `stripe.util.convert_to_dict` method for converting `StripeObject` instances to regular `dict`s +* [#541](https://github.com/stripe/stripe-python/pull/541) Add `stripe.util.convert_to_dict` method for converting `StripeObject` instances to regular `dict`s ## 2.21.0 - 2019-02-12 - -- [#532](https://github.com/stripe/stripe-python/pull/532) Add support for subscription schedules +* [#532](https://github.com/stripe/stripe-python/pull/532) Add support for subscription schedules ## 2.20.3 - 2019-01-30 - -- [#530](https://github.com/stripe/stripe-python/pull/530) Fix client telemetry implementation +* [#530](https://github.com/stripe/stripe-python/pull/530) Fix client telemetry implementation ## 2.20.2 - 2019-01-30 - -- [#534](https://github.com/stripe/stripe-python/pull/534) Fix session initialization for multi-threaded environments +* [#534](https://github.com/stripe/stripe-python/pull/534) Fix session initialization for multi-threaded environments ## 2.20.1 - 2019-01-30 - -- [#531](https://github.com/stripe/stripe-python/pull/531) Make `RequestsClient` thread-safe +* [#531](https://github.com/stripe/stripe-python/pull/531) Make `RequestsClient` thread-safe ## 2.20.0 - 2019-01-29 - -- [#526](https://github.com/stripe/stripe-python/pull/526) Reuse the default HTTP client by default +* [#526](https://github.com/stripe/stripe-python/pull/526) Reuse the default HTTP client by default ## 2.19.0 - 2019-01-23 - -- [#524](https://github.com/stripe/stripe-python/pull/524) Rename `CheckoutSession` to `Session` and move it under the `checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach. +* [#524](https://github.com/stripe/stripe-python/pull/524) Rename `CheckoutSession` to `Session` and move it under the `checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach. ## 2.18.1 - 2019-01-21 - -- [#525](https://github.com/stripe/stripe-python/pull/525) Properly serialize `individual` on `Account` objects +* [#525](https://github.com/stripe/stripe-python/pull/525) Properly serialize `individual` on `Account` objects ## 2.18.0 - 2019-01-15 - -- [#518](https://github.com/stripe/stripe-python/pull/518) Add configurable telemetry to gather information on client-side request latency +* [#518](https://github.com/stripe/stripe-python/pull/518) Add configurable telemetry to gather information on client-side request latency ## 2.17.0 - 2018-12-21 - -- [#510](https://github.com/stripe/stripe-python/pull/510) Add support for Checkout sessions +* [#510](https://github.com/stripe/stripe-python/pull/510) Add support for Checkout sessions ## 2.16.0 - 2018-12-10 - -- [#507](https://github.com/stripe/stripe-python/pull/507) Add support for account links +* [#507](https://github.com/stripe/stripe-python/pull/507) Add support for account links ## 2.15.0 - 2018-11-30 - -- [#503](https://github.com/stripe/stripe-python/pull/503) Add support for providing custom CA certificate bundle +* [#503](https://github.com/stripe/stripe-python/pull/503) Add support for providing custom CA certificate bundle ## 2.14.0 - 2018-11-28 - -- [#500](https://github.com/stripe/stripe-python/pull/500) Add support for `Review` for Radar +* [#500](https://github.com/stripe/stripe-python/pull/500) Add support for `Review` for Radar ## 2.13.0 - 2018-11-27 - -- [#489](https://github.com/stripe/stripe-python/pull/489) Add support for `ValueList` and `ValueListItem` for Radar +* [#489](https://github.com/stripe/stripe-python/pull/489) Add support for `ValueList` and `ValueListItem` for Radar ## 2.12.1 - 2018-11-22 - -- [#495](https://github.com/stripe/stripe-python/pull/495) Make `StripeResponse` a new-style class +* [#495](https://github.com/stripe/stripe-python/pull/495) Make `StripeResponse` a new-style class ## 2.12.0 - 2018-11-08 - -- [#483](https://github.com/stripe/stripe-python/pull/483) Add new API endpoints for the `Invoice` resource. +* [#483](https://github.com/stripe/stripe-python/pull/483) Add new API endpoints for the `Invoice` resource. ## 2.11.1 - 2018-11-08 - -- [#491](https://github.com/stripe/stripe-python/pull/491) Bump minimum requests version to 2.20.0 (for [CVE-2018-18074](https://nvd.nist.gov/vuln/detail/CVE-2018-18074)) +* [#491](https://github.com/stripe/stripe-python/pull/491) Bump minimum requests version to 2.20.0 (for [CVE-2018-18074](https://nvd.nist.gov/vuln/detail/CVE-2018-18074)) ## 2.11.0 - 2018-10-30 - -- [#482](https://github.com/stripe/stripe-python/pull/482) Add support for the `Person` resource -- [#484](https://github.com/stripe/stripe-python/pull/484) Add support for the `WebhookEndpoint` resource +* [#482](https://github.com/stripe/stripe-python/pull/482) Add support for the `Person` resource +* [#484](https://github.com/stripe/stripe-python/pull/484) Add support for the `WebhookEndpoint` resource ## 2.10.1 - 2018-10-02 - -- [#481](https://github.com/stripe/stripe-python/pull/481) Correct behavior of `stripe.max_network_retries` if it's reset after initial use +* [#481](https://github.com/stripe/stripe-python/pull/481) Correct behavior of `stripe.max_network_retries` if it's reset after initial use ## 2.10.0 - 2018-09-24 - -- [#478](https://github.com/stripe/stripe-python/pull/478) Add support for Stripe Terminal +* [#478](https://github.com/stripe/stripe-python/pull/478) Add support for Stripe Terminal ## 2.9.0 - 2018-09-24 - -- [#477](https://github.com/stripe/stripe-python/pull/477) Rename `FileUpload` to `File` +* [#477](https://github.com/stripe/stripe-python/pull/477) Rename `FileUpload` to `File` ## 2.8.1 - 2018-09-13 - -- [#474](https://github.com/stripe/stripe-python/pull/474) Don't URL-encode square brackets -- [#473](https://github.com/stripe/stripe-python/pull/473) Integer-index encode all arrays +* [#474](https://github.com/stripe/stripe-python/pull/474) Don't URL-encode square brackets +* [#473](https://github.com/stripe/stripe-python/pull/473) Integer-index encode all arrays ## 2.8.0 - 2018-09-10 - -- [#470](https://github.com/stripe/stripe-python/pull/470) Add support for automatic network retries +* [#470](https://github.com/stripe/stripe-python/pull/470) Add support for automatic network retries ## 2.7.0 - 2018-09-05 - -- [#469](https://github.com/stripe/stripe-python/pull/469) Add support for reporting resources +* [#469](https://github.com/stripe/stripe-python/pull/469) Add support for reporting resources ## 2.6.0 - 2018-08-23 - -- [#467](https://github.com/stripe/stripe-python/pull/467) Add support for usage record summaries +* [#467](https://github.com/stripe/stripe-python/pull/467) Add support for usage record summaries ## 2.5.0 - 2018-08-16 - -- [#463](https://github.com/stripe/stripe-python/pull/463) Remove unsupported Bitcoin endpoints (this is technically a breaking change, but we're releasing as a minor version because none of these APIs were usable anyway) +* [#463](https://github.com/stripe/stripe-python/pull/463) Remove unsupported Bitcoin endpoints (this is technically a breaking change, but we're releasing as a minor version because none of these APIs were usable anyway) ## 2.4.0 - 2018-08-03 - -- [#460](https://github.com/stripe/stripe-python/pull/460) Add cancel support for topups -- [#461](https://github.com/stripe/stripe-python/pull/461) Add support for file links +* [#460](https://github.com/stripe/stripe-python/pull/460) Add cancel support for topups +* [#461](https://github.com/stripe/stripe-python/pull/461) Add support for file links ## 2.3.0 - 2018-07-27 - -- [#456](https://github.com/stripe/stripe-python/pull/456) Add support for Sigma scheduled query run objects +* [#456](https://github.com/stripe/stripe-python/pull/456) Add support for Sigma scheduled query run objects ## 2.2.0 - 2018-07-26 - -- [#455](https://github.com/stripe/stripe-python/pull/455) Add support for Stripe Issuing +* [#455](https://github.com/stripe/stripe-python/pull/455) Add support for Stripe Issuing ## 2.1.0 - 2018-07-25 - -- [#452](https://github.com/stripe/stripe-python/pull/452) Add `InvoiceLineItem` class +* [#452](https://github.com/stripe/stripe-python/pull/452) Add `InvoiceLineItem` class ## 2.0.3 - 2018-07-19 - -- [#450](https://github.com/stripe/stripe-python/pull/450) Internal improvements to `ApiResource.class_url` +* [#450](https://github.com/stripe/stripe-python/pull/450) Internal improvements to `ApiResource.class_url` ## 2.0.2 - 2018-07-18 - -- [#448](https://github.com/stripe/stripe-python/pull/448) Avoid duplicate dependency on `requests` with Python 2.7 +* [#448](https://github.com/stripe/stripe-python/pull/448) Avoid duplicate dependency on `requests` with Python 2.7 ## 2.0.1 - 2018-07-10 - -- [#445](https://github.com/stripe/stripe-python/pull/445) Fix `setup.py` +* [#445](https://github.com/stripe/stripe-python/pull/445) Fix `setup.py` ## 2.0.0 - 2018-07-10 - Major version release. List of backwards incompatible changes to watch out for: - -- The minimum Python versions are now 2.7 / 3.4. If you're using Python 2.6 or 3.3, consider upgrading to a more recent version. -- Stripe exception classes should now be accessed via `stripe.error` rather than just `stripe` -- Some older deprecated methods have been removed -- Trying to detach an unattached source will now raise a `stripe.error.InvalidRequestError` exception instead of a `NotImplementedError` exception +* The minimum Python versions are now 2.7 / 3.4. If you're using Python 2.6 or 3.3, consider upgrading to a more recent version. +* Stripe exception classes should now be accessed via `stripe.error` rather than just `stripe` +* Some older deprecated methods have been removed +* Trying to detach an unattached source will now raise a `stripe.error.InvalidRequestError` exception instead of a `NotImplementedError` exception For more information, check out the [migration guide for v2](https://github.com/stripe/stripe-python/wiki/Migration-guide-for-v2) Pull requests included in this release: - -- [#385](https://github.com/stripe/stripe-python/pull/385) Drop support for Python 2.6 and 3.3 -- [#384](https://github.com/stripe/stripe-python/pull/384) Use py.test for tests -- [#399](https://github.com/stripe/stripe-python/pull/399) Remove deprecated code -- [#402](https://github.com/stripe/stripe-python/pull/402) Remove `util.json` and use `json` module directly everywhere -- [#403](https://github.com/stripe/stripe-python/pull/403) Update setup.py and test flow -- [#410](https://github.com/stripe/stripe-python/pull/410) Use pipenv -- [#415](https://github.com/stripe/stripe-python/pull/415) Change exception when detaching unattached sources from `NotImplementedError` to `stripe.error.InvalidRequestError` +* [#385](https://github.com/stripe/stripe-python/pull/385) Drop support for Python 2.6 and 3.3 +* [#384](https://github.com/stripe/stripe-python/pull/384) Use py.test for tests +* [#399](https://github.com/stripe/stripe-python/pull/399) Remove deprecated code +* [#402](https://github.com/stripe/stripe-python/pull/402) Remove `util.json` and use `json` module directly everywhere +* [#403](https://github.com/stripe/stripe-python/pull/403) Update setup.py and test flow +* [#410](https://github.com/stripe/stripe-python/pull/410) Use pipenv +* [#415](https://github.com/stripe/stripe-python/pull/415) Change exception when detaching unattached sources from `NotImplementedError` to `stripe.error.InvalidRequestError` ## 1.84.2 - 2018-07-06 - -- [#441](https://github.com/stripe/stripe-python/pull/441) Better (hopefully) fix for serialization of empty `ListObject`s +* [#441](https://github.com/stripe/stripe-python/pull/441) Better (hopefully) fix for serialization of empty `ListObject`s ## 1.84.1 - 2018-07-04 - -- [#439](https://github.com/stripe/stripe-python/pull/439) Fix serialization of empty `ListObject`s +* [#439](https://github.com/stripe/stripe-python/pull/439) Fix serialization of empty `ListObject`s ## 1.84.0 - 2018-06-29 - -- [#436](https://github.com/stripe/stripe-python/pull/436) Add support for payment intents +* [#436](https://github.com/stripe/stripe-python/pull/436) Add support for payment intents ## 1.83.0 - 2018-06-28 - -- [#437](https://github.com/stripe/stripe-python/pull/437) Add support for `partner_id` in `stripe.set_app_info()` +* [#437](https://github.com/stripe/stripe-python/pull/437) Add support for `partner_id` in `stripe.set_app_info()` ## 1.82.2 - 2018-06-19 - -- [#365](https://github.com/stripe/stripe-python/pull/365) Add `__repr__` methods to `StripeError` exception classes +* [#365](https://github.com/stripe/stripe-python/pull/365) Add `__repr__` methods to `StripeError` exception classes ## 1.82.1 - 2018-05-14 - -- [#430](https://github.com/stripe/stripe-python/pull/430) Handle the case where request ID is `None` when formatting errors +* [#430](https://github.com/stripe/stripe-python/pull/430) Handle the case where request ID is `None` when formatting errors ## 1.82.0 - 2018-05-13 - -- [#422](https://github.com/stripe/stripe-python/pull/422) Add `user_mesage` to `StripeError` for a way in Python 3 to avoid the "Request req\_...:" string normally appended to error messages +* [#422](https://github.com/stripe/stripe-python/pull/422) Add `user_mesage` to `StripeError` for a way in Python 3 to avoid the "Request req_...:" string normally appended to error messages ## 1.81.0 - 2018-05-10 - -- [#425](https://github.com/stripe/stripe-python/pull/425) Add support for issuer fraud records +* [#425](https://github.com/stripe/stripe-python/pull/425) Add support for issuer fraud records ## 1.80.0 - 2018-04-24 - -- [#421](https://github.com/stripe/stripe-python/pull/421) Add support for flexible billing and usage records +* [#421](https://github.com/stripe/stripe-python/pull/421) Add support for flexible billing and usage records ## 1.79.1 - 2018-02-27 - -- [#401](https://github.com/stripe/stripe-python/pull/401) Drop conditional dependencies that incorrectly led to an added `simplejson` dependency in Python 3+ after switching to universal wheel +* [#401](https://github.com/stripe/stripe-python/pull/401) Drop conditional dependencies that incorrectly led to an added `simplejson` dependency in Python 3+ after switching to universal wheel ## 1.79.0 - 2018-02-23 - -- [#397](https://github.com/stripe/stripe-python/pull/397) Build universal wheels by default -- [#398](https://github.com/stripe/stripe-python/pull/398) Add support for `code` attribute on all Stripe exceptions +* [#397](https://github.com/stripe/stripe-python/pull/397) Build universal wheels by default +* [#398](https://github.com/stripe/stripe-python/pull/398) Add support for `code` attribute on all Stripe exceptions ## 1.78.0 - 2018-02-21 - -- [#396](https://github.com/stripe/stripe-python/pull/396) Add support for topups +* [#396](https://github.com/stripe/stripe-python/pull/396) Add support for topups ## 1.77.2 - 2018-02-08 - -- [#394](https://github.com/stripe/stripe-python/pull/394) Make `last_response` available after calling `save()` +* [#394](https://github.com/stripe/stripe-python/pull/394) Make `last_response` available after calling `save()` ## 1.77.1 - 2018-01-12 - -- [#389](https://github.com/stripe/stripe-python/pull/389) Register unsaved attributes on assignment regardless of new value +* [#389](https://github.com/stripe/stripe-python/pull/389) Register unsaved attributes on assignment regardless of new value ## 1.77.0 - 2017-12-21 - -- [#371](https://github.com/stripe/stripe-python/pull/371) Add accessor `last_response` on `StripeObject` for accessing request ID and other metadata +* [#371](https://github.com/stripe/stripe-python/pull/371) Add accessor `last_response` on `StripeObject` for accessing request ID and other metadata ## 1.76.0 - 2017-12-21 - -- [#382](https://github.com/stripe/stripe-python/pull/382) Add new `IdempotencyError` type +* [#382](https://github.com/stripe/stripe-python/pull/382) Add new `IdempotencyError` type ## 1.75.3 - 2017-12-05 - -- [#378](https://github.com/stripe/stripe-python/pull/378) Log encoded version of parameters instead of raw POST data +* [#378](https://github.com/stripe/stripe-python/pull/378) Log encoded version of parameters instead of raw POST data ## 1.75.2 - 2017-12-05 - -- (Accidental no-op release. See 1.75.3.) +* (Accidental no-op release. See 1.75.3.) ## 1.75.1 - 2017-11-29 - -- [#372](https://github.com/stripe/stripe-python/pull/372) Add only changed values to `_unsaved_values` in `StripeObject` -- [#375](https://github.com/stripe/stripe-python/pull/375) Use a custom JSON encoder to handle `datetime` objects when serializing `StripeObject`s +* [#372](https://github.com/stripe/stripe-python/pull/372) Add only changed values to `_unsaved_values` in `StripeObject` +* [#375](https://github.com/stripe/stripe-python/pull/375) Use a custom JSON encoder to handle `datetime` objects when serializing `StripeObject`s ## 1.75.0 - 2017-11-08 - -- [#369](https://github.com/stripe/stripe-python/pull/369) Make custom actions on various resources (e.g. `Account.reject`) more consistent with other APIs +* [#369](https://github.com/stripe/stripe-python/pull/369) Make custom actions on various resources (e.g. `Account.reject`) more consistent with other APIs ## 1.74.0 - 2017-11-07 - -- [#368](https://github.com/stripe/stripe-python/pull/368) Remove API that allowed the creation of new disputes (this was an erroneous addition; it never worked because the API would not allow it) +* [#368](https://github.com/stripe/stripe-python/pull/368) Remove API that allowed the creation of new disputes (this was an erroneous addition; it never worked because the API would not allow it) ## 1.73.0 - 2017-11-02 - -- [#364](https://github.com/stripe/stripe-python/pull/364) Switch to vendored version of the `six` package for compatibility between Python 2 and 3 +* [#364](https://github.com/stripe/stripe-python/pull/364) Switch to vendored version of the `six` package for compatibility between Python 2 and 3 ## 1.72.0 - 2017-10-31 - -- [#361](https://github.com/stripe/stripe-python/pull/361) Support for exchange rates APIs +* [#361](https://github.com/stripe/stripe-python/pull/361) Support for exchange rates APIs ## 1.71.2 - 2017-10-31 - -- [#362](https://github.com/stripe/stripe-python/pull/362) Fix balance transaction and invoice item conversion into `StripeObject`s +* [#362](https://github.com/stripe/stripe-python/pull/362) Fix balance transaction and invoice item conversion into `StripeObject`s ## 1.71.1 - 2017-10-27 - -- [#360](https://github.com/stripe/stripe-python/pull/360) Fix `BytesWarning` being issued on logging in Python 3 +* [#360](https://github.com/stripe/stripe-python/pull/360) Fix `BytesWarning` being issued on logging in Python 3 ## 1.71.0 - 2017-10-26 - -- [#359](https://github.com/stripe/stripe-python/pull/359) Support for listing source transactions +* [#359](https://github.com/stripe/stripe-python/pull/359) Support for listing source transactions ## 1.70.0 - 2017-10-23 - -- [#356](https://github.com/stripe/stripe-python/pull/356) Support uploading files with `StringIO` in addition to a file on disk +* [#356](https://github.com/stripe/stripe-python/pull/356) Support uploading files with `StringIO` in addition to a file on disk ## 1.69.0 - 2017-10-20 - -- [#351](https://github.com/stripe/stripe-python/pull/351) Break resource.py module into separate ones for each type of resource - - Classes are still into resource.py for backwards compatibility -- [#353](https://github.com/stripe/stripe-python/pull/353) Fix unpickling `StripeObject` in Python 3 +* [#351](https://github.com/stripe/stripe-python/pull/351) Break resource.py module into separate ones for each type of resource + * Classes are still into resource.py for backwards compatibility +* [#353](https://github.com/stripe/stripe-python/pull/353) Fix unpickling `StripeObject` in Python 3 ## 1.68.0 - 2017-10-19 - -- [#350](https://github.com/stripe/stripe-python/pull/350) Add static methods to manipulate resources from parent - - `Account` gains methods for external accounts and login links (e.g. `.create_account`, `create_login_link`) - - `ApplicationFee` gains methods for refunds - - `Customer` gains methods for sources - - `Transfer` gains methods for reversals +* [#350](https://github.com/stripe/stripe-python/pull/350) Add static methods to manipulate resources from parent + * `Account` gains methods for external accounts and login links (e.g. `.create_account`, `create_login_link`) + * `ApplicationFee` gains methods for refunds + * `Customer` gains methods for sources + * `Transfer` gains methods for reversals ## 1.67.0 - 2017-10-11 - -- [#349](https://github.com/stripe/stripe-python/pull/349) Rename source `delete` to `detach` (and deprecate the former) +* [#349](https://github.com/stripe/stripe-python/pull/349) Rename source `delete` to `detach` (and deprecate the former) ## 1.66.0 - 2017-09-29 - -- Support length reads on list objects +* Support length reads on list objects ## 1.65.1 - 2017-09-21 - -- Handle `bytearray` and `bytes` (in addition to string) in `Webhook.construct_event` +* Handle `bytearray` and `bytes` (in addition to string) in `Webhook.construct_event` ## 1.65.0 - 2017-09-07 - -- Add support for passing a `stripe_version` argument to all API requests +* Add support for passing a `stripe_version` argument to all API requests ## 1.64.0 - 2017-09-01 - -- Error when an invalid type (i.e. non-string) passed as an API method argument +* Error when an invalid type (i.e. non-string) passed as an API method argument ## 1.63.1 - 2017-09-01 - -- Fix serialization of `items` on Relay order creation and order return +* Fix serialization of `items` on Relay order creation and order return ## 1.63.0 - 2017-08-29 - -- Add support for `InvalidClientError` OAuth error +* Add support for `InvalidClientError` OAuth error ## 1.62.1 - 2017-08-07 - -- Change serialization of subscription items on update to encoded as an integer-indexed map +* Change serialization of subscription items on update to encoded as an integer-indexed map ## 1.62.0 - 2017-06-27 - -- `pay` on invoice can now take parameter +* `pay` on invoice can now take parameter ## 1.61.0 - 2017-06-24 - -- Expose `code` on `InvalidRequestError` +* Expose `code` on `InvalidRequestError` ## 1.60.0 - 2017-06-19 - -- Add support for ephemeral keys +* Add support for ephemeral keys ## 1.59.0 - 2017-06-07 - -- Refactor OAuth implementation to have dedicated classes for errors +* Refactor OAuth implementation to have dedicated classes for errors ## 1.58.0 - 2017-06-02 - -- Re-use connections with Pycurl +* Re-use connections with Pycurl ## 1.57.1 - 2017-05-31 - -- Fix the pycurl client +* Fix the pycurl client ## 1.57.0 - 2017-05-26 - -- Add `api_key` parameter to webhook's `construct_event` +* Add `api_key` parameter to webhook's `construct_event` ## 1.56.0 - 2017-05-25 - -- Add support for account login links +* Add support for account login links ## 1.55.2 - 2017-05-11 - -- Remove Requests constraint from 1.55.1 now that they've patched (as of 2.14.2) +* Remove Requests constraint from 1.55.1 now that they've patched (as of 2.14.2) ## 1.55.1 - 2017-05-10 - -- Constrain Requests to < 2.13.0 if on setuptools < 18.0.0 +* Constrain Requests to < 2.13.0 if on setuptools < 18.0.0 ## 1.55.0 - 2017-04-28 - -- Support for checking webhook signatures +* Support for checking webhook signatures ## 1.54.0 - 2017-04-28 - -- Add `stripe.set_app_info` for use by plugin creators +* Add `stripe.set_app_info` for use by plugin creators ## 1.53.0 - 2017-04-06 - -- Add support for payouts and recipient transfers +* Add support for payouts and recipient transfers ## 1.52.0 - 2017-04-06 - -- No-op release: peg test suite to a specific API version +* No-op release: peg test suite to a specific API version ## 1.51.0 - 2017-03-20 - -- Support OAuth operations (getting a token and deauthorizing) +* Support OAuth operations (getting a token and deauthorizing) ## 1.50.0 - 2017-03-17 - -- Support for detaching sources from customers +* Support for detaching sources from customers ## 1.49.0 - 2017-03-13 - -- Accept `session` argument for `RequestsClient` +* Accept `session` argument for `RequestsClient` ## 1.48.1 - 2017-02-21 - -- Fix encoding of parameters when fetching upcoming invoices +* Fix encoding of parameters when fetching upcoming invoices ## 1.48.0 - 2017-02-21 - -- Add `Account.modify_external_account` to modify an account in one API call -- Add `Customer.modify_source` to modify a source in one API call +* Add `Account.modify_external_account` to modify an account in one API call +* Add `Customer.modify_source` to modify a source in one API call ## 1.47.0 - 2017-01-18 - -- Allow sources to be updated +* Allow sources to be updated ## 1.46.0 - 2017-01-06 - -- Use internal session for Requests for connection pooling +* Use internal session for Requests for connection pooling ## 1.45.0 - 2017-01-06 - -- request logging goes to stderr now -- Logs properly handle unicode -- Format is now the same between logging logs, and console logs +* request logging goes to stderr now +* Logs properly handle unicode +* Format is now the same between logging logs, and console logs ## 1.44.0 - 2016-12-16 - -- Add request logging and some mechanisms to enable it when debugging +* Add request logging and some mechanisms to enable it when debugging ## 1.43.0 - 2016-11-30 - -- Add support for verifying sources +* Add support for verifying sources ## 1.42.0 - 2016-11-21 - -- Add retrieve method for 3-D Secure resources +* Add retrieve method for 3-D Secure resources ## 1.41.1 - 2016-10-26 - -- Implement **copy** and **deepcopy** on StripeObject to fix these operations +* Implement __copy__ and __deepcopy__ on StripeObject to fix these operations ## 1.41.0 - 2016-10-12 - -- Add `Source` model for generic payment sources +* Add `Source` model for generic payment sources ## 1.40.1 - 2016-10-10 - -- Return subscription model instance on subscription create/modify +* Return subscription model instance on subscription create/modify ## 1.40.0 - 2016-10-07 - -- Add configurable timeout for Requests HTTP library +* Add configurable timeout for Requests HTTP library ## 1.39.0 - 2016-10-06 - -- Add support for subscription items -- Add proxy support for pycurl, Requests, urlfetch, and urllib2 libraries +* Add support for subscription items +* Add proxy support for pycurl, Requests, urlfetch, and urllib2 libraries ## 1.38.0 - 2016-09-15 - -- Add support for Apple Pay domains +* Add support for Apple Pay domains ## 1.37.0 - 2016-07-12 - -- Add `ThreeDSecure` model for 3-D secure payments +* Add `ThreeDSecure` model for 3-D secure payments ## 1.36.0 - 2016-06-29 - -- Add `update` class method to resources that can be updated +* Add `update` class method to resources that can be updated ## 1.35.0 - 2016-05-24 - -- Add support for returning Relay orders +* Add support for returning Relay orders ## 1.34.0 - 2016-05-20 - -- Add support for Alipay accounts +* Add support for Alipay accounts ## 1.33.0 - 2016-05-04 - -- Add support for the new `/v1/subscriptions` endpoint - - `stripe.Subscription.retrieve` - - `stripe.Subscription.update` - - `stripe.Subscription.create` - - `stripe.Subscription.list` +* Add support for the new `/v1/subscriptions` endpoint + * `stripe.Subscription.retrieve` + * `stripe.Subscription.update` + * `stripe.Subscription.create` + * `stripe.Subscription.list` ## 1.32.2 - 2016-04-12 - -- Fix bug where file uploads could not be properly listed +* Fix bug where file uploads could not be properly listed ## 1.32.1 - 2016-04-11 - -- Fix bug where request parameters were not passed between pages with `auto_paging_iter` +* Fix bug where request parameters were not passed between pages with `auto_paging_iter` ## 1.32.0 - 2016-03-31 - -- Update CA cert bundle for compatibility with OpenSSL versions below 1.0.1 +* Update CA cert bundle for compatibility with OpenSSL versions below 1.0.1 ## 1.31.1 - 2016-03-24 - -- Fix uploading of binary files in Python 3 +* Fix uploading of binary files in Python 3 ## 1.31.0 - 2016-03-15 - -- Add `reject` on `Account` to support the new API feature +* Add `reject` on `Account` to support the new API feature ## 1.30.0 - 2016-02-27 - -- Add `CountrySpec` model for looking up country payment information +* Add `CountrySpec` model for looking up country payment information ## 1.29.1 - 2016-02-01 - -- Update bundled CA certs +* Update bundled CA certs ## 1.29.0 - 2016-01-26 - -- Add support for deleting Relay products and SKUs +* Add support for deleting Relay products and SKUs ## 1.28.0 - 2016-01-04 - -- Add an automatic paginating iterator to lists available via `auto_paging_iter` -- List objects are now iterable -- Error messages set to `None` are now handled properly -- The `all` method on list objects has been deprecated in favor of `list` -- Calls to `instance_url` are now side effect free +* Add an automatic paginating iterator to lists available via `auto_paging_iter` +* List objects are now iterable +* Error messages set to `None` are now handled properly +* The `all` method on list objects has been deprecated in favor of `list` +* Calls to `instance_url` are now side effect free ## 1.27.1 - 2015-10-02 - -- Official Python 3.4 & 3.5 compatibility -- Add configurable HTTP client -- Add ability to delete attributes +* Official Python 3.4 & 3.5 compatibility +* Add configurable HTTP client +* Add ability to delete attributes ## 1.27.0 - 2015-09-14 - -- Products, SKUs, Orders resources +* Products, SKUs, Orders resources ## 1.26.0 - 2015-09-11 - -- Add support for new 429 rate limit response +* Add support for new 429 rate limit response ## 1.25.0 - 2015-08-17 - -- Added refund listing, creation and retrieval +* Added refund listing, creation and retrieval ## 1.24.1 - 2015-08-05 - -- Fix error handling for Python 2.6 +* Fix error handling for Python 2.6 ## 1.24.0 - 2015-08-03 - -- Managed accounts can now be deleted -- Added dispute listing and retrieval +* Managed accounts can now be deleted +* Added dispute listing and retrieval ## 1.23.0 - 2015-07-06 - -- Include response headers in exceptions +* Include response headers in exceptions ## 1.22.3 - 2015-06-04 - -- Fix saving `additional_owners` on managed accounts +* Fix saving `additional_owners` on managed accounts ## 1.22.2 - 2015-04-08 - -- Fix saving manage accounts +* Fix saving manage accounts ## 1.22.1 - 2015-03-30 - -- Pass `stripe_account` to Balance.retrieve +* Pass `stripe_account` to Balance.retrieve ## 1.22.0 - 2015-03-22 - -- Added methods for updating and saving arrays of objects +* Added methods for updating and saving arrays of objects ## 1.21.0 - 2015-02-19 - -- Added Bitcoin Receiver update and delete methods +* Added Bitcoin Receiver update and delete methods ## 1.20.2 - 2015-01-21 - -- Remove support for top-level bitcoin transactions +* Remove support for top-level bitcoin transactions ## 1.20.1 - 2015-01-07 - -- Adding bitcoin receiver and transaction objects +* Adding bitcoin receiver and transaction objects ## 1.20.0 - 2014-12-23 - -- Adding support for file uploads resource +* Adding support for file uploads resource ## 1.19.1 - 2014-10-23 - -- Remove redundant manual SSL blacklist preflight check +* Remove redundant manual SSL blacklist preflight check ## 1.19.0 - 2014-07-26 - -- Application Fee refunds now a list instead of array +* Application Fee refunds now a list instead of array ## 1.18.0 - 2014-06-17 - -- Add metadata for disputes and refunds +* Add metadata for disputes and refunds ## 1.17.0 - 2014-06-10 - -- Remove official support for Python 2.5 +* Remove official support for Python 2.5 ## 1.16.0 - 2014-05-28 - -- Support for canceling transfers +* Support for canceling transfers ## 1.15.1 - 2014-05-21 - -- Support cards for recipients. +* Support cards for recipients. ## 1.14.1 - 2014-05-19 - -- Disable loading the ssl module on the Google App Engine dev server. +* Disable loading the ssl module on the Google App Engine dev server. ## 1.14.0 - 2014-04-09 - -- Use DER encoded certificate for checksumming -- Don't rely on SNI support in integration tests +* Use DER encoded certificate for checksumming +* Don't rely on SNI support in integration tests ## 1.13.0 - 2014-04-09 - -- Update bundled ca-certificates -- Add certificate blacklist for CVE-2014-0160 mitigation +* Update bundled ca-certificates +* Add certificate blacklist for CVE-2014-0160 mitigation ## 1.12.2 - 2014-03-13 - -- Fix syntax errors in setup.py metadata +* Fix syntax errors in setup.py metadata ## 1.12.1 - 2014-03-13 - -- Added license and other metadata in setup.py -- Fix `__repr__` in Python 3 -- Support pickling of responses +* Added license and other metadata in setup.py +* Fix `__repr__` in Python 3 +* Support pickling of responses ## 1.12.0 - 2014-01-29 - -- Added support for multiple subscriptions per customer +* Added support for multiple subscriptions per customer ## 1.11.0 - 2013-12-05 - -- Added extensive unit tests -- Extended functional test coverage -- Refactored code into modules and out of stripe/**init**.py -- Abstracted http library selection and use from the `APIRequestor` into `stripe.http_client` -- Refactored `StripeObject` to inherit from `dict` and avoid direct access of `__dict__`. -- PEP8ified the codebase and enforced with a test. -- Proper encoding of timezone aware datetimes +* Added extensive unit tests +* Extended functional test coverage +* Refactored code into modules and out of stripe/__init__.py +* Abstracted http library selection and use from the `APIRequestor` into `stripe.http_client` +* Refactored `StripeObject` to inherit from `dict` and avoid direct access of `__dict__`. +* PEP8ified the codebase and enforced with a test. +* Proper encoding of timezone aware datetimes ## 1.10.8 - 2013-12-02 - -- Add stripe.ApplicationFee resource +* Add stripe.ApplicationFee resource ## 1.9.8 - 2013-10-17 - -- Removed incorrect test. +* Removed incorrect test. ## 1.9.7 - 2013-10-10 - -- Add support for metadata. +* Add support for metadata. ## 1.9.6 - 2013-10-08 - -- Fix issue with support for closing disputes. +* Fix issue with support for closing disputes. ## 1.9.5 - 2013-09-18 - -- Add support for closing disputes. +* Add support for closing disputes. ## 1.9.4 - 2013-08-13 - -- Add stripe.Balance and stripe.BalanceTransaction resources +* Add stripe.Balance and stripe.BalanceTransaction resources ## 1.9.3 - 2013-08-12 - -- Add support for unsetting attributes by setting to None. - Setting properties to a blank string is now an error. +* Add support for unsetting attributes by setting to None. + Setting properties to a blank string is now an error. ## 1.9.2 - 2013-07-12 - -- Add support for multiple cards API +* Add support for multiple cards API ## 1.9.1 - 2013-05-03 - -- Remove 'id' from the list of permanent attributes +* Remove 'id' from the list of permanent attributes ## 1.9.0 - 2013-04-25 - -- Support for Python 3 (github issue #32) +* Support for Python 3 (github issue #32) ## 1.8.0 - 2013-04-11 - -- Allow transfers to be creatable -- Add new stripe.Recipient resource +* Allow transfers to be creatable +* Add new stripe.Recipient resource ## 1.7.10 - 2013-02-21 - -- Add 'id' to the list of permanent attributes +* Add 'id' to the list of permanent attributes ## 1.7.9 - 2013-02-01 - -- Add support for passing options when retrieving Stripe objects; e.g., stripe.Charge.retrieve("foo", params={"expand":["customer"]}) +* Add support for passing options when retrieving Stripe objects; e.g., stripe.Charge.retrieve("foo", params={"expand":["customer"]}) ## 1.7.8 - 2013-01-15 - -- Add support for setting a Stripe API version override +* Add support for setting a Stripe API version override ## 1.7.7 - 2012-12-18 - -- Update requests version check to work with requests 1.x.x (github issue #24) +* Update requests version check to work with requests 1.x.x (github issue #24) ## 1.7.6 - 2012-11-08 - -- Add support for updating charge disputes +* Add support for updating charge disputes ## 1.7.5 - 2012-10-30 - -- Add support for creating invoices -- Add support for new invoice lines return format -- Add support for new List objects +* Add support for creating invoices +* Add support for new invoice lines return format +* Add support for new List objects ## 1.7.4 - 2012-08-31 - -- Add update and pay methods for Invoice resource +* Add update and pay methods for Invoice resource ## 1.7.3 - 2012-08-15 - -- Add new stripe.Account resource -- Remove uncaptured_charge tests (this has been deprecated from the API). +* Add new stripe.Account resource +* Remove uncaptured_charge tests (this has been deprecated from the API). ## 1.7.2 - 2012-05-31 - -- Fix a bug that would cause nested objects to be mis-rendered in **str** and **repr** methods (github issues #17, #18) +* Fix a bug that would cause nested objects to be mis-rendered in __str__ and __repr__ methods (github issues #17, #18) ## 1.7.1 - 2012-05-21 - -- Prefer App Engine's urlfetch over requests, as that's the only thing that will work in App Engine's environment. Previously, if requests was available in the App Engine environment, we would attempt to use it. +* Prefer App Engine's urlfetch over requests, as that's the only thing that will work in App Engine's environment. Previously, if requests was available in the App Engine environment, we would attempt to use it. ## 1.7.0 - 2012-05-17 - -- Add new delete_discount method to stripe.Customer -- Add new stripe.Transfer resource -- Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will support Basic auth for the indefinite future, but recommends Bearer auth when possible going forward) -- Numerous test suite improvements +* Add new delete_discount method to stripe.Customer +* Add new stripe.Transfer resource +* Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will support Basic auth for the indefinite future, but recommends Bearer auth when possible going forward) +* Numerous test suite improvements ## 1.6.1 - 2011-09-14 +* Parameters with value None are no longer included in API requests -- Parameters with value None are no longer included in API requests From a21c55047a0ac656791f5bbf5235afb17be9af4f Mon Sep 17 00:00:00 2001 From: Jesse Rosalia Date: Wed, 2 Oct 2024 15:25:59 -0700 Subject: [PATCH 08/11] disabled format on save for md files --- .vscode/settings.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 24c60026c..59e67bec4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,6 +25,10 @@ } }, + "[markdown]": { + "editor.formatOnSave": false, + }, + // Tests "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, From 95883d6fab06dc3bc23f6234fca1c51f51cee5ea Mon Sep 17 00:00:00 2001 From: Jesse Rosalia Date: Wed, 2 Oct 2024 15:55:05 -0700 Subject: [PATCH 09/11] reverted auto formatting --- CHANGELOG.md | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72d630a2a..47331177c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,37 +1,5 @@ # Changelog -## 11.0.0 - 2024-10-01 -* [#1404](https://github.com/stripe/stripe-python/pull/1404) Support for APIs in the new API version 2024-09-30.acacia - - This release changes the pinned API version to `2024-09-30.acacia`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-09-30.acacia) and carefully review the API changes before upgrading. - - ### ⚠️ Breaking changes due to changes in the API - - - * Rename for `usage_threshold_config` to `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` - * Remove support for `filter` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert`. Use the filters on the `usage_threshold` instead - * * Remove support for `customer_consent_collected` on parameter class `stripe.terminal.Reader.ProcessSetupIntentParams` - - ### ⚠️ Other Breaking changes in the SDK - * Adjusted default values for HTTP requests. You can use the old defaults by setting them explicitly. New values are: - - max retries: `0` -> `2` - - max timeout (seconds): `2` -> `5` - * Add method `parse_thin_event()` on the `StripeClient` class to parse [thin events](https://docs.corp.stripe.com/event-destinations#events-overview). Rename `construct_event()` method on the same class to `parse_snapshot_event()` to clearly distinguish between the two kinds of events. - - ### Additions - - * Add support for `custom_unit_amount` on parameter class `stripe.Product.CreateParamsDefaultPriceData` - * Add support for `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` - * Add support for `allow_redisplay` on parameter classes `stripe.terminal.Reader.ProcessPaymentIntentParamsProcessConfig` and `stripe.terminal.Reader.ProcessSetupIntentParams` - * Add support for `international_transaction` on enum `stripe.treasury.ReceivedCredit.failure_code` - * Add support for `2024-09-30.acacia` on enum `stripe.WebhookEndpoint.CreateParams.api_version` - * Add support for new Usage Billing APIs `stripe.v2.billing.MeterEvent`, `stripe.v2.billing.MeterEventAdjustments`, `stripe.v2.billing.MeterEventSession`, `stripe.v2.billing.MeterEventStream` and the new Events API `stripe.v2.core.Events` under the [v2 namespace ](https://docs.corp.stripe.com/api-v2-overview) - * Add method [rawRequest()](https://github.com/stripe/stripe-python/tree/master?tab=readme-ov-file#custom-requests) on the `StripeClient` class that takes a HTTP method type, url and relevant parameters to make requests to the Stripe API that are not yet supported in the SDK. - - ### Other changes - * Change type of `default_allowed_updates` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Literal['price', 'promotion_code', 'quantity']]]` to `NotRequired[Literal['']|List[Literal['price', 'promotion_code', 'quantity']]]` - * Change type of `products` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` to `NotRequired[Literal['']|List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` - ## 10.13.0b1 - 2024-09-18 * [#1395](https://github.com/stripe/stripe-python/pull/1395) Update generated code for beta * Add support for `send_money` on parameter class `stripe.AccountSession.CreateParamsComponentsFinancialAccountFeatures` @@ -84,7 +52,7 @@ * Add support for `tax_ids` on resource class `stripe.checkout.Session.CollectedInformation` * Add support for `billing.meter_error_report.triggered` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` * Add support for `mb_way` on enums `stripe.PaymentLink.payment_method_types`, `stripe.PaymentLink.CreateParams.payment_method_types`, and `stripe.PaymentLink.ModifyParams.payment_method_types` -* [#1386](https://github.com/stripe/stripe-python/pull/1386) Merge from master +* [#1386](https://github.com/stripe/stripe-python/pull/1386) Merge from master * [#1384](https://github.com/stripe/stripe-python/pull/1384) Merge from master after the changes to not pass api_mode from individual methods * [#1380](https://github.com/stripe/stripe-python/pull/1380) Update generated code for beta * Add support for `email` on resource class `stripe.checkout.Session.CollectedInformation` From 542ac5351f9c42fde1fb2b4975c4ed296947510d Mon Sep 17 00:00:00 2001 From: Jesse Rosalia Date: Wed, 2 Oct 2024 15:56:15 -0700 Subject: [PATCH 10/11] added v11 changelog entries --- CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47331177c..cbb2ddda2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # Changelog +## 11.0.0 - 2024-10-01 +* [#1404](https://github.com/stripe/stripe-python/pull/1404) Support for APIs in the new API version 2024-09-30.acacia + + This release changes the pinned API version to `2024-09-30.acacia`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-09-30.acacia) and carefully review the API changes before upgrading. + + ### ⚠️ Breaking changes due to changes in the API + + + * Rename for `usage_threshold_config` to `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` + * Remove support for `filter` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert`. Use the filters on the `usage_threshold` instead + * * Remove support for `customer_consent_collected` on parameter class `stripe.terminal.Reader.ProcessSetupIntentParams` + + ### ⚠️ Other Breaking changes in the SDK + * Adjusted default values for HTTP requests. You can use the old defaults by setting them explicitly. New values are: + - max retries: `0` -> `2` + - max timeout (seconds): `2` -> `5` + * Add method `parse_thin_event()` on the `StripeClient` class to parse [thin events](https://docs.corp.stripe.com/event-destinations#events-overview). Rename `construct_event()` method on the same class to `parse_snapshot_event()` to clearly distinguish between the two kinds of events. + + ### Additions + + * Add support for `custom_unit_amount` on parameter class `stripe.Product.CreateParamsDefaultPriceData` + * Add support for `usage_threshold` on parameter class `stripe.billing.Alert.CreateParams` and resource `stripe.billing.Alert` + * Add support for `allow_redisplay` on parameter classes `stripe.terminal.Reader.ProcessPaymentIntentParamsProcessConfig` and `stripe.terminal.Reader.ProcessSetupIntentParams` + * Add support for `international_transaction` on enum `stripe.treasury.ReceivedCredit.failure_code` + * Add support for `2024-09-30.acacia` on enum `stripe.WebhookEndpoint.CreateParams.api_version` + * Add support for new Usage Billing APIs `stripe.v2.billing.MeterEvent`, `stripe.v2.billing.MeterEventAdjustments`, `stripe.v2.billing.MeterEventSession`, `stripe.v2.billing.MeterEventStream` and the new Events API `stripe.v2.core.Events` under the [v2 namespace ](https://docs.corp.stripe.com/api-v2-overview) + * Add method [rawRequest()](https://github.com/stripe/stripe-python/tree/master?tab=readme-ov-file#custom-requests) on the `StripeClient` class that takes a HTTP method type, url and relevant parameters to make requests to the Stripe API that are not yet supported in the SDK. + + ### Other changes + * Change type of `default_allowed_updates` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Literal['price', 'promotion_code', 'quantity']]]` to `NotRequired[Literal['']|List[Literal['price', 'promotion_code', 'quantity']]]` + * Change type of `products` on `stripe.billing_portal.Configuration.CreateParamsFeaturesSubscriptionUpdate` from `Union[Literal[''], List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` to `NotRequired[Literal['']|List[Configuration.CreateParamsFeaturesSubscriptionUpdateProduct]]` + ## 10.13.0b1 - 2024-09-18 * [#1395](https://github.com/stripe/stripe-python/pull/1395) Update generated code for beta * Add support for `send_money` on parameter class `stripe.AccountSession.CreateParamsComponentsFinancialAccountFeatures` From 77aaaf2d1088b8bfc8765211058bb5c9fc181268 Mon Sep 17 00:00:00 2001 From: Jesse Rosalia Date: Wed, 2 Oct 2024 15:56:54 -0700 Subject: [PATCH 11/11] disable trim_trailing_whitespace for CHANGELOG.md --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 1c32a5e4c..108bfbbff 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,3 +15,6 @@ indent_size = 2 [Makefile] indent_style = tab + +[CHANGELOG.md] +trim_trailing_whitespace = false