Skip to main content

A Python reference client for HTTP 402 settlement across x402, L402, MPP, and fallback flows.

Project description

ln-church-agent

Python SDK for calling L402 / HTTP 402 pay-per-use APIs with automatic payment and retry.


Quickstart (3-step)

1. Install

pip install ln-church-agent

2. Configure & Call

Call any 402-protected API. The SDK handles the 402 challenge, payment, and retry under the hood.

from ln_church_agent import Payment402Client

client = Payment402Client(
    base_url="https://your-402-api.com",
)

# Detects 402 -> Pays invoice -> Retries -> Returns JSON
result = client.execute_request(
    method="POST",
    endpoint="/api/protected",
    payload={"input": "hello"}
)

print(result)

What happens under the hood?

This SDK abstracts the "Payment-Retry Loop" so your agent doesn't have to:

  • Detects 402 Payment Required.
  • Negotiates the challenge (L402, MPP, or x402 support).
  • Pays the invoice via your configured Lightning or EVM provider.
  • Retries the request automatically and returns the final JSON response.

Why use this SDK?

  • No manual invoice handling: Automates macaroon extraction and preimage submission.
  • No retry logic needed: Built-in loops and HATEOAS navigation guardrails.
  • Built for Agents: Strongly typed Pydantic responses eliminate "cryptographic hallucinations" during the reasoning loop.

Detailed Documentation

Explore the full capabilities of the agentic economic loop:


License

MIT


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

ln_church_agent-0.8.5.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

ln_church_agent-0.8.5-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file ln_church_agent-0.8.5.tar.gz.

File metadata

  • Download URL: ln_church_agent-0.8.5.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for ln_church_agent-0.8.5.tar.gz
Algorithm Hash digest
SHA256 fea64c90d830c50295792f309401ff6c003167225a0ff90f9ea763f0b38c5c7c
MD5 d73157a524ed293c96f5749a26efb14b
BLAKE2b-256 7ad777dc6132d026964933bd428c8edb5a0948b6ab5137760ffbeb8e7be99463

See more details on using hashes here.

File details

Details for the file ln_church_agent-0.8.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ln_church_agent-0.8.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4a8682ee3bd5219fa5ce3f4383cdb0d9616bfea66165e936436e13c7df20c429
MD5 afccc247b57a61e149285de8fd9a9e43
BLAKE2b-256 a4e2c7ec48ece9a7a6591d089977bc90173edc4b5ccd900773b819509a2ab949

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