Skip to main content

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for integrateledger 0.1.1
File Size Uploaded Provenance Actions
integrateledger-0.1.1.tar.gz 5.5 kB With provenance Details for integrateledger-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for integrateledger 0.1.1
File Interpreter ABI Platform Actions
integrateledger-0.1.1-py3-none-any.whl Python 3 none any Details for integrateledger-0.1.1-py3-none-any.whl

Total release size: 11.5 kB

Release files / integrateledger-0.1.1.tar.gz

Download URL integrateledger-0.1.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
86ef586f93248212688df00e33eedd1da4ae2953389df59e4bc40ea5ee24b840
BLAKE2b-256 checksum
How to use checksums
e3f428f28de979ac3886fad4a72341193a91a37da9f3fc345a154f5bd0524c08
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 Oct 29, 2026.

Transparency log

Release files / integrateledger-0.1.1-py3-none-any.whl

Download URL integrateledger-0.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a1fc8e40747c135d894a812aceb6b835fa8cdb59d156932043f448cf4836177
BLAKE2b-256 checksum
How to use checksums
515702d1f1db61292fe25a407b35f821a613e45aae4e292294219d730d56d4be
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 Oct 29, 2026.

Transparency log

Security for integrateledger 0.1.1

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.

Select from 2 files

Attestation for integrateledger-0.1.1.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 Oct 29, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page