Registry / payments / stripe

stripe

JSON →
sdk15.5.1pypypi✓ verified 30d ago

Official Python SDK for the Stripe Payments API. Actively maintained by Stripe. Versioned on a date-based API release cycle (e.g. 2026-02-25.clover). SDK major versions track breaking Python API changes separately from API version pinning. Current API version: 2026-02-25.clover.

pip install stripe
INSTALL
IMPORT
SIG · STRIPE
S
stripe
paymentspythonv15.5.1
Install
4.0s avg
Import
517ms
Disk
43MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v15.5.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.534s · 44.1MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 4.0s · import 0.500s · 45MB
43MB installed
● package 43MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stripe
✓ import stripe

Basic payment intent creation and webhook verification. Always verify webhook signatures — do not trust payload content without verification.

import stripe stripe.api_key = 'sk_test_...' # Create a payment intent pi = stripe.PaymentIntent.create( amount=2000, currency='usd', payment_method_types=['card'] ) print(pi.client_secret) # Verify webhook import stripe.webhook event = stripe.Webhook.construct_event( payload=request.body, sig_header=request.headers['Stripe-Signature'], secret='whsec_...' )
Debug
Known issues
breakingSDK v14.0 (November 2025) pinned API version to 2025-09-30.clover and included breaking changes: InvoiceLineItem.modify() now requires invoice and line_item_id as explicit method parameters. Code passing them via params dict breaks.
fix
Update InvoiceLineItem.modify(invoice='in_...', line_item_id='il_...', params={})
affects: < 14.0.0
breakingStripe API uses date-based versioning (e.g. 2026-02-25.clover). Each SDK major version pins a new API version. Upgrading SDK major version automatically changes which API version your requests use, which can break existing integrations.
fix
Pin SDK version in production. When upgrading major versions, review the API changelog for breaking changes between API versions at docs.stripe.com/changelog.
affects: all
breakingV2 API endpoints (e.g. /v2/billing) use indexed query format for include[] params: ?include[0]=foo&include[1]=bar. Code mocking the old repeated format (?include=foo&include=bar) breaks in unit tests.
fix
Update mock server expectations for v2 endpoint include params to use indexed format.
affects: >= 13.1.0
gotchastripe.api_key is a global. In multi-threaded or async apps, setting it globally can cause key leakage between requests. Using different keys per request requires StripeClient, not the global API.
fix
Use StripeClient(api_key='...') instances per request for multi-tenant applications.
affects: all
gotchaPublishable keys (pk_live_..., pk_test_...) are for Stripe.js front-end only. Using them server-side in the Python SDK returns 401 Unauthorized.
fix
Use secret keys (sk_live_... or sk_test_...) in the Python SDK.
affects: all
gotchaWebhook signature verification requires the raw request body, not parsed JSON. Frameworks that pre-parse the body (e.g. Django REST Framework with JSONParser) will cause signature verification to fail.
fix
Access request.body (Django) or request.data (Flask) before any parsing. Use @csrf_exempt in Django and ensure the body is read as bytes.
affects: all
breakingThe 'stripe' library or its 'webhook' submodule could not be found. This typically indicates that the 'stripe' package is not installed in the environment or the submodule has been removed/renamed in the installed version.
fix
Ensure the 'stripe' library is installed using `pip install stripe`. If the module existed in an older version, consider pinning an older SDK version or updating the import statement.
affects: all
breakingThe `stripe` library or its submodules (e.g., `stripe.webhook`) cannot be imported if the package is not installed or not available in the Python environment's `sys.path`. This results in a `ModuleNotFoundError`.
fix
Ensure the `stripe` library is correctly installed in the Python environment using `pip install stripe`. If using a virtual environment, ensure it is activated. Verify the installation by running `python -c "import stripe.webhook"`.
affects: all
Upgrade
Version history
15.5.1latest on PyPI · released Aug 18, 2026
Audit
Dependencies
requestsrequiredDefault HTTP client. Can be swapped for aiohttp via StripeClient.
Agent activity
51 hits · last 30 days
node
44
OpenAI (training)
1
Resources
stripe — pip install stripe · libregistry