Files
orangecat/docs/api
5d6772da72 feat(payments): HTTP 402 inline payment — speak the standard (L402-style) (#556)
Item 6 of the ledger-and-loop build sequence: being machine-payable in a
private dialect is a phone that only calls phones you manufactured. One
GET now does the whole loop in the convention foreign agents already
speak — no account, no API key, no JSON dialect:

  GET /api/v1/pay/{type}/{id}?amount_btc=X
    → 402 + WWW-Authenticate: L402 token=…, invoice=lnbc…
  (pay the invoice)
  GET + Authorization: L402 <token>:<preimage>
    → 200 receipt

- domain/payments/l402-codec: pure wire codec (header parse/build,
  sha256 preimage proof) — dependency-free for the unit suite
- domain/payments/l402: challenge creation over the existing account-less
  rails (initiatePublicSupport / public status tokens — zero new state,
  zero migrations) + verification: cryptographic preimage-vs-payment_hash
  FIRST (no trust in our own polling), settlement status as the fallback
  for hashless rails (on-chain)
- api/v1/pay/[entity_type]/[entity_id]: the route; per-IP rate limit on
  challenge creation, safe-error surface mirrored from the public route
- standardResponse: apiPaymentRequired joins the response SSOT (402 is
  the protocol working, not an error to log)
- hashPublicStatusToken exported from paymentFlowService (SSOT, was
  file-private)
- OpenAPI + public-api registration; AGENTS.md 'Paying inline (HTTP 402)'
- tests: 10-case suite (codec proofs, both branches, envelope, safe errors)

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 14:58:33 +02:00
..