{"id":28254947,"url":"https://github.com/chargebee/chargebee-python","last_synced_at":"2026-05-08T07:10:14.367Z","repository":{"id":4942950,"uuid":"6100101","full_name":"chargebee/chargebee-python","owner":"chargebee","description":"Python library for the Chargebee API.","archived":false,"fork":false,"pushed_at":"2026-03-27T06:17:47.000Z","size":2060,"stargazers_count":47,"open_issues_count":17,"forks_count":36,"subscribers_count":34,"default_branch":"master","last_synced_at":"2026-04-27T22:34:49.873Z","etag":null,"topics":["chargebee","python"],"latest_commit_sha":null,"homepage":" https://apidocs.chargebee.com/docs/api?lang=python","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/chargebee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","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":"2012-10-06T05:29:21.000Z","updated_at":"2026-04-22T18:07:25.000Z","dependencies_parsed_at":"2026-02-16T11:00:36.401Z","dependency_job_id":null,"html_url":"https://github.com/chargebee/chargebee-python","commit_stats":null,"previous_names":[],"tags_count":250,"template":false,"template_full_name":null,"purl":"pkg:github/chargebee/chargebee-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chargebee","download_url":"https://codeload.github.com/chargebee/chargebee-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chargebee%2Fchargebee-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32770591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"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":["chargebee","python"],"created_at":"2025-05-19T20:16:31.331Z","updated_at":"2026-05-08T07:10:14.334Z","avatar_url":"https://github.com/chargebee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chargebee Python Client Library v3\n\n\u003e [!NOTE]\n\u003e [![Join Discord](https://img.shields.io/badge/Discord-Early%20Access-blue?logo=discord\u0026logoColor=white)](https://discord.gg/S3SXDzXHAg)\n\u003e\n\u003e We are trialing a Discord server for developers building with Chargebee. Limited spots are open on a first-come basis. Join [here](https://discord.gg/gpsNqnhDm2) if interested.\n\n\nThis is the official Python library for integrating with Chargebee.\n- 📘 For a complete reference of available APIs, check out our [API Documentation](https://apidocs.chargebee.com/docs/api/?lang=python).  \n- 🧪 To explore and test API capabilities interactively, head over to our [API Explorer](https://api-explorer.chargebee.com).\n\nIf you're upgrading from an older version please refer to the [Migration Guide](https://github.com/chargebee/chargebee-python/wiki/Migration-guide-for-v3)\n\n## Requirements\n\n- Python 3.11+\n\n## Installation\nInstall the latest version of the library with pip:\n\n```sh\npip install chargebee\n```\nInstall from source with:\n\n```sh\npython setup.py install\n```\n  \n## Documentation\n\nSee our [Python API Reference](https://apidocs.chargebee.com/docs/api?lang=python \"API Reference\").\n\n## Usage\n\nThe package needs to be configured with your site's API key, which is available under Configure Chargebee Section. Refer [here](https://www.chargebee.com/docs/2.0/api_keys.html) for more details.\n\n### Configuring chargebee client\n```python\nfrom chargebee import Chargebee\ncb_client = Chargebee(api_key=\"\", site=\"\")\n```\n\n### Configuring Timeouts\n\n```python\nfrom chargebee import Chargebee\ncb_client = Chargebee(api_key=\"api_key\", site=\"site\")\ncb_client.update_read_timeout_secs(3000)\ncb_client.update_connect_timeout_secs(5000)\n```\n\n### Configuring Retry Delays\n\n```python\nfrom chargebee import Chargebee\ncb_client = Chargebee(api_key=\"api_key\", site=\"site\")\ncb_client.update_export_retry_delay_ms(3000)\ncb_client.update_time_travel_retry_delay_ms(5000)\n```\n\n### Making API Request:\n\n```python  \n# Create a Customer\n\nresponse = cb_client.Customer.create(\n    cb_client.Customer.CreateParams(\n        first_name=\"John\",\n        last_name=\"Doe\",\n        email=\"john@test.com\",\n        locale=\"fr-CA\",\n        billing_address=cb_client.Customer.BillingAddress(\n            first_name=\"John\",\n            last_name=\" Doe\",\n            line1=\"PO Box 9999\",\n            city=\"Walnut\",\n            state=\"California\",\n            zip=\"91789\",\n            country=\"US\",\n        ),\n    )\n)\ncustomer = response.customer\ncard = response.card\n```\n\n### Async HTTP client\n\nStarting with version `3.9.0`, the Chargebee Python SDK can optionally be configured to use an asynchronous HTTP client which uses `asyncio` to perform non-blocking requests. This can be enabled by passing the `use_async_client=True` argument to the constructor:\n\n```python\ncb_client = Chargebee(api_key=\"api_key\", site=\"site\", use_async_client=True)\n```\n\nWhen configured to use the async client, all model methods return a coroutine, which will have to be awaited to get the response:\n\n```python\nasync def get_customers():\n    response = await cb_client.Customer.list(\n        cb_client.Customer.ListParams(\n            first_name=Filters.StringFilter(IS=\"John\")\n        )\n    )\n    return response\n```\n\nNote: The async methods will have to be wrapped in an event loop during invocation. For example, the `asyncio.run` method can be used to run the above example:\n\n```python\nimport asyncio\nresponse = asyncio.run(get_customers())\n```\n\n### List API Request With Filter\n\nFor pagination, `offset` is the parameter that is being used. The value used for this parameter must be the value returned in `next_offset` parameter from the previous API call.\n\n```python\nfrom chargebee import Filters\n\nresponse = cb_client.Customer.list(\n    cb_client.Customer.ListParams(\n        first_name=Filters.StringFilter(IS=\"John\")\n    )\n)\noffset = response.next_offset\nprint(offset)\n```\n\n### Using enums\n\nThere are two variants of enums in chargebee, \n- Global enums - These are defined globally and can be accessed across resources.\n- Resource specific enums - These are defined within a resource and can be accessed using the resource class name.\n\n```python\n# Global Enum\nimport chargebee\n\nresponse = cb_client.Customer.create(\n    cb_client.Customer.CreateParams(\n        first_name=\"John\",\n        auto_collection=chargebee.AutoCollection.ON,  # global enum\n    )\n)\nprint(response.customer)\n```\n```python\n# Resource Specific Enum\n\nresponse = cb_client.Customer.change_billing_date(\n    cb_client.Customer.ChangeBillingDateParams(\n        first_name=\"John\",\n        billing_day_of_week=cb_client.Customer.BillingDayOfWeek.MONDAY,  # resource specific enum\n    )\n)\nprint(response.customer)\n```\n\n### Using custom fields\n\n```python\nresponse = cb_client.Customer.create(\n    cb_client.Customer.CreateParams(\n        first_name=\"John\",\n        cf_host_url=\"https://john.com\",  # `cf_host_url` is a custom field in Customer object\n    )\n)\nprint(response.customer.cf_host_url)\n```\n\n### Creating an idempotent request:\n\n[Idempotency keys](https://apidocs.chargebee.com/docs/api/idempotency?prod_cat_ver=2) are passed along with request headers to allow a safe retry of POST requests. \n\n```python\nresponse = cb_client.Customer.create(\n    cb_client.Customer.CreateParams(\n        first_name=\"John\",\n        last_name=\"Doe\",\n        email=\"john@test.com\",\n        locale=\"fr-CA\",\n        billing_address=cb_client.Customer.BillingAddress(\n            first_name=\"John\",\n            last_name=\" Doe\",\n            line1=\"PO Box 9999\",\n            city=\"Walnut\",\n            state=\"California\",\n            zip=\"91789\",\n            country=\"US\",\n        ),\n    ),\n    None,\n    {\n        \"chargebee-idempotency-key\": \"\u003c\u003cUUID\u003e\u003e\"\n    },  # Replace \u003c\u003cUUID\u003e\u003e with a unique string\n)\ncustomer = response.customer\ncard = response.card\nresponseHeaders = response.headers  # Retrieves response headers\nprint(responseHeaders)\nidempotencyReplayedValue = response.is_idempotency_replayed  # Retrieves Idempotency replayed header value\nprint(idempotencyReplayedValue)\n```\n\n### Waiting for Process Completion \n\nThe response from the previous API call must be passed as an argument for `wait_for_export_completion()` or `wait_for_time_travel_completion()`\n\n```python\n# Wait For Export Completion\n\nfrom chargebee import Filters\n\nresponse = cb_client.Export.customers(\n    cb_client.Export.CustomersParams(\n        customer=cb_client.Export.CustomersCustomerParams(\n            first_name=Filters.StringFilter(IS=\"John\")\n        )\n    )\n)\nprint(cb_client.Export.wait_for_export_completion(response.export))\n```\n\n### Retry Handling\n\nChargebee's SDK includes built-in retry logic to handle temporary network issues and server-side errors. This feature is **disabled by default** but can be **enabled when needed**.\n\n#### Key features include:\n\n- **Automatic retries for specific HTTP status codes**: Retries are automatically triggered for status codes `500`, `502`, `503`, and `504`.\n- **Exponential backoff**: Retry delays increase exponentially to prevent overwhelming the server.\n- **Rate limit management**: If a `429 Too Many Requests` response is received with a `Retry-After` header, the SDK waits for the specified duration before retrying.\n  \u003e *Note: Exponential backoff and max retries do not apply in this case.*\n- **Customizable retry behavior**: Retry logic can be configured using the `retryConfig` parameter in the environment configuration.\n\n#### Example: Customizing Retry Logic\n\nYou can enable and configure the retry logic by passing a `retryConfig` object when initializing the Chargebee environment:\n\n```python\nfrom chargebee import Chargebee\nfrom chargebee.retry_config import RetryConfig\n\nretry_config = RetryConfig(\n    enabled=True,\n    max_retries=5,\n    delay_ms=1000,\n    retry_on=[500]\n)\ncb_client = Chargebee(api_key=\"api_key\", site=\"site\")\ncb_client.update_retry_config(retry_config)\n\n# ... your Chargebee API operations ...\n\n```\n\n#### Example: Rate Limit retry logic\n\nYou can enable and configure the retry logic for rate-limit by passing a `retryConfig` object when initializing the Chargebee environment:\n\n```python\nfrom chargebee import Chargebee\nfrom chargebee.retry_config import RetryConfig\n\nretry_config = RetryConfig(\n    enabled=True,\n    max_retries=5,\n    delay_ms=1000,\n    retry_on=[429]\n)\ncb_client = Chargebee(api_key=\"api_key\", site=\"site\")\ncb_client.update_retry_config(retry_config)\n\n# ... your Chargebee API operations ...\n\n```\n\n\n## Feedback\n\nIf you find any bugs or have any feedback, open an issue in this repository or email it to dx@chargebee.com\n\n## License\n\nSee the [LICENSE](./LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchargebee%2Fchargebee-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchargebee%2Fchargebee-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchargebee%2Fchargebee-python/lists"}