# x402 paid route: scope only (not built, nothing settles)

Proposal from the CoS: one paid read route, `GET /log/export?seller=<did>`, about $0.01 USDC on Base, returning that seller's log entries as JSON Lines. Verify, lookup, stats, /log and /log.jsonl stay free.

## What exists locally
`worker/x402.js`: a stub. Off by default (route returns 404). With `X402_STUB=1` it returns HTTP 402 with a payment-requirements body and `payment-required` header (x402 v2 field names as we understand them: scheme `exact`, network `eip155:8453`, USDC asset `0x8335…2913`, amount `10000` = 0.01 USDC, payTo the receive-only wallet `0x60D6ed524Bf6906D3167522735489A1a36b695f1`). Any request carrying a payment header gets 501 and nothing is charged. Test output: `qa/x402-stub.txt`. Field names and the USDC address must be checked against `@x402/core` before going live.

## Requirements to go live (from CDP docs, fetched 2026-10-23)
1. CDP account and a CDP API key ID + secret. "The CDP Facilitator authenticates with your CDP API key ID and secret." https://docs.cdp.coinbase.com/x402/seller/facilitator.md (Account sign-up terms and any identity checks were not researched; that is a human step.)
2. Receiving address: `payToConfig` with `type: "address"` receives at an address we control and needs no `CDP_WALLET_SECRET`. https://docs.cdp.coinbase.com/x402/seller/production-configuration.md
3. Fees: first 1,000 onchain facilitator transactions per month free, then $0.001 each; verification is free. With `exact`, each payment is one onchain transaction. https://docs.cdp.coinbase.com/x402/seller/facilitator.md
4. Network: Base mainnet is `eip155:8453`; `"production"` uses mainnets and real funds. https://docs.cdp.coinbase.com/x402/seller/production-configuration.md
5. Bazaar listing (https://docs.cdp.coinbase.com/x402/seller/get-discovered.md):
   - No registration form; a route is indexed after a successful settled payment through the CDP Facilitator.
   - Needs a public HTTPS URL that returns 402 with a valid `extensions.bazaar` block; optional check via `POST https://api.cdp.coinbase.com/platform/v2/x402/validate` (no API key).
   - Query params need explicit schemas and examples (`declareDiscoveryExtension`).
   - Metadata is screened for prompt-injection text; descriptions must describe, not instruct.
   - Curation (optional): live mainnet payments, 99% 30-day availability, health probe, full input schema, documented errors.
6. Libraries: `@x402/core`, `@x402/evm`, `@x402/hono` (and others) per https://github.com/x402-foundation/x402 ; CDP SDK `createX402Server` in `@coinbase/cdp-sdk/x402`. Hono runs on Cloudflare Workers, but whether `@x402/hono` plus the CDP facilitator client run under workerd (with `nodejs_compat`) is NOT verified; it needs a local wrangler dev test before any decision.
7. Policy checks before building: the CFO copy rules (no wording suggesting we hold or move customer money) still apply; the paid route only charges for a data export. Someone must confirm this fits the venture's $0 spend rule (fees are $0 under 1,000 tx/month) and who controls the receive-only wallet.
