Skip to content
Open
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,46 @@ This release changes the pinned API version to 2026-06-24.preview.
* Add support for error codes `anomalous_money_movement_request`, `failed_tax_calculation`, `financial_account_balance_does_not_support_currency`, `financial_account_capability_not_enabled`, and `financial_account_capability_restricted` on `QuotePreviewInvoice.LastFinalizationError`
* Add support for error code `default_us_bank_account_cannot_be_archived` on `CannotProceedError`

## 15.3.0 - 2026-06-24
This release changes the pinned API version to 2026-06-24.dahlia.

* [#1836](https://github.com/stripe/stripe-python/pull/1836) Update generated code
* Add support for `release_details` on `Reserve.Hold`
* ⚠️ Add support for new value `tax_fund` on enum `BalanceTransaction.type`
* Change `Billing.CreditGrant.priority` to be required
* Add support for `buyer_id` on `Charge.PaymentMethodDetail.Bizum`, `ConfirmationToken.PaymentMethodPreview.Bizum`, `ConfirmationToken.PaymentMethodPreview.Blik`, `PaymentAttemptRecord.PaymentMethodDetail.Bizum`, `PaymentMethod.Bizum`, `PaymentMethod.Blik`, and `PaymentRecord.PaymentMethodDetail.Bizum`
* Add support for `transaction_link_id` on `Charge.PaymentMethodDetail.Card`
* ⚠️ Add support for new value `sui` on enums `Charge.PaymentMethodDetail.Crypto.network`, `PaymentAttemptRecord.PaymentMethodDetail.Crypto.network`, and `PaymentRecord.PaymentMethodDetail.Crypto.network`
* ⚠️ Add support for new value `usdsui` on enums `Charge.PaymentMethodDetail.Crypto.token_currency`, `PaymentAttemptRecord.PaymentMethodDetail.Crypto.token_currency`, and `PaymentRecord.PaymentMethodDetail.Crypto.token_currency`
* Add support for `fingerprint` on `Charge.PaymentMethodDetail.Pix`, `ConfirmationToken.PaymentMethodPreview.Pix`, `PaymentMethod.Pix`, and `SetupAttempt.PaymentMethodDetail.Pix`
* Add support for `sunbit` on `Checkout.Session.PaymentMethodOption`, `PaymentIntent.PaymentMethodOption`, `PaymentIntentConfirmParamsPaymentMethodOption`, `PaymentIntentCreateParamsPaymentMethodOption`, `PaymentIntentModifyParamsPaymentMethodOption`, and `checkout.SessionCreateParamsPaymentMethodOption`
* Add support for `billing_cycle_anchor_config` on `checkout.SessionCreateParamsSubscriptionDatum`
* Add support for `wechat_pay` on `Checkout.Session.PaymentMethodOption`
* Add support for `mastercard_compliance` on `Dispute.Evidence.EnhancedEvidence`, `Dispute.EvidenceDetail.EnhancedEligibility`, and `DisputeModifyParamsEvidenceEnhancedEvidence`
* ⚠️ Add support for new value `mastercard_compliance` on enum `Dispute.enhanced_eligibility_types`
* Add support for `status_details` on `FinancialConnections.Account`
* ⚠️ Add support for new value `validated` on enum `Identity.VerificationSession.Redaction.status`
* Add support for new value `satispay` on enums `InvoiceCreateParamsPaymentSetting.payment_method_types`, `InvoiceModifyParamsPaymentSetting.payment_method_types`, `SubscriptionCreateParamsPaymentSetting.payment_method_types`, and `SubscriptionModifyParamsPaymentSetting.payment_method_types`
* ⚠️ Add support for new value `satispay` on enums `Invoice.PaymentSetting.payment_method_types` and `Subscription.PaymentSetting.payment_method_types`
* ⚠️ Remove support for `stored_credential_usage` on `PaymentAttemptRecord.PaymentMethodDetail.Card` and `PaymentRecord.PaymentMethodDetail.Card`
* ⚠️ Change `PaymentAttemptRecord.PaymentMethodDetail.Card.description` and `PaymentRecord.PaymentMethodDetail.Card.description` to be optional
* ⚠️ Change `PaymentAttemptRecord.PaymentMethodDetail.Card.iin` and `PaymentRecord.PaymentMethodDetail.Card.iin` to be optional
* ⚠️ Change `PaymentAttemptRecord.PaymentMethodDetail.Card.issuer` and `PaymentRecord.PaymentMethodDetail.Card.issuer` to be optional
* Add support for `setup_future_usage` on `PaymentIntent.PaymentMethodOption.Satispay`, `PaymentIntentConfirmParamsPaymentMethodOptionSatispay`, `PaymentIntentCreateParamsPaymentMethodOptionSatispay`, and `PaymentIntentModifyParamsPaymentMethodOptionSatispay`
* Change `PaymentRecordReportRefundParams.refunded` to be optional
* Add support for `satispay` on `SetupAttempt.PaymentMethodDetail`
* Add support for `custom_fields`, `description`, and `footer` on `Subscription.InvoiceSetting`, `SubscriptionCreateParamsInvoiceSetting`, and `SubscriptionModifyParamsInvoiceSetting`
* Add support for `payment_method_options` and `payment_method` on `TopupCreateParams`
* Add support for new value `2026-06-24.dahlia` on enum `WebhookEndpointCreateParams.api_version`
* Add support for `mode` on `V2.Commerce.ProductCatalogImport`
* ⚠️ Add support for new value `promotion` on enum `V2.Commerce.ProductCatalogImport.feed_type`
* Add support for `sunbit_payments` on `V2.Core.Account.Configuration.Merchant.Capability`, `v2.core.AccountCreateParamsConfigurationMerchantCapability`, and `v2.core.AccountModifyParamsConfigurationMerchantCapability`
* Add support for `crypto_money_manager` and `money_manager` on `v2.core.AccountModifyParamsIdentityAttestationTermsOfService`
* ⚠️ Remove support for `crypto_storer` and `storer` on `v2.core.AccountModifyParamsIdentityAttestationTermsOfService`
* Add support for new value `promotion` on enum `v2.commerce.ProductCatalogImportCreateParams.feed_type`
* ⚠️ Add support for new value `sunbit_payments` on enum `EventsV2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent.updated_capability`
* Add support for error codes `anomalous_money_movement_request`, `failed_tax_calculation`, `financial_account_balance_does_not_support_currency`, `financial_account_capability_not_enabled`, and `financial_account_capability_restricted` on `Invoice.LastFinalizationError`, `PaymentIntent.LastPaymentError`, `SetupAttempt.SetupError`, `SetupIntent.LastSetupError`, `StripeError`, and `Terminal.Reader.Action.ApiError`

## 15.3.0b1 - 2026-05-27
This release changes the pinned API version to 2026-05-27.private.

Expand Down
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6012b623b1c09ad54d466947da04511a042ee45a
3723bdf073100308cd413efdb4aefbc912f9bf2f
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2324
v2343
8 changes: 6 additions & 2 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
NoReturn,
Unpack,
)
import uuid
from urllib.parse import urlsplit, urlunsplit, parse_qs

# breaking circular dependency
Expand Down Expand Up @@ -100,6 +99,11 @@ def is_v2_delete_resp(method: str, api_mode: ApiMode) -> bool:
return method == "delete" and api_mode == "V2"


def _generate_idempotency_key() -> str:
b = os.urandom(16)
return f"{b[0:4].hex()}-{b[4:6].hex()}-{b[6:8].hex()}-{b[8:10].hex()}-{b[10:].hex()}"


class _APIRequestor(object):
_instance: ClassVar["_APIRequestor|None"] = None

Expand Down Expand Up @@ -616,7 +620,7 @@ def request_headers(

# 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.setdefault("Idempotency-Key", _generate_idempotency_key())

if method == "post":
if api_mode == "V2":
Expand Down
71 changes: 70 additions & 1 deletion stripe/_error_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,85 @@
from stripe._api_mode import ApiMode

if TYPE_CHECKING:
# errorImports: The beginning of the section generated from our OpenAPI spec
from stripe._payment_intent import PaymentIntent
from stripe._payment_method import PaymentMethod
from stripe._setup_intent import SetupIntent
from stripe._source import Source
from stripe._payment_method import PaymentMethod
# errorImports: The end of the section generated from our OpenAPI spec


class ErrorObject(StripeObject):
# errorAnnotations: The beginning of the section generated from our OpenAPI spec
advice_code: Optional[str]
"""
For card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://docs.stripe.com/declines#retrying-issuer-declines) if they provide one.
"""
charge: Optional[str]
"""
For card errors, the ID of the failed charge.
"""
code: Optional[str]
"""
For some errors that could be handled programmatically, a short string indicating the [error code](https://docs.stripe.com/error-codes) reported.
"""
decline_code: Optional[str]
"""
For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://docs.stripe.com/declines#issuer-declines) if they provide one.
"""
doc_url: Optional[str]
"""
A URL to more information about the [error code](https://docs.stripe.com/error-codes) reported.
"""
message: Optional[str]
"""
A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
"""
network_advice_code: Optional[str]
"""
For card errors resulting from a card issuer decline, a 2 digit code which indicates the advice given to merchant by the card network on how to proceed with an error.
"""
network_decline_code: Optional[str]
"""
For payments declined by the network, an alphanumeric code which indicates the reason the payment failed.
"""
param: Optional[str]
"""
If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
"""
payment_intent: Optional["PaymentIntent"]
"""
The PaymentIntent object for errors returned on a request involving a PaymentIntent.
"""
payment_method: Optional["PaymentMethod"]
"""
The PaymentMethod object for errors returned on a request involving a PaymentMethod.
"""
payment_method_type: Optional[str]
"""
If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.
"""
request_log_url: Optional[str]
"""
A URL to the request log entry in your dashboard.
"""
setup_intent: Optional["SetupIntent"]
"""
The SetupIntent object for errors returned on a request involving a SetupIntent.
"""
source: Optional["Source"]
"""
The PaymentSource object for errors returned on a request involving a PaymentSource.
"""
type: str
"""
The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error`
"""
user_message: Optional[str]
"""
The user message associated with the error.
"""
# errorAnnotations: The end of the section generated from our OpenAPI spec

def refresh_from(
self,
Expand Down Expand Up @@ -63,17 +124,25 @@ def _refresh_from(
# values here to facilitate generic error handling.
values = merge_dicts(
{
# errorDefaults: The beginning of the section generated from our OpenAPI spec
"advice_code": None,
"charge": None,
"code": None,
"decline_code": None,
"doc_url": None,
"message": None,
"network_advice_code": None,
"network_decline_code": None,
"param": None,
"payment_intent": None,
"payment_method": None,
"payment_method_type": None,
"request_log_url": None,
"setup_intent": None,
"source": None,
"type": None,
"user_message": None,
# errorDefaults: The end of the section generated from our OpenAPI spec
},
values,
)
Expand Down
Loading
Loading