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, and signed log root — with the public honornet-verify library:

from honornet import verify_decision

verified = verify_decision(client, result.decision_id, pinned_key=HONORNET_LEDGER_KEY)
assert verified.verification.ok

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.1.0.tar.gz (16.2 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.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: honornet_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 16.2 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.1.0.tar.gz
Algorithm Hash digest
SHA256 38f1ea35cd68f7da15f3fd8f283d819c52c4e0022fd3d06affe5f27b9d0a4412
MD5 e19ca17f769197740cb3f83e8fc35b52
BLAKE2b-256 49f4537d7b2811e2c2dd905632674ff4b6f8381f4f597d63f49c0ec07ae0e29d

See more details on using hashes here.

Provenance

The following attestation bundles were made for honornet_sdk-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: honornet_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84559432c86fc8a1fa69442032af5cc4e2e4a81955d5e1b35ed6a821ed7d616c
MD5 d58be315a9a30395c36ce804928dbafb
BLAKE2b-256 a1ba5409bf4356e81b56a065b27ca78444ea86f4439b06a7d43a203c67e5b1d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for honornet_sdk-0.1.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