Skip to main content

Merchant SDK for the HonorNet agent-transaction acceptance network

Project description

honornet-sdk

The Python merchant SDK for the HonorNet acceptance network — authorize AI-agent-initiated transactions in real time.

Async-first, with a synchronous wrapper. Pure Python, no native dependencies.

Install

pip install honornet-sdk

Authorize a transaction

from honornet import Client, Money, Transaction

client = Client("https://api.honornet.ai", api_key="sk_live_...")

result = client.authorize(
    credential=agent_credential,            # presented by the agent
    transaction=Transaction(
        merchant_id="merchant_123",
        amount=Money("USD", 4999),          # integer minor units
        merchant_category_code="5732",
        country="US",
    ),
)

if result.approved:
    fulfil_order(result.authorization_code)
else:
    handle_decline(result.decline_reason)

authorize returns an AuthorizeResult for every outcome — approve, decline, or review. Call result.raise_for_decision() to turn a non-approval into a typed exception (ScopeDeclinedError, CredentialDeclinedError, …) instead.

Async

from honornet import AsyncClient

async with AsyncClient("https://api.honornet.ai") as client:
    result = await client.authorize(credential=cred, transaction=txn)

Verify a decision

Every decision is recorded in HonorNet's append-only, cryptographically verifiable log. Confirm one independently — record signature, Merkle inclusion proof, signed log root, and that the signing key is a genuine published HonorNet ledger key — with the public honornet-verify library:

from honornet import verify_decision

# Trust-anchored to the published HonorNet key-set by default.
verified = verify_decision(client, result.decision_id)
assert verified.verification.ok and verified.trust_anchored

Pass trusted_keys= to pin to a different key-set (e.g. a sandbox ledger), or trusted_keys=None for structural-only verification. Verification adds a round trip, so latency-sensitive paths skip it and verify out of band.

Built in

  • Idempotency — every call carries an auto-generated idempotency key, so a retried request never creates a second decision. Override it with idempotency_key=....
  • Retries — connection errors, timeouts, HTTP 429 and 5xx are retried up to three times with exponential backoff.
  • Typed errors — transport failures raise HonorNet*Error; declines map to DeclinedError subclasses; DeclineReason enumerates the full taxonomy.

Framework middleware

Drop-in middleware for FastAPI lives at honornet.middleware.fastapi — see examples/fastapi-middleware.

Licence

Apache-2.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

honornet_sdk-0.2.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

honornet_sdk-0.2.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file honornet_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: honornet_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for honornet_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7bc2f0dd8b71e9831780df05ca25485c5fb330277cbd5183e6121c973519b2d5
MD5 07fbeaaf71fd9c16142ef18033e187d9
BLAKE2b-256 a7020ac55f2f5773c34bd1fdcbc29e95537de2847155b223eeb8af2e4ada28bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for honornet_sdk-0.2.0.tar.gz:

Publisher: publish-python.yml on HonorNetAI/HonornetAI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file honornet_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: honornet_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for honornet_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 229b46431fcfb014dbd0a19f0296b826eb14c91b1dd846d0ac6b9a053b41426b
MD5 6f72e5291273dd3a15a934d4936b6687
BLAKE2b-256 8f0c1604c61c5c52ab8e0ac1d98759b6d0624e13539921b4566d45bfa5cea78e

See more details on using hashes here.

Provenance

The following attestation bundles were made for honornet_sdk-0.2.0-py3-none-any.whl:

Publisher: publish-python.yml on HonorNetAI/HonornetAI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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