Scan your whole stack
Are you using integrateledger?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.4.0
integrateledger was last scanned on 23 Nov 2026 at version 0.4.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.4.0 LATEST | 23 Nov 2026 | No rules fired |
| 0.3.0 | 18 Nov 2026 | No rules fired |
| 0.2.0 | 18 Nov 2026 | No rules fired |
| 0.1.2 | 5 Nov 2026 | Not shown |
| 0.1.1 | 29 Oct 2026 | Not shown |
Findings for v0.4.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.4.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
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 setup guide for examples.
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.
The client reuses connections between calls, so create one and share it, across threads too. Close it when you're done with close(), or use it in a with block:
with ledger(api_key=os.environ["LEDGER_API_KEY"]) as client:
client.check_credits(customer_id="buyer_123", feature_id="api_call")
Behind a proxy set by HTTPS_PROXY or HTTP_PROXY (and not excluded by NO_PROXY), calls go through the proxy without reusing connections.
For FastAPI, Starlette, async Django and other asyncio apps, use AsyncLedger. It has every method of Ledger, with the same arguments, answers, errors and fail open, as coroutines, so there's no need for asyncio.to_thread. It is standard library only too, and reuses connections between calls. Create one client for the app and close it on shutdown:
import os
from contextlib import asynccontextmanager
from fastapi import FastAPI
from integrateledger import AsyncLedger
ledger_client = AsyncLedger(api_key=os.environ["LEDGER_API_KEY"])
@asynccontextmanager
async def lifespan(app: FastAPI):
yield
await ledger_client.flush_queued_tracks()
await ledger_client.close()
app = FastAPI(lifespan=lifespan)
@app.post("/generate")
async def generate(user_id: str, job_id: str):
decision = await ledger_client.check_credits(customer_id=user_id, feature_id="api_call")
if not decision["allowed"]:
return {"error": "out_of_credits"}
result = ... # the work
await ledger_client.track_usage(customer_id=user_id, feature_id="api_call", request_id=job_id)
return result
async with AsyncLedger(...) as client: closes it for you. Use a client on one event loop at a time. Its timeout bounds each whole call, where Ledger's bounds each socket read or write. Behind a proxy, or when the base URL redirects, a call runs through urllib on a worker thread, as Ledger does.
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.
Errors are raised as LedgerAPIError (status, code, body, headers), or LedgerConnectionError when Ledger cannot be reached. A 429 raises LedgerRateLimitError, whose retry_after is the seconds to wait before sending the same request again, and a 413 raises LedgerPayloadTooLargeError.
For work whose cost you only know afterwards, such as an LLM run, hold an estimate when you check and settle the real cost when you track. Pass the same request_id to both:
decision = client.check_credits(
customer_id="buyer_123", feature_id="llm_run", request_id="run_42",
reserve={"credits": 500, "expires_in_seconds": 600},
)
if not decision["allowed"]:
raise PermissionError(decision["reason"]) # nothing was held
cost = ... # the work, and what it really cost in credits
client.track_usage(customer_id="buyer_123", feature_id="llm_run", request_id="run_42", settle_credits=cost)
An allowed check returns reservation (requestId, credits, expiresAt); both reserve keys are optional, defaulting to the feature's credit cost and an hour. request_id is required with reserve. The track settles the reservation at settle_credits and releases the rest of the hold; without a reservation, settle_credits is charged instead of the feature's cost. If the work doesn't run, client.release_reservation(customer_id=..., request_id=...) lets the hold go, and client.get_reservation(...) reads it. A hold that isn't settled lapses at expiresAt.
A check with reserve never fails open: it raises LedgerConnectionError or LedgerAPIError as with fail_open=False, because it guards expensive work. A settling track fails open like any track, and is replayed with its settle_credits.
When Ledger can't answer (a network error, a timeout after 2 seconds, a 5xx or a 429), check_credits returns allowed: True and track_usage queues the usage for replay with the same request_id, both marked "failedOpen": True with a reason, instead of raising. Business answers such as 409 insufficient_credits are raised as usual. Call client.flush_queued_tracks() (or await it on AsyncLedger) before a worker exits, pass fail_open=FailOpen(on_fail_open=...) to log events, or fail_open=False to raise. See Fail open.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.