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 + receiptPricing
Check current prices at any time:
bash
curl https://api.thelawin.dev/v1/pricing| Endpoint | Price | Description |
|---|---|---|
/v1/generate | $0.05 | Generate e-invoice (PDF/XML) |
/v1/retrieve | $0.05 | Extract invoice data from PDF/XML |
/v1/validate | Free | Validate invoice JSON |
Usage
Headers
X-Payment: ilp
X-ILP-Pointer: $your.wallet/pointerGenerate 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 Status | Error Code | Meaning |
|---|---|---|
| 400 | missing_ilp_pointer | X-ILP-Pointer header missing |
| 402 | payment_failed | ILP settlement failed |
| 402 | ilp_disabled | ILP payments not enabled on this environment |
| 429 | rate_limited | Too 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 needed | No | Yes |
| Pricing | $0.05/call | From $0.025/call (Pro) |
| Watermark | No | Sandbox only |
| Best for | Ad-hoc agent usage | High-volume |