integrateledger
The server-side Python SDK for Ledger's billing and usage API. Install it with
python3 -m pip install integrateledger, then use
from integrateledger import ledger. The capitalized Ledger class and
ledger_sdk import remain available for existing source users. See the
Ledger quickstart for examples.
From a repository checkout, run the SDK tests with:
python3 -m pip install ./packages/sdk-python
python3 -m unittest discover -s packages/sdk-python/tests -v
import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.create_feature(id="api_call", name="API call", credit_cost=1)
client.create_plan(id="starter", name="Starter", monthly_credits=100, monthly_price_cents=0)
client.create_or_get_customer(customer_id="buyer_123")
client.attach(customer_id="buyer_123", plan_id="starter")
customer = client.get_customer(customer_id="buyer_123")
print(customer["availableCredits"])
if client.check_credits(customer_id="buyer_123", feature_id="api_call")["allowed"]:
client.track_usage(customer_id="buyer_123", feature_id="api_call", request_id="buyer_123_first_call")
Methods return response dictionaries and use Python snake_case arguments. The client maps them to Ledger's JSON contract and sends the organization key in the Authorization header. Pass base_url="http://127.0.0.1:3001" for a local API.
Use a ledger_test_ key for Sandbox or a ledger_live_ key for Live. The key chooses the environment; the client methods and API URL stay the same. Store these keys in separate server-side variables, and complete sandbox validation before enabling live payments.
Metadata
Release files for integrateledger 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| integrateledger-0.1.2.tar.gz | 6.3 kB | With provenance | Details for integrateledger-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| integrateledger-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for integrateledger-0.1.2-py3-none-any.whl |
Total release size: 13.1 kB
Release files / integrateledger-0.1.2.tar.gz
| Download URL | integrateledger-0.1.2.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cef6a4060fd8bad0f7f2da6ccd995a87e1063e07e64740b12a1af94171415a97
|
|
BLAKE2b-256 checksum How to use checksums |
62d4f853367470ffb7c6744490c3fafde235f8150c240cd9c14f5ff9dfb30e2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / integrateledger-0.1.2-py3-none-any.whl
| Download URL | integrateledger-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea92f823cc1aad68cf83ddbc76c58b252c4de6f2fccb25f556a9e3e8b8607524
|
|
BLAKE2b-256 checksum How to use checksums |
8eea1c22aa476f7d59e37a9db491f079f0853277cd56e83ac67b040e9ecad0b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for integrateledger 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for integrateledger-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.