Skip to content

ILP Micropayments

AI Agents can use thelawin.dev without a subscription or human account. Each API call is paid individually via Interledger Protocol (ILP) through Chimoney.

Prerequisites

  • ILP-compatible wallet with a payment pointer (e.g., via Chimoney, Uphold, or GateHub)
  • No API key needed — ILP replaces authentication

Architecture

AI Agent

  ├─ POST /v1/generate
  │    X-Payment: ilp
  │    X-ILP-Pointer: $agent.wallet/pointer
  │    Body: { invoice JSON }

  ├─ thelawin.dev API
  │    ├─ Validates request
  │    ├─ Initiates ILP payment via Chimoney (< 2s)
  │    ├─ Generates PDF on success
  │    └─ Returns response + payment receipt

  └─ Agent receives PDF + receipt

Pricing

Check current prices at any time:

bash
curl https://api.thelawin.dev/v1/pricing
EndpointPriceDescription
/v1/generate$0.05Generate e-invoice (PDF/XML)
/v1/retrieve$0.05Extract invoice data from PDF/XML
/v1/validateFreeValidate invoice JSON

Usage

Headers

X-Payment: ilp
X-ILP-Pointer: $your.wallet/pointer

Generate an Invoice (curl)

bash
curl -X POST https://api.thelawin.dev/v1/generate \
  -H "Content-Type: application/json" \
  -H "X-Payment: ilp" \
  -H "X-ILP-Pointer: \$wallet.example/myagent" \
  -d '{
    "template": "minimal",
    "invoice": {
      "number": "ILP-2026-001",
      "date": "2026-04-23",
      "seller": { "name": "Agent Corp", "country": "DE" },
      "buyer": { "name": "Client GmbH", "country": "DE" },
      "items": [{ "description": "Service", "quantity": 1, "unit_price": 100, "vat_rate": 19 }]
    }
  }'

Response with Payment Receipt

json
{
  "pdf_base64": "JVBERi0xLjcK...",
  "filename": "rechnung-ILP-2026-001.pdf",
  "format": {
    "format_used": "zugferd",
    "profile": "EN16931",
    "version": "2.4"
  },
  "payment": {
    "payment_method": "ilp",
    "transaction_id": "tx_abc123",
    "amount": "0.0500",
    "currency": "USD",
    "settled_at": "2026-04-23T12:00:00Z",
    "payment_pointer": "$wallet.example/myagent"
  }
}

MCP Tool

Agents using MCP can call thelawin_pricing to check prices before making paid calls:

json
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": { "name": "thelawin_pricing" },
  "id": 1
}

Error Handling

HTTP StatusError CodeMeaning
400missing_ilp_pointerX-ILP-Pointer header missing
402payment_failedILP settlement failed
402ilp_disabledILP payments not enabled on this environment
429rate_limitedToo many requests from this payment pointer

On payment failure, the response includes a fallback:

json
{
  "error": "payment_failed",
  "message": "ILP payment settlement failed",
  "payment_link": "https://thelawin.dev/pricing"
}

Rate Limits

ILP calls have separate rate limits from subscription plans: 60 requests per minute per payment pointer.

vs. Subscription

ILP (Pay-per-Call)Subscription
Account neededNoYes
Pricing$0.05/callFrom $0.025/call (Pro)
WatermarkNoSandbox only
Best forAd-hoc agent usageHigh-volume

ZUGFeRD 2.4 & Factur-X 1.0.8 compliant