Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
842b6e2
Update generated code (#1816)
stripe-openapi[bot] May 27, 2026
6c0388f
Bump version to 15.2.0
mbroshi-stripe May 27, 2026
5b9db27
Merge upstream and update generated code for v2277 and e410e9ac8e4f0d…
stripe-openapi[bot] May 28, 2026
33931ac
Only typecheck against a single version (#1814)
xavdid Jun 1, 2026
df341f5
Merge upstream and update generated code for v2283 and 85055f7b3256cd…
stripe-openapi[bot] Jun 1, 2026
2d39c3b
Disable trim_trailing_whitespace for CHANGELOG.md (#1822)
jar-stripe Jun 5, 2026
42db177
Add Changelog section to PR template (#1823)
jar-stripe Jun 5, 2026
6ca8f2a
Merge upstream and update generated code for v2290 and a2127a04972df9…
stripe-openapi[bot] Jun 5, 2026
a553645
Add source field to user-agent header (#1825)
xavdid Jun 5, 2026
8e78583
Merge upstream and update generated code for v2290 and 2fbde613160d9a…
stripe-openapi[bot] Jun 6, 2026
36e43ba
docs: clarify private preview SDK access in README (#1826)
jar-stripe Jun 8, 2026
153362d
Merge upstream and update generated code for v2290 and 64505e82d8e31d…
stripe-openapi[bot] Jun 8, 2026
1eab045
Bump version to 15.2.1
xavdid Jun 12, 2026
7812943
Merge upstream and update generated code for v2302 and 10e358891bc166…
stripe-openapi[bot] Jun 12, 2026
a8fcb69
Remove retired manual API tests covered by generated examples (#1829)
jar-stripe Jun 12, 2026
d0eafa6
Merge upstream and update generated code for v2305 and c26e09541d7120…
stripe-openapi[bot] Jun 13, 2026
3f0f834
Upgrade CI runner from ubuntu-22.04 to ubuntu-24.04 (#1830)
jar-stripe Jun 16, 2026
ba34d22
Merge upstream and update generated code for v2312 and 5f0e6efdb502d1…
stripe-openapi[bot] Jun 16, 2026
4280756
Add PR disclaimer to README (#1831)
xavdid Jun 16, 2026
3b436f0
Merge upstream and update generated code for v2314 and 1e427d0b4093ca…
stripe-openapi[bot] Jun 16, 2026
9106b4a
Update generated code for v2323 and 1f0a7866ce5b5e12153c09a04349f9148…
stripe-openapi[bot] Jun 23, 2026
2c10dc5
Update generated code for v2324 and 6012b623b1c09ad54d466947da04511a0…
stripe-openapi[bot] Jun 24, 2026
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
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ List out the key changes made in this PR, e.g.

### See Also
<!-- Include any links or additional information that help explain this change. -->

## Changelog
<!-- Heads up! This section should include entries for any user-facing changes.
Either fill it out or remove it if there are no entries to report.

List changes that affect end users, e.g.
- Fixes crash when calling `foo.bar()` with null argument
- Adds support for new `baz` parameter on `PaymentIntent` creation

List breaking changes first with a ⚠️ prefix, e.g.
- ⚠️ Removes deprecated `legacy_method` function
-->
21 changes: 8 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: check examples w/ mypy (against python@3.10)
python-version: "3.13"
- name: check examples w/ mypy (against python@3.13)
run: just typecheck-examples
# skip deps on all these since mypy installed everything
- name: check linting
Expand All @@ -42,13 +42,11 @@ jobs:
run: just --no-deps format-check
# pyright depends on node, which it handles and installs for itself as needed
# we _could_ run setup-node to make it available for it if we're having reliability problems
- name: check types (all Python versions)
run: |
set -eox

for minor in {6..12}; do
just --no-deps typecheck $minor
done
- name: check types
# only check against a modern version- unit tests will catch syntax errors on older versions
# this isn't user facing, this is just checking that our code is internally consistent
# e.g. a bug here wouldn't cause user CI to fail since the issue is internal to our codebase
run: just --no-deps typecheck

build:
name: Build
Expand All @@ -75,10 +73,7 @@ jobs:
path: dist/

test:
# Specific ubuntu version to support python 3.7 testing
# see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 for list of supported versions
# move to ubuntu-latest when we drop 3.7
runs-on: ubuntu-22.04
runs-on: "ubuntu-24.04"
permissions:
contents: read
strategy:
Expand Down
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,64 @@ This release changes the pinned API version to 2026-05-27.private.
* Add support for new value `chaps` on enum `v2.FinancialAddressCreditSimulationCreditParams.network`
* Add support for error codes `payment_method_microdeposit_processing_error` and `siret_invalid` on `QuotePreviewInvoice.LastFinalizationError`

## 15.2.1 - 2026-06-12
* [#1825](https://github.com/stripe/stripe-python/pull/1825) Add "source" field to user-agent header

## 15.2.0 - 2026-05-27
This release changes the pinned API version to 2026-05-27.dahlia.

* [#1816](https://github.com/stripe/stripe-python/pull/1816) Update generated code
* Add support for new resource `v2.commerce.ProductCatalogImport`
* Add support for `create` and `retrieve` methods on resource `v2.commerce.ProductCatalogImport`
* Add support for `bizum_payments` and `scalapay_payments` on `Account.Capability`, `AccountCreateParamsCapability`, and `AccountModifyParamsCapability`
* Add support for `automatic_transfer_rules_by_currency` on `BalanceSettings.Payment.Payout` and `BalanceSettingsModifyParamsPaymentPayout`
* Add support for `start_of_day` on `BalanceSettings.Payment.SettlementTiming` and `BalanceSettingsModifyParamsPaymentSettlementTiming`
* Add support for `description` on `ChargeCreateParamsTransferDatum`, `PaymentIntent.TransferDatum`, `PaymentIntentCreateParamsTransferDatum`, and `PaymentIntentModifyParamsTransferDatum`
* Add support for `bizum` on `Charge.PaymentMethodDetail`, `ConfirmationToken.PaymentMethodPreview`, `ConfirmationTokenCreateParamsPaymentMethodDatum`, `PaymentAttemptRecord.PaymentMethodDetail`, `PaymentIntent.PaymentMethodOption`, `PaymentIntentConfirmParamsPaymentMethodDatum`, `PaymentIntentConfirmParamsPaymentMethodOption`, `PaymentIntentCreateParamsPaymentMethodDatum`, `PaymentIntentCreateParamsPaymentMethodOption`, `PaymentIntentModifyParamsPaymentMethodDatum`, `PaymentIntentModifyParamsPaymentMethodOption`, `PaymentMethodConfigurationCreateParams`, `PaymentMethodConfigurationModifyParams`, `PaymentMethodConfiguration`, `PaymentMethodCreateParams`, `PaymentMethod`, `PaymentRecord.PaymentMethodDetail`, `SetupIntent.PaymentMethodOption`, `SetupIntentConfirmParamsPaymentMethodDatum`, `SetupIntentConfirmParamsPaymentMethodOption`, `SetupIntentCreateParamsPaymentMethodDatum`, `SetupIntentCreateParamsPaymentMethodOption`, `SetupIntentModifyParamsPaymentMethodDatum`, and `SetupIntentModifyParamsPaymentMethodOption`
* Add support for `scalapay` on `Charge.PaymentMethodDetail`, `Checkout.Session.PaymentMethodOption`, `ConfirmationToken.PaymentMethodPreview`, `ConfirmationTokenCreateParamsPaymentMethodDatum`, `PaymentAttemptRecord.PaymentMethodDetail`, `PaymentIntent.PaymentMethodOption`, `PaymentIntentConfirmParamsPaymentMethodDatum`, `PaymentIntentConfirmParamsPaymentMethodOption`, `PaymentIntentCreateParamsPaymentMethodDatum`, `PaymentIntentCreateParamsPaymentMethodOption`, `PaymentIntentModifyParamsPaymentMethodDatum`, `PaymentIntentModifyParamsPaymentMethodOption`, `PaymentMethodConfigurationCreateParams`, `PaymentMethodConfigurationModifyParams`, `PaymentMethodConfiguration`, `PaymentMethodCreateParams`, `PaymentMethod`, `PaymentRecord.PaymentMethodDetail`, `Refund.DestinationDetail`, `SetupIntentConfirmParamsPaymentMethodDatum`, `SetupIntentCreateParamsPaymentMethodDatum`, `SetupIntentModifyParamsPaymentMethodDatum`, and `checkout.SessionCreateParamsPaymentMethodOption`
* Add support for `mandate` on `Charge.PaymentMethodDetail.Twint`, `PaymentAttemptRecord.PaymentMethodDetail.Twint`, and `PaymentRecord.PaymentMethodDetail.Twint`
* Add support for new values `bizum` and `scalapay` on enums `PaymentIntentConfirmParams.excluded_payment_method_types`, `PaymentIntentCreateParams.excluded_payment_method_types`, `PaymentIntentModifyParams.excluded_payment_method_types`, `SetupIntentCreateParams.excluded_payment_method_types`, `SetupIntentModifyParams.excluded_payment_method_types`, and `checkout.SessionCreateParams.excluded_payment_method_types`
* Change type of `PaymentIntentConfirmParamsPaymentMethodOptionTwint.setup_future_usage`, `PaymentIntentCreateParamsPaymentMethodOptionTwint.setup_future_usage`, `PaymentIntentModifyParamsPaymentMethodOptionTwint.setup_future_usage`, and `checkout.SessionCreateParamsPaymentMethodOptionTwint.setup_future_usage` from `literal('none')` to `enum('none'|'off_session')`
* Add support for new values `bizum` and `scalapay` on enum `checkout.SessionCreateParams.payment_method_types`
* ⚠️ Change type of `Checkout.Session.PaymentMethodOption.Twint.setup_future_usage` and `PaymentIntent.PaymentMethodOption.Twint.setup_future_usage` from `literal('none')` to `enum('none'|'off_session')`
* Add support for new values `bizum` and `scalapay` on enums `ConfirmationTokenCreateParamsPaymentMethodDatum.type`, `PaymentIntentConfirmParamsPaymentMethodDatum.type`, `PaymentIntentCreateParamsPaymentMethodDatum.type`, `PaymentIntentModifyParamsPaymentMethodDatum.type`, `SetupIntentConfirmParamsPaymentMethodDatum.type`, `SetupIntentCreateParamsPaymentMethodDatum.type`, and `SetupIntentModifyParamsPaymentMethodDatum.type`
* ⚠️ Add support for new values `bizum` and `scalapay` on enums `ConfirmationToken.PaymentMethodPreview.type` and `PaymentMethod.type`
* Add support for new values `bizum` and `scalapay` on enums `CustomerListPaymentMethodsParams.type`, `PaymentMethodCreateParams.type`, and `PaymentMethodListParams.type`
* Add support for `credited_items` on `InvoiceItem.ProrationDetail`
* Add support for new value `twint` on enums `InvoiceCreateParamsPaymentSetting.payment_method_types`, `InvoiceModifyParamsPaymentSetting.payment_method_types`, `SubscriptionCreateParamsPaymentSetting.payment_method_types`, and `SubscriptionModifyParamsPaymentSetting.payment_method_types`
* Add support for `discountable` on `InvoiceCreatePreviewParamsScheduleDetailPhaseAddInvoiceItem`, `SubscriptionCreateParamsAddInvoiceItem`, `SubscriptionModifyParamsAddInvoiceItem`, `SubscriptionSchedule.Phase.AddInvoiceItem`, `SubscriptionScheduleCreateParamsPhaseAddInvoiceItem`, and `SubscriptionScheduleModifyParamsPhaseAddInvoiceItem`
* Add support for `billing_schedules` on `InvoiceCreatePreviewParamsSubscriptionDetail`, `SubscriptionCreateParams`, `SubscriptionModifyParams`, and `Subscription`
* Add support for new value `max_billed_until` on enums `InvoiceCreatePreviewParamsSubscriptionDetail.cancel_at`, `SubscriptionCreateParams.cancel_at`, and `SubscriptionModifyParams.cancel_at`
* Add support for `amount_paid_off_stripe` on `Invoice`
* ⚠️ Add support for new value `twint` on enums `Invoice.PaymentSetting.payment_method_types` and `Subscription.PaymentSetting.payment_method_types`
* Add support for `twint` on `Mandate.PaymentMethodDetail` and `SetupAttempt.PaymentMethodDetail`
* Add support for `metadata` on `PaymentIntent.TransferDatum`, `PaymentIntentCreateParamsTransferDatum`, `PaymentIntentModifyParamsTransferDatum`, and `Subscription.PendingUpdate`
* Add support for `payment_data` on `PaymentIntent.TransferDatum`, `PaymentIntentCreateParamsTransferDatum`, and `PaymentIntentModifyParamsTransferDatum`
* ⚠️ Add support for new values `bizum` and `scalapay` on enums `PaymentIntent.excluded_payment_method_types` and `SetupIntent.excluded_payment_method_types`
* Add support for `blik_authorize` on `PaymentIntent.NextAction` and `SetupIntent.NextAction`
* Add support for `payment_method_options` on `PaymentLinkCreateParams`, `PaymentLinkModifyParams`, and `PaymentLink`
* Add support for new value `bizum` on enums `PaymentLinkCreateParams.payment_method_types` and `PaymentLinkModifyParams.payment_method_types`
* ⚠️ Add support for new value `bizum` on enum `PaymentLink.payment_method_types`
* Add support for `active` on `PaymentMethodConfigurationListParams`
* Add support for `billed_until` on `SubscriptionItem`
* Add support for `discount` and `discounts` on `Subscription.PendingUpdate`
* Add support for `verifone_m425`, `verifone_p630`, `verifone_ux700`, and `verifone_v660p` on `Terminal.Configuration`, `terminal.ConfigurationCreateParams`, and `terminal.ConfigurationModifyParams`
* Add support for new values `simulated_verifone_m425`, `simulated_verifone_p630`, `simulated_verifone_ux700`, `simulated_verifone_v660p`, `verifone_m425`, `verifone_p630`, `verifone_ux700`, and `verifone_v660p` on enum `terminal.ReaderListParams.device_type`
* Add support for `api_error` and `print_content` on `Terminal.Reader.Action`
* ⚠️ Add support for new value `print_content` on enum `Terminal.Reader.Action.type`
* ⚠️ Add support for new values `simulated_verifone_m425`, `simulated_verifone_p630`, `simulated_verifone_ux700`, `simulated_verifone_v660p`, `verifone_m425`, `verifone_p630`, `verifone_ux700`, and `verifone_v660p` on enum `Terminal.Reader.device_type`
* Add support for `customer` on `test_helpers.TestClockCreateParams`
* Add support for new value `2026-05-27.dahlia` on enum `WebhookEndpointCreateParams.api_version`
* Add support for `signer` on `V2.Core.Account.Identity.BusinessDetail.Document.ProofOfRegistration`, `V2.Core.Account.Identity.BusinessDetail.Document.ProofOfUltimateBeneficialOwnership`, `v2.core.AccountCreateParamsIdentityBusinessDetailDocumentProofOfRegistration`, `v2.core.AccountCreateParamsIdentityBusinessDetailDocumentProofOfUltimateBeneficialOwnership`, `v2.core.AccountModifyParamsIdentityBusinessDetailDocumentProofOfRegistration`, `v2.core.AccountModifyParamsIdentityBusinessDetailDocumentProofOfUltimateBeneficialOwnership`, `v2.core.AccountTokenCreateParamsIdentityBusinessDetailDocumentProofOfRegistration`, and `v2.core.AccountTokenCreateParamsIdentityBusinessDetailDocumentProofOfUltimateBeneficialOwnership`
* Add support for `azure_event_grid` on `V2.Core.EventDestination` and `v2.core.EventDestinationCreateParams`
* ⚠️ Add support for new value `no_azure_partner_topic_exists` on enum `V2.Core.EventDestination.StatusDetail.Disabled.reason`
* ⚠️ Add support for new value `azure_event_grid` on enum `V2.Core.EventDestination.type`
* Add support for new value `azure_event_grid` on enum `v2.core.EventDestinationCreateParams.type`
* ⚠️ Add support for new value `meter_event_value_too_many_digits` on enums `EventsV1BillingMeterErrorReportTriggeredEvent.Reason.ErrorType.code` and `EventsV1BillingMeterNoMeterFoundEvent.Reason.ErrorType.code`
* Add support for event notifications `V2CommerceProductCatalogImportsFailedEvent`, `V2CommerceProductCatalogImportsProcessingEvent`, `V2CommerceProductCatalogImportsSucceededEvent`, and `V2CommerceProductCatalogImportsSucceededWithErrorsEvent` with related object `v2.commerce.ProductCatalogImport`
* Add support for error codes `payment_method_microdeposit_processing_error` and `siret_invalid` on `Invoice.LastFinalizationError`, `PaymentIntent.LastPaymentError`, `SetupAttempt.SetupError`, `SetupIntent.LastSetupError`, and `StripeError`
* [#1813](https://github.com/stripe/stripe-python/pull/1813) Emit warning when `stripe-notify` header is present in response

## 15.2.0b2 - 2026-04-24
* [#1797](https://github.com/stripe/stripe-python/pull/1797) Update generated code for beta
* Add support for new resources `v2.commerce.ProductCatalogImport`, `v2.data.reporting.QueryRun`, `v2.extend.WorkflowRun`, `v2.extend.Workflow`, `v2.iam.ActivityLog`, `v2.network.BusinessProfile`, and `v2.orchestrated_commerce.Agreement`
Expand Down
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d59a1f4bdea3032b8e282d40badc032cb021fc60
6012b623b1c09ad54d466947da04511a042ee45a
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2277
v2324
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ stripe.add_beta_version("feature_beta", "v3")

### Private Preview SDKs

Stripe has features in the [private preview phase](https://docs.stripe.com/release-phases) that can be accessed via versions of this package that have the `aX` suffix like `12.2.0a2`. These are invite-only features. Once invited, you can install the private preview SDKs by following the same instructions as for the [public preview SDKs](https://github.com/stripe/stripe-python?tab=readme-ov-file#public-preview-sdks) above and replacing the suffix `b` with `a` in package versions.
Stripe has features in the [private preview phase](https://docs.stripe.com/release-phases) that can be accessed via versions of this package that have the `aX` suffix like `12.2.0a2`. You can install the private preview SDKs by following the same instructions as for the [public preview SDKs](https://github.com/stripe/stripe-python?tab=readme-ov-file#public-preview-sdks) above and replacing the suffix `b` with `a` in package versions. Note that access to specific private preview API features may require separate approval.

### Custom requests

Expand Down Expand Up @@ -354,6 +354,9 @@ New features and bug fixes are released on the latest major version of the Strip

## Development

> [!WARNING]
> External contributions to this repo from first-time contributors are currently on hiatus. If you'd like to see a change made to the package, please open an issue.

[Contribution guidelines for this project](CONTRIBUTING.md)

The test suite depends on [stripe-mock], so make sure to fetch and run it from a
Expand Down
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ test-one test_name: install-test-deps
lint: install-dev-deps
python -m flake8 --show-source stripe tests

# verify types. optional argument to test as of a specific minor python version (e.g. `8` to test `python 3.8`); otherwise uses current version
typecheck minor_py_version="": install-test-deps install-dev-deps
# verify types using current python version
typecheck: install-test-deps install-dev-deps
# suppress version update warnings
PYRIGHT_PYTHON_IGNORE_WARNINGS=1 pyright {{ if minor_py_version == "" { "" } else { "--pythonversion 3." + minor_py_version } }}
PYRIGHT_PYTHON_IGNORE_WARNINGS=1 pyright

# ⭐ format all code
format: install-dev-deps
Expand Down
19 changes: 19 additions & 0 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from io import BytesIO, IOBase
import functools
import hashlib
import json
import os
import platform
import socket
from typing import (
Any,
AsyncIterable,
Expand Down Expand Up @@ -72,6 +75,19 @@
_default_proxy: Optional[str] = None


@functools.lru_cache(maxsize=None)
def _get_uname_hash() -> Optional[str]:
try:
parts: List[str] = list(platform.uname())
try:
parts.append(socket.gethostname())
except Exception:
pass
return hashlib.md5(" ".join(parts).encode()).hexdigest()
except Exception:
return None


def _maybe_emit_stripe_notice(rheaders: Mapping[str, str]) -> None:
notice = rheaders.get("Stripe-Notice")
if notice:
Expand Down Expand Up @@ -561,6 +577,9 @@ def request_headers(
"lang": "python",
"httplib": self._get_http_client().name,
}
uname_hash = _get_uname_hash()
if uname_hash is not None:
ua["source"] = uname_hash
attr_funcs: List[Tuple[str, Callable[[], str]]] = [
("lang_version", platform.python_version),
]
Expand Down
2 changes: 1 addition & 1 deletion stripe/_api_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
class _ApiVersion:
CURRENT = "2026-05-27.preview"
CURRENT = "2026-06-24.preview"
Loading
Loading