diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e608cf6d..fc592b5bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## 14.4.0 - 2026-02-25 +This release changes the pinned API version to `2026-02-25.clover`. + +* [#1737](https://github.com/stripe/stripe-python/pull/1737) Allow AIOHTTPClient to accept user-provided session or connector. Fixes [#1736](https://github.com/stripe/stripe-python/pull/1736) +* [#1732](https://github.com/stripe/stripe-python/pull/1732) Update generated code + * Add support for new resources `reserve.Hold`, `reserve.Plan`, and `reserve.Release` + * Add support for `location` and `reader` on `Charge.PaymentMethodDetail.CardPresent`, `Charge.PaymentMethodDetail.InteracPresent`, `ConfirmationToken.PaymentMethodPreview.Card.GeneratedFrom.PaymentMethodDetail.CardPresent`, `PaymentAttemptRecord.PaymentMethodDetail.CardPresent`, `PaymentAttemptRecord.PaymentMethodDetail.InteracPresent`, `PaymentMethod.Card.GeneratedFrom.PaymentMethodDetail.CardPresent`, `PaymentRecord.PaymentMethodDetail.CardPresent`, and `PaymentRecord.PaymentMethodDetail.InteracPresent` + * Add support for new value `lk_vat` on enums `Checkout.Session.CustomerDetail.TaxId.type`, `Invoice.CustomerTaxId.type`, `Tax.Calculation.CustomerDetail.TaxId.type`, `Tax.Transaction.CustomerDetail.TaxId.type`, and `TaxId.type` + * Add support for new value `lk_vat` on enums `CustomerCreateParamsTaxIdDatum.type`, `CustomerCreateTaxIdParams.type`, `InvoiceCreatePreviewParamsCustomerDetailTaxId.type`, `TaxIdCreateParams.type`, and `tax.CalculationCreateParamsCustomerDetailTaxId.type` + * Add support for new values `reserve.hold.created`, `reserve.hold.updated`, `reserve.plan.created`, `reserve.plan.disabled`, `reserve.plan.expired`, `reserve.plan.updated`, and `reserve.release.created` on enum `Event.type` + * Add support for new values `terminal_wifi_certificate` and `terminal_wifi_private_key` on enums `File.purpose` and `FileListParams.purpose` + * Add support for new values `terminal_wifi_certificate` and `terminal_wifi_private_key` on enum `FileCreateParams.purpose` + * Add support for new value `pay_by_bank` on enums `Invoice.PaymentSetting.payment_method_types`, `InvoiceCreateParamsPaymentSetting.payment_method_types`, `InvoiceModifyParamsPaymentSetting.payment_method_types`, `Subscription.PaymentSetting.payment_method_types`, `SubscriptionCreateParamsPaymentSetting.payment_method_types`, and `SubscriptionModifyParamsPaymentSetting.payment_method_types` + * Add support for `display_name` and `service_user_number` on `Mandate.PaymentMethodDetail.BacsDebit` + * Change type of `PaymentAttemptRecord.PaymentMethodDetail.Boleto.tax_id` and `PaymentRecord.PaymentMethodDetail.Boleto.tax_id` from `string` to `nullable(string)` + * Change type of `PaymentAttemptRecord.PaymentMethodDetail.UsBankAccount.expected_debit_date` and `PaymentRecord.PaymentMethodDetail.UsBankAccount.expected_debit_date` from `nullable(string)` to `string` + * Add support for `transaction_purpose` on `PaymentIntent.PaymentMethodOption.UsBankAccount`, `PaymentIntentConfirmParamsPaymentMethodOptionUsBankAccount`, `PaymentIntentCreateParamsPaymentMethodOptionUsBankAccount`, and `PaymentIntentModifyParamsPaymentMethodOptionUsBankAccount` + * Add support for `optional_items` on `PaymentLinkModifyParams` + * Remove support for unused `card_issuer_decline` on `Radar.PaymentEvaluation.Insight` + * Add support for `payment_behavior` on `SubscriptionItemDeleteParams` + * Add support for `lk` on `Tax.Registration.CountryOption` and `tax.RegistrationCreateParamsCountryOption` + * Add support for `cellular` and `stripe_s710` on `Terminal.Configuration`, `terminal.ConfigurationCreateParams`, and `terminal.ConfigurationModifyParams` + * Add support for new values `simulated_stripe_s710` and `stripe_s710` on enums `Terminal.Reader.device_type` and `terminal.ReaderListParams.device_type` + * Add support for new values `reserve.hold.created`, `reserve.hold.updated`, `reserve.plan.created`, `reserve.plan.disabled`, `reserve.plan.expired`, `reserve.plan.updated`, and `reserve.release.created` on enums `WebhookEndpointCreateParams.enabled_events` and `WebhookEndpointModifyParams.enabled_events` + * Add support for new value `2026-02-25.clover` on enum `WebhookEndpointCreateParams.api_version` + * Add support for snapshot events `reserve.hold.created` and `reserve.hold.updated` with resource `reserve.Hold` + * Add support for snapshot events `reserve.plan.created`, `reserve.plan.disabled`, `reserve.plan.expired`, and `reserve.plan.updated` with resource `reserve.Plan` + * Add support for snapshot event `reserve.release.created` with resource `reserve.Release` + * Add support for error codes `storer_capability_missing` and `storer_capability_not_active` on `Invoice.LastFinalizationError`, `PaymentIntent.LastPaymentError`, `SetupAttempt.SetupError`, `SetupIntent.LastSetupError`, and `StripeError` +* [#1731](https://github.com/stripe/stripe-python/pull/1731) Added instruction to update CA certificates in README. + ## 14.4.0a4 - 2026-02-19 * [#1734](https://github.com/stripe/stripe-python/pull/1734) Update generated code for private-preview * ⚠️ Add support for new value `spend_threshold` on enums `Billing.Alert.alert_type`, `billing.AlertCreateParams.alert_type`, and `billing.AlertListParams.alert_type` diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index c9b922226..c99d4272f 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -35e26af8c8a4fb5988922dfcb4d9bd22f7f850c5 \ No newline at end of file +e10daa4ed23a4fe87d6ea60836226446e042fdd3 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index ea042559f..58dae7935 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2185 \ No newline at end of file +v2186 \ No newline at end of file diff --git a/stripe/_http_client.py b/stripe/_http_client.py index 62fae3eb9..4fb246523 100644 --- a/stripe/_http_client.py +++ b/stripe/_http_client.py @@ -1401,6 +1401,8 @@ def __init__( self, timeout: Optional[Union[float, "AIOHTTPTimeout"]] = 80, _lib=None, # used for internal unit testing + session=None, + connector=None, **kwargs, ): super(AIOHTTPClient, self).__init__(**kwargs) @@ -1413,25 +1415,33 @@ def __init__( self.aiohttp = _lib self._timeout = timeout + self._user_session = session + self._user_connector = connector + self._internally_managed_session = session is None self._cached_session = None @property def _session(self): if self._cached_session is None: - kwargs = {} - if self._verify_ssl_certs: - ssl_context = ssl.create_default_context( - cafile=stripe.ca_bundle_path - ) - kwargs["connector"] = self.aiohttp.TCPConnector( - ssl=ssl_context - ) + if self._user_session: + self._cached_session = self._user_session else: - kwargs["connector"] = self.aiohttp.TCPConnector( - verify_ssl=False - ) + kwargs = {} + if self._user_connector: + kwargs["connector"] = self._user_connector + elif self._verify_ssl_certs: + ssl_context = ssl.create_default_context( + cafile=stripe.ca_bundle_path + ) + kwargs["connector"] = self.aiohttp.TCPConnector( + ssl=ssl_context + ) + else: + kwargs["connector"] = self.aiohttp.TCPConnector( + verify_ssl=False + ) - self._cached_session = self.aiohttp.ClientSession(**kwargs) + self._cached_session = self.aiohttp.ClientSession(**kwargs) return self._cached_session @@ -1514,7 +1524,8 @@ def close(self): pass async def close_async(self): - await self._session.close() + if self._internally_managed_session: + await self._session.close() class NoImportFoundAsyncClient(HTTPClient):