Skip to main content

Official Python SDK for the Linkbridge e-invoicing API

Project description

linkbridge (Python SDK)

Official Python client for the Linkbridge e-invoicing API. Mirrors the surface of the Go and Node SDKs against the same OpenAPI contract (tools/openapi/openapi.yaml).

  • Zero runtime dependencies — uses only the Python standard library so the package drops cleanly into Lambda layers, vendored POS firmware, and air-gapped merchant ERPs.
  • Sync API with explicit OAuth2 client-credentials handling and automatic token refresh.
  • Webhook signature verification with constant-time comparison and the same 5-minute clock-skew window enforced server-side.

Install

pip install linkbridge

Requires Python 3.9 or newer.

Quickstart

from linkbridge import LinkbridgeClient

client = LinkbridgeClient(
    base_url="https://api.linkbridge.ng",
    client_id="your-client-id",
    client_secret="your-client-secret",
    scopes=["invoices:write", "invoices:read"],
)

accepted = client.invoices.submit({
    "irn": "INV001-SVC01-20260601",
    "invoice_kind": "Standard",
    # …rest of the canonical NRS payload — see
    # packages/schema/invoice.schema.json
})
print(accepted["irn"], accepted["status"])

# Read back, paginate, retry, mutate payment status:
record   = client.invoices.get(accepted["irn"])
page     = client.invoices.list(limit=20, status="failed")
requeued = client.invoices.transmit(accepted["irn"])
paid     = client.invoices.update_status(accepted["irn"],
              payment_status="PAID", reference="RCPT-001")

Webhook verification

from linkbridge import verify_webhook, SignatureError

@app.post("/hooks/linkbridge")
def hook(request):
    try:
        verify_webhook(
            secret=os.environ["WEBHOOK_SECRET"].encode(),
            body=request.body,                     # raw bytes off the wire
            header=request.headers["X-Linkbridge-Signature"],
        )
    except SignatureError:
        return 401
    # …handle the event

Errors

All non-2xx responses raise linkbridge.APIError, which exposes the HTTP status, the canonical error.code, the human error.message, and the trace_id so that operators can correlate against server logs.

Versioning

The package follows the same 0.MINOR.PATCH cadence as the API surface during the beta. Breaking changes will be confined to MINOR bumps until the API freezes at 1.0.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linkbridge-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linkbridge-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file linkbridge-0.1.0.tar.gz.

File metadata

  • Download URL: linkbridge-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for linkbridge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d4ce507e0766b12ffbde6bb62d4ec8b4b701836356cb089f57bd05633e714eb3
MD5 a46192fa7a023771bb2228db18a3c875
BLAKE2b-256 41076ce4a0197dfdc349bcd5af53ff502d49af7450ca8c75b44874a6919c11ed

See more details on using hashes here.

File details

Details for the file linkbridge-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: linkbridge-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for linkbridge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10509549100b08bde4dbcd8861658c5a8be826fb5f454155be47c8bfe9b2d73e
MD5 c0c6c88cbd05f9b3913c7363d33a683d
BLAKE2b-256 b2826d3df70b560b1383f307722c9f40b7bea4537ff99366e71085722a570896

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page