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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .hark/changes/2026-09-25_stripe-openapi_b25e9708.change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Update generated code
pr_url: https://github.com/stripe/stripe-python/pull/1892
semver_level: major
is_stripe_api_change: true
---

* Add support for new resource `radar.BillingEvaluation`
* Add support for `create` method on resource `radar.BillingEvaluation`
* Add support for `list` method on resource `reserve.Plan`
* Change `Tax.CalculationLineItem.performance_location` and `TaxCode.Requirement.performance_location` to be required
* Change `Account.BusinessProfile.specified_commercial_transactions_act_url` to be required
* Add support for `after_expiration` on `BillingPortal.Session` and `billing_portal.SessionCreateParams`
* Add support for new value `fundbox_ca_financing` on enums `Capital.FinancingOffer.disclaimer_variant` and `Capital.FinancingSummary.Detail.disclaimer_variant`
* Add support for `setup_credential_usage` on `Charge.PaymentMethodDetail.Card`, `PaymentIntent.PaymentMethodOption.Card`, `PaymentIntentConfirmParamsPaymentMethodOptionCard`, `PaymentIntentCreateParamsPaymentMethodOptionCard`, `PaymentIntentModifyParamsPaymentMethodOptionCard`, `SetupIntent.PaymentMethodOption.Card`, `SetupIntentConfirmParamsPaymentMethodOptionCard`, `SetupIntentCreateParamsPaymentMethodOptionCard`, and `SetupIntentModifyParamsPaymentMethodOptionCard`
* Add support for `stored_credential_usage` on `Charge.PaymentMethodDetail.Card`, `PaymentAttemptRecord.PaymentMethodDetail.Card`, `PaymentIntent.PaymentMethodOption.Card`, `PaymentIntentConfirmParamsPaymentMethodOptionCard`, `PaymentIntentCreateParamsPaymentMethodOptionCard`, `PaymentIntentModifyParamsPaymentMethodOptionCard`, and `PaymentRecord.PaymentMethodDetail.Card`
* Add support for `expires_at` on `Subscription.PaymentSetting.PaymentMethodOption.Blik.MandateOption`, `SubscriptionCreateParamsPaymentSettingPaymentMethodOptionBlikMandateOption`, `SubscriptionModifyParamsPaymentSettingPaymentMethodOptionBlikMandateOption`, and `checkout.SessionCreateParamsPaymentMethodOptionBlikMandateOption`
* ⚠️ Remove support for `expires_after` on `Subscription.PaymentSetting.PaymentMethodOption.Blik.MandateOption`, `SubscriptionCreateParamsPaymentSettingPaymentMethodOptionBlikMandateOption`, `SubscriptionModifyParamsPaymentSettingPaymentMethodOptionBlikMandateOption`, and `checkout.SessionCreateParamsPaymentMethodOptionBlikMandateOption`
* ⚠️ Remove support for value `on_session` from enum `checkout.SessionCreateParamsPaymentMethodOptionBlik.setup_future_usage`
* Add support for `payment_intent_data` on `checkout.SessionModifyParams`
* Add support for `appeal` on `Dispute.Evidence` and `DisputeModifyParamsEvidence`
* Add support for `livemode` on `FxQuote`
* ⚠️ Remove support for `capture_method` on `PaymentIntentConfirmParamsPaymentMethodOptionPaypay`, `PaymentIntentCreateParamsPaymentMethodOptionPaypay`, and `PaymentIntentModifyParamsPaymentMethodOptionPaypay`
* Add support for `active` on `ProductCatalog.TrialOffer`, `product_catalog.TrialOfferCreateParams`, and `product_catalog.TrialOfferListParams`
* Add support for `nickname` on `ProductCatalog.TrialOffer` and `product_catalog.TrialOfferCreateParams`
* ⚠️ Remove support for `name` on `ProductCatalog.TrialOffer` and `product_catalog.TrialOfferCreateParams`
* ⚠️ Change `ProductCatalog.TrialOffer.EndBehavior.transition` to be optional
* Change `Product.tax_details` to be required
* Add support for `status_details` on `QuotePreviewInvoice`
* Add support for `company_details` and `reference` on `QuotePreviewInvoice.PaymentSetting.PaymentMethodOption.Billie`
* Add support for `pause_schedules` on `QuotePreviewSubscriptionSchedule`
* Add support for `destination` on `Reserve.Hold`, `Reserve.Plan`, and `Reserve.Release`
* Add support for `manual_release` on `Reserve.Plan`
* ⚠️ Add support for new value `other` on enum `Reserve.Plan.status`
* ⚠️ Add support for new values `manual_release` and `other` on enum `Reserve.Plan.type`
* ⚠️ Add support for new value `hold_expired` on enum `Reserve.Release.reason`
* ⚠️ Remove support for value `bulk_hold_expiry` from enum `Reserve.Release.reason`
* Change `SubscriptionItem.current_trial` to be required
* Change `Subscription.TrialSetting.EndBehavior.billing_cycle_anchor` to be required
* Add support for new value `igic` on enums `Tax.Registration.CountryOption.E.type` and `tax.RegistrationCreateParamsCountryOptionE.type`
* Change `TaxCode.requirements` to be required
* Add support for error codes `dispute_evidence_page_limit_exceeded`, `financial_connections_consent_locale_invalid`, `financial_connections_consent_locale_unsupported`, and `payment_evaluation_on_api_version_not_supported` on `QuotePreviewInvoice.LastFinalizationError`
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
baff58c9d515cdd5f5c3231d101989d588788c6f
83110a8fcd74d32f3b904356db1328d072d021c1
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2442
v2524
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ There are a few options for enabling it:
logging.getLogger('stripe').setLevel(logging.DEBUG)
```

### Suppressing Stripe notices

The SDK may print notices from Stripe that it receives in the `Stripe-Notice` header. These notices are always printed when the SDK runs in an agent environment. For API calls to test accounts or sandboxes, notices are also printed when the SDK runs outside an agent environment. To suppress notices when the SDK runs outside an agent environment, set the `STRIPE_SUPPRESS_NOTICES` environment variable to `true` before running your integration.

### Accessing response code and headers

You can access the HTTP response code and headers using the `last_response` property of the returned resource.
Expand Down
2 changes: 1 addition & 1 deletion examples/async_event_notification_handler_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

app = FastAPI()
api_key = os.environ.get("STRIPE_API_KEY", "")
webhook_secret = os.environ.get("WEBHOOK_SECRET", "")
webhook_secret = os.environ["WEBHOOK_SECRET"]

# Webhooks can be delivered more than once, so we track ids we've already
# processed. In production, back this with something durable and shared
Expand Down
2 changes: 1 addition & 1 deletion examples/event_notification_handler_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

app = Flask(__name__)
api_key = os.environ.get("STRIPE_API_KEY", "")
webhook_secret = os.environ.get("WEBHOOK_SECRET", "")
webhook_secret = os.environ["WEBHOOK_SECRET"]

# Webhooks can be delivered more than once, so we track ids we've already
# processed. In production, back this with something durable and shared
Expand Down
2 changes: 1 addition & 1 deletion examples/event_notification_webhook_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

app = Flask(__name__)
api_key = os.environ.get("STRIPE_API_KEY", "")
webhook_secret = os.environ.get("WEBHOOK_SECRET", "")
webhook_secret = os.environ["WEBHOOK_SECRET"]

client = StripeClient(api_key)

Expand Down
2 changes: 1 addition & 1 deletion examples/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# this is for handling v1-style Snapshot Events.
# To handle v2-style Events, see `event_notification_webhook_handler.py`

webhook_secret = os.environ.get("WEBHOOK_SECRET")
webhook_secret = os.environ["WEBHOOK_SECRET"]

app = Flask(__name__)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ reportUnnecessaryComparison = true
reportUnnecessaryContains = true
reportUnnecessaryIsInstance = true
reportPrivateImportUsage = true
reportUnnecessaryTypeIgnoreComment = true
reportUnnecessaryTypeIgnoreComment = false

[tool.mypy]
follow_imports = "silent"
Expand Down
6 changes: 6 additions & 0 deletions stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def add_beta_version(
tax as tax,
terminal as terminal,
test_helpers as test_helpers,
three_d_secure as three_d_secure,
treasury as treasury,
v2 as v2,
)
Expand Down Expand Up @@ -610,6 +611,9 @@ def add_beta_version(
from stripe._test_helpers_service import (
TestHelpersService as TestHelpersService,
)
from stripe._three_d_secure_service import (
ThreeDSecureService as ThreeDSecureService,
)
from stripe._token import Token as Token
from stripe._token_service import TokenService as TokenService
from stripe._topup import Topup as Topup
Expand Down Expand Up @@ -664,6 +668,7 @@ def add_beta_version(
"tax": ("stripe.tax", True),
"terminal": ("stripe.terminal", True),
"test_helpers": ("stripe.test_helpers", True),
"three_d_secure": ("stripe.three_d_secure", True),
"treasury": ("stripe.treasury", True),
"v2": ("stripe.v2", True),
"Account": ("stripe._account", False),
Expand Down Expand Up @@ -1018,6 +1023,7 @@ def add_beta_version(
"TerminalService": ("stripe._terminal_service", False),
"APIResourceTestHelpers": ("stripe._test_helpers", False),
"TestHelpersService": ("stripe._test_helpers_service", False),
"ThreeDSecureService": ("stripe._three_d_secure_service", False),
"Token": ("stripe._token", False),
"TokenService": ("stripe._token_service", False),
"Topup": ("stripe._topup", False),
Expand Down
20 changes: 18 additions & 2 deletions stripe/_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ class Capabilities(StripeObject):
"""
The status of the blik payments capability of the account, or whether the account can directly process blik charges.
"""
blik_recurring_payments: Optional[
Union[Literal["active", "inactive", "pending"], str]
]
"""
The status of the BLIK recurring payments capability of the account, or whether the account can accept recurring and subscription BLIK payments.
"""
boleto_payments: Optional[
Union[Literal["active", "inactive", "pending"], str]
]
Expand Down Expand Up @@ -592,6 +598,12 @@ class Capabilities(StripeObject):
"""
The status of the SEPA Direct Debits payments capability of the account, or whether the account can directly process SEPA Direct Debits charges.
"""
sequra_payments: Optional[
Union[Literal["active", "inactive", "pending"], str]
]
"""
The status of the SeQura capability of the account, or whether the account can directly process SeQura payments.
"""
shopeepay_payments: Optional[
Union[Literal["active", "inactive", "pending"], str]
]
Expand Down Expand Up @@ -894,7 +906,7 @@ class Verification(StripeObject):
class Document(StripeObject):
back: Optional[ExpandableField["File"]]
"""
The back of a document returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `additional_verification`. Note that `additional_verification` files are [not downloadable](https://docs.stripe.com/file-upload#uploading-a-file).
The back of a document returned by a [file upload](https://docs.stripe.com/api#create_file) with a `purpose` value of `additional_verification`. Note that `additional_verification` files are [not downloadable](https://docs.stripe.com/file-upload#uploading-a-file).
"""
details: Optional[str]
"""
Expand All @@ -906,7 +918,7 @@ class Document(StripeObject):
"""
front: Optional[ExpandableField["File"]]
"""
The front of a document returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `additional_verification`. Note that `additional_verification` files are [not downloadable](https://docs.stripe.com/file-upload#uploading-a-file).
The front of a document returned by a [file upload](https://docs.stripe.com/api#create_file) with a `purpose` value of `additional_verification`. Note that `additional_verification` files are [not downloadable](https://docs.stripe.com/file-upload#uploading-a-file).
"""

document: Document
Expand Down Expand Up @@ -1137,8 +1149,10 @@ class Error(StripeObject):
"external_request",
"information_missing",
"invalid_address_city_state_postal_code",
"invalid_address_cmra_address",
"invalid_address_highway_contract_box",
"invalid_address_private_mailbox",
"invalid_address_registered_agent_address",
"invalid_business_profile_name",
"invalid_business_profile_name_denylisted",
"invalid_company_name_denylisted",
Expand Down Expand Up @@ -1319,8 +1333,10 @@ class Error(StripeObject):
"external_request",
"information_missing",
"invalid_address_city_state_postal_code",
"invalid_address_cmra_address",
"invalid_address_highway_contract_box",
"invalid_address_private_mailbox",
"invalid_address_registered_agent_address",
"invalid_business_profile_name",
"invalid_business_profile_name_denylisted",
"invalid_company_name_denylisted",
Expand Down
4 changes: 2 additions & 2 deletions stripe/_account_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def create(
cls, **params: Unpack["AccountSessionCreateParams"]
) -> "AccountSession":
"""
Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
Creates an AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
"""
return cast(
"AccountSession",
Expand All @@ -597,7 +597,7 @@ async def create_async(
cls, **params: Unpack["AccountSessionCreateParams"]
) -> "AccountSession":
"""
Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
Creates an AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
"""
return cast(
"AccountSession",
Expand Down
4 changes: 2 additions & 2 deletions stripe/_account_session_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def create(
options: Optional["RequestOptions"] = None,
) -> "AccountSession":
"""
Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
Creates an AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
"""
return cast(
"AccountSession",
Expand All @@ -38,7 +38,7 @@ async def create_async(
options: Optional["RequestOptions"] = None,
) -> "AccountSession":
"""
Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
Creates an AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
"""
return cast(
"AccountSession",
Expand Down
28 changes: 24 additions & 4 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,31 @@
_default_proxy: Optional[str] = None


def _maybe_emit_stripe_notice(rheaders: Mapping[str, str]) -> None:
def _maybe_emit_stripe_notice(
rheaders: Mapping[str, str],
environ: Optional[Mapping[str, str]] = None,
) -> None:
notice = rheaders.get("Stripe-Notice")
if notice:
import warnings
if not notice:
return

environ = os.environ if environ is None else environ
ai_agent = _APIRequestor._detect_ai_agent(environ)
if (
not ai_agent
and environ.get("STRIPE_SUPPRESS_NOTICES", "").lower() == "true"
):
return

if not ai_agent:
notice += (
"\nTo suppress Stripe notices in test and sandbox environments, "
"set the STRIPE_SUPPRESS_NOTICES environment variable to true."
)

import warnings

warnings.warn(notice)
warnings.warn(notice)


def is_v2_delete_resp(method: str, api_mode: ApiMode) -> bool:
Expand Down Expand Up @@ -535,6 +554,7 @@ def specific_oauth_error(self, rbody, rcode, resp, rheaders, error_code):
("CODEX_CI", "codex_cli"),
("CURSOR_AGENT", "cursor"),
("GEMINI_CLI", "gemini_cli"),
("HERMES_AGENT", "hermes"),
("OPENCLAW_SHELL", "openclaw"),
("OPENCODE", "open_code"),
# aiAgents: The end of the section generated from our OpenAPI spec
Expand Down
2 changes: 1 addition & 1 deletion stripe/_api_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
class _ApiVersion:
CURRENT = "2026-08-26.preview"
CURRENT = "2026-09-30.preview"
CURRENT_MAJOR = ""
7 changes: 6 additions & 1 deletion stripe/_apps_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
from typing_extensions import TYPE_CHECKING

if TYPE_CHECKING:
from stripe.apps._install_service import InstallService
from stripe.apps._secret_service import SecretService

_subservices = {"secrets": ["stripe.apps._secret_service", "SecretService"]}
_subservices = {
"installs": ["stripe.apps._install_service", "InstallService"],
"secrets": ["stripe.apps._secret_service", "SecretService"],
}


class AppsService(StripeService):
installs: "InstallService"
secrets: "SecretService"

def __init__(self, requestor):
Expand Down
2 changes: 1 addition & 1 deletion stripe/_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class SourceTypes(StripeObject):

available: List[Available]
"""
Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://api.stripe.com#transfers) or [Payouts API](https://api.stripe.com#payouts). You can find the available balance for each currency and payment type in the `source_types` property.
Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://docs.stripe.com/api#transfers) or [Payouts API](https://docs.stripe.com/api#payouts). You can find the available balance for each currency and payment type in the `source_types` property.
"""
connect_reserved: Optional[List[ConnectReserved]]
"""
Expand Down
Loading
Loading