{"id":74,"library":"stripe","title":"Stripe","description":"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.","status":"active","version":"14.2.0","language":"python","source_language":"en","source_url":"https://github.com/stripe/stripe-python","tags":["payments","stripe","billing","subscriptions","python","api"],"install":[{"cmd":"pip install stripe","lang":"bash","label":"Python"}],"dependencies":[{"reason":"Default HTTP client. Can be swapped for aiohttp via StripeClient.","package":"requests","optional":false}],"imports":[{"note":"Top-level import recommended. Direct class imports work but are less idiomatic and miss global api_key propagation for some patterns.","wrong":"from stripe import PaymentIntent\nPaymentIntent.create(...)","symbol":"stripe","correct":"import stripe\nstripe.api_key = 'sk_live_...'\npi = stripe.PaymentIntent.create(amount=2000, currency='usd')"},{"note":"StripeClient is the new explicit client pattern introduced in v7+. Preferred for multi-key setups and async usage. Old global api_key pattern still works but is discouraged.","wrong":"stripe.api_key = '...'\nstripe.PaymentIntent.create(...)","symbol":"StripeClient (v10+)","correct":"from stripe import StripeClient\nclient = StripeClient('sk_live_...')\npi = client.payment_intents.create({'amount': 2000, 'currency': 'usd'})"}],"quickstart":{"code":"import stripe\n\nstripe.api_key = 'sk_test_...'\n\n# Create a payment intent\npi = stripe.PaymentIntent.create(\n    amount=2000,\n    currency='usd',\n    payment_method_types=['card']\n)\nprint(pi.client_secret)\n\n# Verify webhook\nimport stripe.webhook\nevent = stripe.Webhook.construct_event(\n    payload=request.body,\n    sig_header=request.headers['Stripe-Signature'],\n    secret='whsec_...'\n)","lang":"python","description":"Basic payment intent creation and webhook verification. Always verify webhook signatures — do not trust payload content without verification."},"warnings":[{"fix":"Update InvoiceLineItem.modify(invoice='in_...', line_item_id='il_...', params={})","message":"SDK 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.","severity":"breaking","affected_versions":"< 14.0.0"},{"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.","message":"Stripe 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.","severity":"breaking","affected_versions":"all"},{"fix":"Update mock server expectations for v2 endpoint include params to use indexed format.","message":"V2 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.","severity":"breaking","affected_versions":">= 13.1.0"},{"fix":"Use StripeClient(api_key='...') instances per request for multi-tenant applications.","message":"stripe.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.","severity":"gotcha","affected_versions":"all"},{"fix":"Use secret keys (sk_live_... or sk_test_...) in the Python SDK.","message":"Publishable keys (pk_live_..., pk_test_...) are for Stripe.js front-end only. Using them server-side in the Python SDK returns 401 Unauthorized.","severity":"gotcha","affected_versions":"all"},{"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.","message":"Webhook 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.","severity":"gotcha","affected_versions":"all"},{"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.","message":"The '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.","severity":"breaking","affected_versions":"all"},{"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\"`.","message":"The `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`.","severity":"breaking","affected_versions":"all"}],"env_vars":{"optional":[{"name":"STRIPE_WEBHOOK_SECRET","note":"Used for webhook signature verification (whsec_...). Different per endpoint."}],"required":[{"name":"STRIPE_API_KEY","note":"Secret key (sk_live_... or sk_test_...). Never use publishable key (pk_...) server-side."}]},"last_verified":"2026-05-12T07:26:25.950Z","next_check":"2026-04-01T00:00:00.000Z","problems":[{"fix":"pip install stripe","cause":"The Stripe Python library is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'stripe'"},{"fix":"Verify your secret API key (e.g., sk_test_XYZ or sk_live_ABC) in your Stripe dashboard and ensure it's correctly assigned to `stripe.api_key`.","cause":"The API key configured for the Stripe SDK is incorrect, revoked, or has insufficient permissions, or you might be using a publishable key (pk_) where a secret key (sk_) is required.","error":"stripe.error.AuthenticationError: Invalid API Key provided: sk_test_******************** (HINT: API keys start with 'pk_' or 'sk_'; 'sk_test_' and 'sk_live_' keys are secret.)"},{"fix":"Verify the object ID is correct and belongs to the API key environment (test or live) you are currently using for your API requests.","cause":"The Stripe object ID (e.g., customer, Payment Intent, Charge) provided in the API call does not exist, is misspelled, or belongs to a different API key mode (e.g., using a test ID with a live key).","error":"stripe.error.InvalidRequestError: No such customer: cus_XYZ"},{"fix":"To create a checkout session, use `stripe.checkout.Session.create(...)`.","cause":"You are attempting to access `stripe.checkout` as a direct attribute or module for creating a checkout session, but the `Session` object is nested under it.","error":"AttributeError: module 'stripe' has no attribute 'checkout'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.16,"mem_mb":6.7,"disk_size":"43.3M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.12,"mem_mb":6.7,"disk_size":"44M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.26,"mem_mb":7.6,"disk_size":"47.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.23,"mem_mb":7.6,"disk_size":"47M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.48,"mem_mb":8.8,"disk_size":"37.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.46,"mem_mb":8.8,"disk_size":"38M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.47,"mem_mb":9.3,"disk_size":"37.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.41,"mem_mb":9.3,"disk_size":"38M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.14,"mem_mb":6.6,"disk_size":"42.1M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.14,"mem_mb":6.6,"disk_size":"43M"}]},"quickstart_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}