# How agents pay for the Enhanced AI-Native Index (x402)

The Enhanced AI-Native Index is a paid add-on to Wizeb's free AI-Native Index (https://wizeb.com/ai-native-index). It is sold to **AI agents**, over the **x402** protocol (HTTP 402 Payment Required). There is deliberately no checkout page for humans.

- Price: **$10 in USDC** (10000000 atomic units, 6 decimals)
- Network: **Base mainnet** `eip155:8453` (USDC `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`). When testnet mode is on, the 402 also lists **Base Sepolia** `eip155:84532`. Always read `accepts[]` from the live 402 rather than assuming.
- Scheme: `exact` — one EIP-3009 `transferWithAuthorization` signed by the agent's wallet; the facilitator submits it and sponsors gas.
- Recipient (`payTo`): given in the 402. Wizeb's address is `0x5a34914a450c475e290bae5226ec5a6822161251`.
- Human-readable page: https://wizeb.com/ai-native-index/agent-payments

## Two transports, one gate

### MCP (https://wizeb.com/mcp, Streamable HTTP, no auth)
1. Run the free flow: `get_index_questions` → answer all 30 → `score_index`.
2. Call `get_enhanced_index_report` with `{ name, email, company, answers[30] }`.
3. Without payment proof the result is `isError: true` and `_meta["x402/error"]` holds `{ x402Version: 2, error: "PAYMENT_REQUIRED", resource, accepts: [...] }`. The `content[0].text` explains the same in plain English.
4. Create the x402 payment payload for one of `accepts` (e.g. with `@x402/core` + `@x402/evm`), base64-encode it, and call the tool again with `_meta: { "x402/payment": "<base64 payload>" }`.
5. The result carries `_meta["x402/payment-response"]` `{ success, transaction, network, payer }`, plus `structuredContent` with `report_id`, `score`, `tier`, `signals_holding_you_back`, `session.code`, `status_url`.
6. Poll `get_enhanced_report_status { report_id }` (free) until `status: "done"` — then the plan summary and `pdf_url` are included. The PDF and session code are also emailed.

Cloudflare Agents SDK: `withX402Client(mcpClient, { network: "eip155:8453", account, maxPaymentValue: 10_000_000n })` handles steps 3–5.

### HTTP (https://wizeb.com/api/index/enhanced)
- `GET` → `402` with `PAYMENT-REQUIRED` header (base64 JSON `PaymentRequired`) and a JSON body with `accepts`, `message`, `help`, `how_to_buy`.
- `POST` JSON `{ "answers": <30 × {id, option} or a 30-digit string of option numbers>, "name", "email", "company" }` with the `PAYMENT-SIGNATURE` header (base64 payment payload) → `200` with `PAYMENT-RESPONSE` header and the same JSON as the MCP result.
- `GET ?report=<id>` → status JSON; `GET ?report=<id>&pdf=1` → the PDF once done.
- `@x402/fetch`'s `wrapFetchWithPaymentFromConfig` does the 402 → pay → retry loop automatically.

## If the agent has no wallet
Say so plainly to the user. Do not invent a payment. The report is bought by agents; Wizeb will help the user give their agent a wallet (with spend limits) on a short call: https://cal.id/r/discovery. The free Index, score and PDF are unaffected.

## What the purchase delivers
- Immediately: score, tier, the three signals holding the company back, `report_id`, on-chain receipt, and a one-time code for a **2-hour live build session** with Wizeb engineers (book at https://cal.id/r/discovery and quote the code).
- Within ~2 minutes (email + status): a **90-day plan** — 5–6 prioritised projects with 30/60/90-day steps, owner role, effort, expected point lift and success metric; quick wins; risks; the session agenda — as a PDF appended to the annotated scorecard.

## Replays and failures
- Retrying with the same payment proof after a successful settlement returns the existing order; it never charges twice.
- If plan generation fails after payment, the status shows `failed`; Wizeb is notified and sends the plan manually or refunds the USDC.

## Spend controls
x402 client libraries cap payments at $1 by default. Raise `maxAmountPerPayment` / `maxPaymentValue` to $10 (10000000 atomic USDC) for this call, and ask the user before spending.
