{"id":13572378,"url":"https://github.com/stripe/stripe-python","last_synced_at":"2026-04-01T17:44:08.470Z","repository":{"id":1557335,"uuid":"1953389","full_name":"stripe/stripe-python","owner":"stripe","description":"Python library for the Stripe API.    ","archived":false,"fork":false,"pushed_at":"2026-03-05T00:07:12.000Z","size":31230,"stargazers_count":1956,"open_issues_count":20,"forks_count":495,"subscribers_count":38,"default_branch":"master","last_synced_at":"2026-03-05T03:41:08.763Z","etag":null,"topics":["stripe","stripe-sdk"],"latest_commit_sha":null,"homepage":"https://stripe.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stripe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2011-06-25T19:53:04.000Z","updated_at":"2026-03-02T20:07:02.000Z","dependencies_parsed_at":"2026-03-11T22:01:19.897Z","dependency_job_id":null,"html_url":"https://github.com/stripe/stripe-python","commit_stats":{"total_commits":1278,"total_committers":135,"mean_commits":9.466666666666667,"dds":0.8262910798122065,"last_synced_commit":"5c002d3ebfbfd65f365191dd5173edcb3f08b761"},"previous_names":[],"tags_count":532,"template":false,"template_full_name":null,"purl":"pkg:github/stripe/stripe-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Fstripe-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Fstripe-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Fstripe-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Fstripe-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stripe","download_url":"https://codeload.github.com/stripe/stripe-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe%2Fstripe-python/sbom","scorecard":{"id":855327,"data":{"date":"2025-08-11","repo":{"name":"github.com/stripe/stripe-python","commit":"68adcec4f2ed8bdc1d9a0676722a63884ed80df3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.7,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Code-Review","score":9,"reason":"Found 18/20 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":10,"reason":"14 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/rules.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/stripe/.github/SECURITY.md:1","Info: Found linked content: github.com/stripe/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/stripe/.github/SECURITY.md:1","Info: Found text in security policy: github.com/stripe/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":8,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Warn: required approving review count is 1 on branch 'master'","Warn: codeowners review is not required on branch 'master'","Info: status check found to merge onto on branch 'master'","Info: PRs are required in order to make changes on branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2023-120 / GHSA-45c4-8wx5-qw6w","Warn: Project is vulnerable to: GHSA-5m98-qgg9-wh84","Warn: Project is vulnerable to: GHSA-7gpw-8wmc-pm8g","Warn: Project is vulnerable to: GHSA-8495-4g3g-x7pr","Warn: Project is vulnerable to: PYSEC-2024-26 / GHSA-8qpw-xqxj-h4r2","Warn: Project is vulnerable to: GHSA-9548-qrrj-x5pj","Warn: Project is vulnerable to: PYSEC-2023-246 / GHSA-gfw2-4jvh-wgfg","Warn: Project is vulnerable to: GHSA-pjjw-qhg8-p2p9","Warn: Project is vulnerable to: PYSEC-2023-250 / GHSA-q3qx-c6g2-7pw2","Warn: Project is vulnerable to: PYSEC-2023-251 / GHSA-qvrw-v9rv-5rjx","Warn: Project is vulnerable to: PYSEC-2021-76 / GHSA-v6wp-4m6f-gcjg","Warn: Project is vulnerable to: PYSEC-2023-247 / GHSA-xx9p-xxvh-7g8j","Warn: Project is vulnerable to: PYSEC-2022-183 / GHSA-h8pj-cxx2-jfg2"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:91: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:94: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:97: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:111: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:112: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:114: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:119: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:147: update your workflow using https://app.stepsecurity.io/secureworkflow/stripe/stripe-python/ci.yml/master?enable=pin","Info:   0 out of  10 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}}]},"last_synced_at":"2025-08-23T23:46:03.226Z","repository_id":1557335,"created_at":"2025-08-23T23:46:03.226Z","updated_at":"2025-08-23T23:46:03.226Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30404072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T21:51:19.558Z","status":"ssl_error","status_checked_at":"2026-03-11T21:50:57.892Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["stripe","stripe-sdk"],"created_at":"2024-08-01T14:01:21.604Z","updated_at":"2026-04-01T17:44:08.462Z","avatar_url":"https://github.com/stripe.png","language":"Python","funding_links":[],"categories":["Python","API Clients \u0026 SDKs","Third-party Web APIs"],"sub_categories":["Official SDKs"],"readme":"# Stripe Python Library\n\n[![pypi](https://img.shields.io/pypi/v/stripe.svg)](https://pypi.python.org/pypi/stripe)\n[![Build Status](https://github.com/stripe/stripe-python/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-python/actions?query=branch%3Amaster)\n\n\u003e [!TIP]\n\u003e Want to chat live with Stripe engineers? Join us on our [Discord server](https://stripe.com/go/discord/python).\n\nThe Stripe Python library provides convenient access to the Stripe API from\napplications written in the Python language. It includes a pre-defined set of\nclasses for API resources that initialize themselves dynamically from API\nresponses which makes it compatible with a wide range of versions of the Stripe\nAPI.\n\n## API Documentation\n\nSee the [Python API docs](https://stripe.com/docs/api?lang=python).\n\n## Installation\n\nThis package is available on PyPI:\n\n```sh\npip install --upgrade stripe\n```\n\nAlternatively, install from source with:\n\n```sh\npython -m pip install .\n```\n\n### Requirements\n\nPer our [Language Version Support Policy](https://docs.stripe.com/sdks/versioning?lang=python#stripe-sdk-language-version-support-policy), we currently support **Python 3.9+**.\n\nRead more and see the full schedule in the docs: https://docs.stripe.com/sdks/versioning?lang=python#stripe-sdk-language-version-support-policy\n\n#### Extended Support\n\n#### Python 2.7 deprecation\n\n[The Python Software Foundation (PSF)](https://www.python.org/psf-landing/) community [announced the end of support of Python 2](https://www.python.org/doc/sunset-python-2/) on 01 January 2020.\nStarting with version 6.0.0 Stripe SDK Python packages will no longer support Python 2.7. To continue to get new features and security updates, please make sure to update your Python runtime to Python 3.6+.\n\nThe last version of the Stripe SDK that supported Python 2.7 was **5.5.0**.\n\n## Usage\n\nThe library needs to be configured with your account's secret key which is\navailable in your [Stripe Dashboard][api-keys]. Set `stripe.api_key` to its\nvalue:\n\n```python\nfrom stripe import StripeClient\n\nclient = StripeClient(\"sk_test_...\")\n\n# list customers\ncustomers = client.v1.customers.list()\n\n# print the first customer's email\nprint(customers.data[0].email)\n\n# retrieve specific Customer\ncustomer = client.v1.customers.retrieve(\"cus_123456789\")\n\n# print that customer's email\nprint(customer.email)\n```\n\n### StripeClient vs legacy pattern\n\nWe introduced the `StripeClient` class in v8 of the Python SDK. The legacy pattern used prior to that version is still available to use but will be marked as deprecated soon. Review the [migration guide to use StripeClient](\u003chttps://github.com/stripe/stripe-python/wiki/Migration-guide-for-v8-(StripeClient)\u003e) to move from the legacy pattern.\n\nOnce the legacy pattern is deprecated, new API endpoints will only be accessible in the StripeClient. While there are no current plans to remove the legacy pattern for existing API endpoints, this may change in the future.\n\n### Handling exceptions\n\nUnsuccessful requests raise exceptions. The class of the exception will reflect\nthe sort of error that occurred. Please see the [Api\nReference](https://stripe.com/docs/api/errors/handling) for a description of\nthe error classes you should handle, and for information on how to inspect\nthese errors.\n\n### Per-request Configuration\n\nConfigure individual requests with the `options` argument. For example, you can make\nrequests with a specific [Stripe Version](https://stripe.com/docs/api#versioning)\nor as a [connected account](https://stripe.com/docs/connect/authentication#authentication-via-the-stripe-account-header):\n\n```python\nfrom stripe import StripeClient\n\nclient = StripeClient(\"sk_test_...\")\n\n# list customers\nclient.v1.customers.list(\n    options={\n        \"api_key\": \"sk_test_...\",\n        \"stripe_account\": \"acct_...\",\n        \"stripe_version\": \"2019-02-19\",\n    }\n)\n\n# retrieve single customer\nclient.v1.customers.retrieve(\n    \"cus_123456789\",\n    options={\n        \"api_key\": \"sk_test_...\",\n        \"stripe_account\": \"acct_...\",\n        \"stripe_version\": \"2019-02-19\",\n    }\n)\n```\n\n### Configuring an HTTP Client\n\nYou can configure your `StripeClient` to use `urlfetch`, `requests`, `pycurl`, or\n`urllib` with the `http_client` option:\n\n```python\nclient = StripeClient(\"sk_test_...\", http_client=stripe.UrlFetchClient())\nclient = StripeClient(\"sk_test_...\", http_client=stripe.RequestsClient())\nclient = StripeClient(\"sk_test_...\", http_client=stripe.PycurlClient())\nclient = StripeClient(\"sk_test_...\", http_client=stripe.UrllibClient())\n```\n\nWithout a configured client, by default the library will attempt to load\nlibraries in the order above (i.e. `urlfetch` is preferred with `urllib2` used\nas a last resort). We usually recommend that people use `requests`.\n\n### Configuring a Proxy\n\nA proxy can be configured with the `proxy` client option:\n\n```python\nclient = StripeClient(\"sk_test_...\", proxy=\"https://user:pass@example.com:1234\")\n```\n\n### Configuring Automatic Retries\n\nYou can enable automatic retries on requests that fail due to a transient\nproblem by configuring the maximum number of retries:\n\n```python\nclient = StripeClient(\"sk_test_...\", max_network_retries=2)\n```\n\nVarious errors can trigger a retry, like a connection error or a timeout, and\nalso certain API responses like HTTP status `409 Conflict`.\n\n[Idempotency keys][idempotency-keys] are automatically generated and added to\nrequests, when not given, to guarantee that retries are safe.\n\n### Logging\n\nThe library can be configured to emit logging that will give you better insight\ninto what it's doing. The `info` logging level is usually most appropriate for\nproduction use, but `debug` is also available for more verbosity.\n\nThere are a few options for enabling it:\n\n1. Set the environment variable `STRIPE_LOG` to the value `debug` or `info`\n\n    ```sh\n    $ export STRIPE_LOG=debug\n    ```\n\n2. Set `stripe.log`:\n\n    ```python\n    import stripe\n    stripe.log = 'debug'\n    ```\n\n3. Enable it through Python's logging module:\n\n    ```python\n    import logging\n    logging.basicConfig()\n    logging.getLogger('stripe').setLevel(logging.DEBUG)\n    ```\n\n### Accessing response code and headers\n\nYou can access the HTTP response code and headers using the `last_response` property of the returned resource.\n\n```python\ncustomer = client.v1.customers.retrieve(\n    \"cus_123456789\"\n)\n\nprint(customer.last_response.code)\nprint(customer.last_response.headers)\n```\n\n### How to use undocumented parameters and properties\n\nIn some cases, you might encounter parameters on an API request or fields on an API response that aren’t available in the SDKs.\nThis might happen when they’re undocumented or when they’re in preview and you aren’t using a preview SDK.\nSee [undocumented params and properties](https://docs.stripe.com/sdks/server-side?lang=python#undocumented-params-and-fields) to send those parameters or access those fields.\n\n### Writing a Plugin\n\nIf you're writing a plugin that uses the library, we'd appreciate it if you\nidentified using `stripe.set_app_info()`:\n\n```py\nstripe.set_app_info(\"MyAwesomePlugin\", version=\"1.2.34\", url=\"https://myawesomeplugin.info\")\n```\n\nThis information is passed along when the library makes calls to the Stripe\nAPI.\n\n### Telemetry\n\nBy default, the library sends telemetry to Stripe regarding request latency and feature usage. These\nnumbers help Stripe improve the overall latency of its API for all users, and\nimprove popular features.\n\nYou can disable this behavior if you prefer:\n\n```python\nstripe.enable_telemetry = False\n```\n\n## Types\n\nIn [v7.1.0](https://github.com/stripe/stripe-python/releases/tag/v7.1.0) and\nnewer, the\nlibrary includes type annotations. See [the wiki](https://github.com/stripe/stripe-python/wiki/Inline-type-annotations)\nfor a detailed guide.\n\nPlease note that some annotations use features that were only fairly recently accepted,\nsuch as [`Unpack[TypedDict]`](https://peps.python.org/pep-0692/#specification) that was\n[accepted](https://discuss.python.org/t/pep-692-using-typeddict-for-more-precise-kwargs-typing/17314/81)\nin January 2023. We have tested that these types are recognized properly by [Pyright](https://github.com/microsoft/pyright).\nSupport for `Unpack` in MyPy is still experimental, but appears to degrade gracefully.\nPlease [report an issue](https://github.com/stripe/stripe-python/issues/new/choose) if there\nis anything we can do to improve the types for your type checker of choice.\n\n### Types and the Versioning Policy\n\nWe release type changes in minor releases. While stripe-python follows semantic\nversioning, our semantic versions describe the _runtime behavior_ of the\nlibrary alone. Our _type annotations are not reflected in the semantic\nversion_. That is, upgrading to a new minor version of stripe-python might\nresult in your type checker producing a type error that it didn't before. You\ncan use a `~=x.x` or `x.x.*` [version specifier](https://peps.python.org/pep-0440/#examples)\nin your `requirements.txt` to constrain `pip` to a certain minor range of `stripe-python`.\n\n### Types and API Versions\n\nThe types describe the [Stripe API version](https://stripe.com/docs/api/versioning)\nthat was the latest at the time of release. This is the version that your library\nsends by default. If you are overriding `stripe.api_version` / `stripe_version` on the `StripeClient`, or using a\n[webhook endpoint](https://stripe.com/docs/webhooks#api-versions) tied to an older version,\nbe aware that the data you see at runtime may not match the types.\n\n### Public Preview SDKs\n\nStripe has features in the [public preview phase](https://docs.stripe.com/release-phases) that can be accessed via versions of this package that have the `bX` suffix like `12.2.0b2`.\nWe would love for you to try these as we incrementally release new features and improve them based on your feedback.\n\nTo install, pick the latest version with the `bX` suffix by reviewing the [releases page](https://github.com/stripe/stripe-python/releases/) and then use it in the `pip install` command:\n\n```\npip install stripe==\u003creplace-with-the-version-of-your-choice\u003e\n```\n\n\u003e **Note**\n\u003e There can be breaking changes between two versions of the public preview SDKs without a bump in the major version. Therefore we recommend pinning the package version to a specific version in your [pyproject.toml](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#dependencies-and-requirements) or [requirements file](https://pip.pypa.io/en/stable/user_guide/#requirements-files). This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest public preview SDK.\n\nSome preview features require a name and version to be set in the `Stripe-Version` header like `feature_beta=v3`. If your preview feature has this requirement, use the `stripe.add_beta_version` function (available only in the public preview SDKs):\n\n```python\nstripe.add_beta_version(\"feature_beta\", \"v3\")\n```\n\n### Private Preview SDKs\n\nStripe 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.\n\n### Custom requests\n\n\u003e This feature is only available from version 11 of this SDK.\n\nIf you would like to send a request to an undocumented API (for example you are in a private beta), or if you prefer to bypass the method definitions in the library and specify your request details directly, you can use the `raw_request` method on `StripeClient`.\n\n```python\nclient = StripeClient(\"sk_test_...\")\nresponse = client.raw_request(\n    \"post\", \"/v1/beta_endpoint\", param=123, stripe_version=\"2022-11-15; feature_beta=v3\"\n)\n\n# (Optional) response is a StripeResponse. You can use `client.deserialize` to get a StripeObject.\ndeserialized_resp = client.deserialize(response, api_mode='V1')\n```\n\n### Async\n\nAsynchronous versions of request-making methods are available by suffixing the method name\nwith `_async`.\n\n```python\n# With StripeClient\nclient = StripeClient(\"sk_test_...\")\ncustomer = await client.v1.customers.retrieve_async(\"cus_xyz\")\n\n# With global client\nstripe.api_key = \"sk_test_...\"\ncustomer = await stripe.Customer.retrieve_async(\"cus_xyz\")\n\n# .auto_paging_iter() implements both AsyncIterable and Iterable\nasync for c in await stripe.Customer.list_async().auto_paging_iter():\n  ...\n```\n\nThere is no `.save_async` as `.save` is [deprecated since stripe-python v5](https://github.com/stripe/stripe-python/wiki/Migration-guide-for-v5#deprecated). Please migrate to `.modify_async`.\n\nThe default HTTP client uses `requests` for making synchronous requests but\n`httpx` for making async requests. If you're migrating to async, we recommend\nyou to explicitly initialize your own http client and pass it to StripeClient\nor set it as the global default.\n\nIf you don't already have a dependency on an async-compatible HTTP library, `pip install stripe[async]` will install one for you (new in `v13.0.1`).\n\n```python\n# By default, an explicitly initialized HTTPXClient will raise an exception if you\n# attempt to call a sync method. If you intend to only use async, this is useful to\n# make sure you don't unintentionally make a synchronous request.\nmy_http_client = stripe.HTTPXClient()\n\n# If you want to use httpx to make sync requests, you can disable this\n# behavior.\nmy_http_client = stripe.HTTPXClient(allow_sync_methods=True)\n\n# aiohttp is also available (does not support sync requests)\nmy_http_client = stripe.AIOHTTPClient()\n\n# With StripeClient\nclient = StripeClient(\"sk_test_...\", http_client=my_http_client)\n\n# With the global client\nstripe.default_http_client = my_http_client\n```\n\nYou can also subclass `stripe.HTTPClient` and provide your own instance.\n\n## Support\n\nNew features and bug fixes are released on the latest major version of the Stripe Python library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.\n\n## Development\n\n[Contribution guidelines for this project](CONTRIBUTING.md)\n\nThe test suite depends on [stripe-mock], so make sure to fetch and run it from a\nbackground terminal ([stripe-mock's README][stripe-mock] also contains\ninstructions for installing via Homebrew and other methods):\n\n```sh\ngo install github.com/stripe/stripe-mock@latest\nstripe-mock\n```\n\nWe use [just](https://github.com/casey/just) for conveniently running development tasks. You can use them directly, or copy the commands out of the `justfile`. To our help docs, run `just`. By default, all commands will use an virtualenv created by your default python version (whatever comes out of `python --version`). We recommend using [mise](https://mise.jdx.dev/lang/python.html) or [pyenv](https://github.com/pyenv/pyenv) to control that version.\n\nRun the following command to set up the development virtualenv:\n\n```sh\njust venv\n# or: python -m venv venv  \u0026\u0026 venv/bin/python -I -m pip install -e .\n```\n\nRun all tests:\n\n```sh\njust test\n# or: venv/bin/pytest\n```\n\nRun all tests in a single file:\n\n```sh\njust test tests/api_resources/abstract/test_updateable_api_resource.py\n# or: venv/bin/pytest tests/api_resources/abstract/test_updateable_api_resource.py\n```\n\nRun a single test suite:\n\n```sh\njust test tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource\n# or: venv/bin/pytest tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource\n```\n\nRun a single test:\n\n```sh\njust test tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource::test_save\n# or: venv/bin/pytest tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource::test_save\n```\n\nRun the linter with:\n\n```sh\njust lint\n# or: venv/bin/python -m flake8 --show-source stripe tests\n```\n\nThe library uses [Ruff][ruff] for code formatting. Code must be formatted\nwith Black before PRs are submitted, otherwise CI will fail. Run the formatter\nwith:\n\n```sh\njust format\n# or: venv/bin/ruff format . --quiet\n```\n\nUpdate bundled CA certificates from the [Mozilla cURL release][curl]:\n\n```sh\njust update-certs\n```\n\n[api-keys]: https://dashboard.stripe.com/account/apikeys\n[ruff]: https://github.com/astral-sh/ruff\n[connect]: https://stripe.com/connect\n[poetry]: https://github.com/sdispater/poetry\n[stripe-mock]: https://github.com/stripe/stripe-mock\n[idempotency-keys]: https://stripe.com/docs/api/idempotent_requests?lang=python\n\n\u003c!--\n# vim: set tw=79:\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstripe%2Fstripe-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstripe%2Fstripe-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstripe%2Fstripe-python/lists"}