* docs: archive point-in-time records, drop broken guide symlinks Status reports, progress trackers, audits, session summaries, completed migration plans and the 2025 roadmap move to docs/archive/ (same relative path), with a README saying they describe the day they were written. .ai-guides/ held only symlinks into a docs/guides/ai/ that no longer exists, tests/unit/docs/ held a stray copy of an old getting-started page, and docs/operations/PORT_MANAGEMENT_README.md duplicated port-management.md; all three are deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD * docs: correct drifted paths, links and versions in current docs Fix in place the reference docs agents use: point paths at where the code lives now (src/stores/auth.ts, src/lib/supabase/*, scripts/dev/*, docs/reference/api/CONVENTIONS.md, the squashed baseline migration), rewrite the development, features, operations and API index pages to list documents that exist, say plainly where something is gone (/api/metrics, the CSP report route, .envrc in the repo, Loki's `migrate` script), and correct the Next.js major. docs-truth findings: 468 -> 2 (both "Next 30/90 Days" headings in the legal overview, a checker false positive). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD --------- Co-authored-by: Claude <noreply@anthropic.com>
4.7 KiB
Buying on OrangeCat as a machine
OrangeCat entities — products, services, projects, causes — are payable by any client that can speak HTTP and pay a Lightning invoice. No browser, no account requirement, no scraping. This page is the whole loop.
Base URL: https://orangecat.ch/api/v1 · Spec: GET /api/v1/openapi.json
(live OpenAPI 3.1, generated from the server's own validation schemas) ·
Discovery: GET /api/v1
Auth: two modes
- Integration key — minted by a user at Settings → Integrations. Send
X-OrangeCat-Key: ock_…(orAuthorization: Bearer ock_…). The key is bound to one actor and carries scopes; payments needpayments.write/payments.read(or the*wildcard). Payments are attributed to the key's user as buyer. - No auth at all — the
/payments/publicflow. Anonymous, IP rate-limited, settlement verified via a per-payment bearer token.
The loop
1. Discover
# Semantic search across public entities (no auth)
curl 'https://orangecat.ch/api/v1/search?q=handmade+ceramics&limit=5'
# Or list a specific entity type
curl 'https://orangecat.ch/api/v1/products?limit=20'
2. Quote
curl 'https://orangecat.ch/api/v1/products/<entity_id>'
# → price_btc, title, description — decide whether to buy
3. Pay
With a key (attributed purchase / contribution):
curl -X POST 'https://orangecat.ch/api/v1/payments' \
-H 'X-OrangeCat-Key: ock_…' \
-H 'Content-Type: application/json' \
-d '{"entity_type": "product", "entity_id": "<entity_id>"}'
# → { payment_intent: { id, bolt11, status: "invoice_ready", … }, qr_data, expires_in_seconds }
Without an account:
curl -X POST 'https://orangecat.ch/api/v1/payments/public' \
-H 'Content-Type: application/json' \
-d '{"entity_type": "project", "entity_id": "<entity_id>", "amount_btc": 0.0002}'
# → additionally returns status_token — keep it, it is the only credential
Pay the returned bolt11 with any Lightning wallet (NWC pay_invoice,
LND, CLN, an exchange withdrawal — anything that pays bolt11).
Contribution-pattern entities (project, cause, …) require amount_btc;
fixed-price entities (product, service) take the listed price and ignore it.
4. Verify
# Key flow
curl 'https://orangecat.ch/api/v1/payments/<intent_id>' \
-H 'X-OrangeCat-Key: ock_…'
# Account-less flow
curl 'https://orangecat.ch/api/v1/payments/public/<intent_id>' \
-H 'X-Payment-Token: <status_token>'
Poll until status is terminal. paid means settled — the server
re-checks the invoice against the receiving wallet (NWC lookup / LNURL
verify) on every read; it is not a client claim. expired / failed are
the give-up states. Respect expires_in_seconds from step 3 — invoices are
not payable forever.
Sellers can also subscribe to the payment.settled webhook instead of
polling (Settings → Integrations → Webhooks).
Paying inline (HTTP 402)
If your agent already speaks the 402 convention (L402-style), you can skip accounts, keys, and our JSON dialect entirely — one URL does the whole loop:
# 1. Ask for the thing. No auth. You get 402 + a Lightning challenge.
curl -i "https://orangecat.ch/api/v1/pay/product/<entity-id>?amount_btc=0.0001"
# → HTTP/2 402
# → WWW-Authenticate: L402 token="<intent-id>.<status-token>", invoice="lnbc…"
# → { "error": { "code": "PAYMENT_REQUIRED", "details": { "token": "…", "bolt11": "lnbc…", … } } }
# 2. Pay the bolt11 with any Lightning wallet. Keep the preimage.
# 3. Repeat the GET with proof. The preimage is verified cryptographically
# against the invoice's payment_hash — no polling needed.
curl "https://orangecat.ch/api/v1/pay/product/<entity-id>" \
-H 'Authorization: L402 <token>:<preimage>'
# → { "success": true, "data": { "status": "paid", "verified_by": "preimage", … } }
verified_by is preimage when the cryptographic proof checked out, or
settlement when we fell back to observed settlement (on-chain has no
preimage). Not paid yet → 402 again (your original invoice still stands —
respect its expiry). Challenge creation is rate limited per IP.
Rules of the road
- Idempotency: entity-create endpoints accept an
Idempotency-Keyheader. Payment creation does not yet — treat a timeout as unknown and reconcile via status polling, don't blind-retry the POST. - Rate limits: per key for authenticated calls, per IP for the public
flow. Back off on 429 using the
Retry-Afterheader. - Sandbox: keys minted with the test flag (
ock_test_…) create sandbox-flagged entities; live payment flows use live keys. - Conventions (error envelope, versioning): see
CONVENTIONS.md.