[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-coinbase-build-x402-server":3,"mdc--xoerkj-key":38,"related-org-coinbase-build-x402-server":3120,"related-repo-coinbase-build-x402-server":3164},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":27,"repoUrl":28,"updatedAt":29,"license":30,"forks":31,"topics":32,"repo":33,"sourceUrl":36,"mdContent":37},"build-x402-server","implement x402 payment server for HTTP routes","Write code that charges for an HTTP route with the x402 protocol and receives USDC in a\nCDP-managed wallet. Covers TypeScript (Express, Hono, Next.js) and Python (FastAPI, Flask). Use\nwhen the user wants to monetize an API, price a route per request, put a paywall in front of an\nendpoint, accept payments from agents, or add x402 to a server they already run.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"coinbase","Coinbase","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fcoinbase.png",[12,16,18,21,24],{"name":13,"slug":14,"type":15},"TypeScript","typescript","tag",{"name":17,"slug":17,"type":15},"x402",{"name":19,"slug":20,"type":15},"Payments","payments",{"name":22,"slug":23,"type":15},"Python","python",{"name":25,"slug":26,"type":15},"API Development","api-development",189,"https:\u002F\u002Fgithub.com\u002Fcoinbase\u002Fcdp-sdk","2026-08-06T06:09:12.454558",null,181,[],{"repoUrl":28,"stars":27,"forks":31,"topics":34,"description":35},[],"Client libraries for managing EVM and Solana wallets while relying on CDP to secure private keys.","https:\u002F\u002Fgithub.com\u002Fcoinbase\u002Fcdp-sdk\u002Ftree\u002FHEAD\u002Fskills\u002Fbuild-x402-server","---\nname: build-x402-server\ndescription: |\n  Write code that charges for an HTTP route with the x402 protocol and receives USDC in a\n  CDP-managed wallet. Covers TypeScript (Express, Hono, Next.js) and Python (FastAPI, Flask). Use\n  when the user wants to monetize an API, price a route per request, put a paywall in front of an\n  endpoint, accept payments from agents, or add x402 to a server they already run.\ncompatibility: Requires a CDP API key and wallet secret. Node.js >= 22 (TypeScript) or Python >= 3.10.\nmetadata:\n  author: cdp@coinbase.com\n  version: \"0.1.0\"\n---\n\n# Build an x402 server\n\nTake the user from an unprotected HTTP route to one that answers `402 Payment Required` and settles\na real payment into a CDP-managed wallet.\n\nResolve the Decisions table below before writing any code, then read only the language and\nframework subsections you resolved to in step 3.\n\n## When not to use this skill\n\n- **The user sells through Coinbase Business.** The\n  [Business Checkouts API](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fcoinbase-business\u002Fcheckout-apis\u002Faccept-x402-payments)\n  returns one checkout with a hosted payment URL for people and a payable `x402_url` for agents,\n  and they run no server at all. Check for this early: for that user it is a genuinely better\n  answer than anything below.\n- **The user is charging for an MCP tool rather than an HTTP route.** See\n  [Charge over MCP](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Fmcp-payments).\n- **The user is the one paying.** Use the `build-x402-client` skill.\n- **The user wants a deployed money-making service with no code.** Use the agentic-wallet\n  [monetize-service](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fagentic-wallet\u002Fcli\u002Fskills\u002Fmonetize-service)\n  skill. It is the nearest neighbour to this skill and the most likely mis-selection.\n\n## Decisions\n\nResolve every row before writing code. Detect first; only ask when detection is ambiguous.\n\n| Decision            | How to detect                                                                     | Ask only if                 | Default                         |\n| ------------------- | ----------------------------------------------------------------------------------- | --------------------------- | ------------------------------- |\n| Language            | `package.json` -> TypeScript. `pyproject.toml` \u002F `requirements.txt` -> Python.    | Both present, or neither    | Ask                             |\n| Framework           | Read deps for `express`, `hono`, `next`, `fastapi`, `flask`.                      | No server framework present | Ask; suggest Express or FastAPI |\n| Wiring approach     | An existing `x402ResourceServer` or `paymentMiddleware` call -> facilitator swap. | —                           | Greenfield                      |\n| Route config source | An `x402.config.json` already in the project -> config file.                      | —                           | Inline in code                  |\n| Receiver wallet     | The user supplied a `payTo` address -> use it.                                    | —                           | CDP-provisioned wallet          |\n| Network             | `environment: \"development\"` selects testnets.                                    | Never assume mainnet        | `development`                   |\n| Scheme              | Fixed price -> `exact`. Metered or usage-based -> `upto`.                         | —                           | `exact`                         |\n\nTwo hard rules, not preferences:\n\n1. **Never move a server to mainnet unless the user asks in the current turn.** That puts real\n   payers in front of a route that may not be ready.\n2. **If the user supplies a `payTo` address, echo it back for confirmation before writing it.** A\n   typo'd receiver sends every future payment somewhere unrecoverable.\n\n## Steps\n\n### 1. Confirm credentials\n\nBefore installing anything, check the environment for `CDP_API_KEY_ID`, `CDP_API_KEY_SECRET`, and\n`CDP_WALLET_SECRET`. The API key authenticates the server to the CDP Facilitator; the wallet secret\nprovisions the wallet that receives payments, and is only needed when the user has not supplied a\n`payTo` of their own. Send them to\n[API key authentication](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fwallets\u002Fquickstart\u002Fapi-key-auth) if they have\nno key. Also confirm the runtime: Node.js 22 or later, or Python 3.10 or later.\n\n### 2. Install\n\nPick the line matching the Decisions table. `@x402\u002Fcore`, `@x402\u002Fevm`, `@x402\u002Fsvm`, and\n`@x402\u002Fextensions` are optional peer dependencies of the CDP SDK, so they are not installed for you,\nand all four are needed even for an EVM-only server because `@coinbase\u002Fcdp-sdk\u002Fx402` imports them at\nmodule load. Only the framework and its adapter change between the three TypeScript lines.\n\n```bash\n# TypeScript, Express\nnpm install express @coinbase\u002Fcdp-sdk @x402\u002Fcore @x402\u002Fevm @x402\u002Fsvm @x402\u002Fextensions @x402\u002Fexpress\n\n# ...or Hono:    hono @hono\u002Fnode-server, and @x402\u002Fhono in place of @x402\u002Fexpress\n# ...or Next.js: next, and @x402\u002Fnext in place of @x402\u002Fexpress\n\n# Python\npip install \"cdp-sdk\" \"x402[evm,svm,fastapi]\" uvicorn   # FastAPI\npip install \"cdp-sdk\" \"x402[evm,svm,flask]\"             # Flask\n```\n\n### 3. Price the route\n\nThree things are needed from the user before writing anything. Ask for whichever cannot be inferred:\n**which routes to charge for**, **the price per call**, and **a one-line description of what each\nroute returns**. The description is not decoration — it is what buyers see when the service is\nlisted for discovery, so a vague one costs the user customers later.\n\nState the containment rule plainly: only routes named in the config are protected, everything else\nstays free. That is the sentence that stops someone paywalling `\u002Fhealth`.\n\nRead only the subsections matching the language and framework resolved above.\n\n#### TypeScript\n\n`createX402Server` provisions the receiver wallet, wires the CDP Facilitator, registers the schemes\nand extensions, and returns an object any x402 framework adapter accepts. It is async — `await` it\nbefore `app.use`.\n\n```typescript\nimport { createX402Server } from \"@coinbase\u002Fcdp-sdk\u002Fx402\";\nimport { paymentMiddlewareFromHTTPServer } from \"@x402\u002Fexpress\";\nimport express from \"express\";\n\nconst app = express();\n\nconst server = await createX402Server({\n  environment: \"development\", \u002F\u002F testnets and test funds\n  routes: {\n    \"GET \u002Freport\": { price: \"$0.01\", description: \"Generate a concise research report\" },\n  },\n});\n\napp.use(paymentMiddlewareFromHTTPServer(server));\napp.get(\"\u002Freport\", (_req, res) => res.json({ report: \"...\" }));\n\napp.listen(8402, () => console.log(`Receiving payments at ${server.payToEvmAddress}`));\n```\n\nTwo variants on that shape:\n\n- **The user already runs x402.** Do not rewrite their server. Replace the facilitator argument\n  with `createCdpFacilitatorClient()` from `@coinbase\u002Fcdp-sdk\u002Fx402` — same return type, so nothing\n  else in their code moves. This path needs a `payTo` address, and the factory is synchronous.\n- **Routes belong in a file.** Pass `configPath: \".\u002Fx402.config.json\"` instead of `routes`. Inline\n  routes win per key when both are given, which is how you keep a shared file and still special-case\n  one route in code. Keep credentials in environment variables, not the file.\n\n**Hono** is the Express code with `@x402\u002Fhono` in place of `@x402\u002Fexpress` and `serve({ fetch:\napp.fetch, port })` in place of `app.listen`. The server object is identical.\n\n**Next.js** is the one genuine exception. App Router route files re-evaluate, so build the server\nonce in its own module and import it from the handler:\n\n```typescript\n\u002F\u002F app\u002Fx402.ts — note the \u002Fserver subpath: the client ExactEvmScheme needs a signer\nimport { x402ResourceServer } from \"@x402\u002Fcore\u002Fserver\";\nimport { ExactEvmScheme } from \"@x402\u002Fevm\u002Fexact\u002Fserver\";\nimport { createCdpFacilitatorClient } from \"@coinbase\u002Fcdp-sdk\u002Fx402\";\n\nexport const server = new x402ResourceServer(createCdpFacilitatorClient()).register(\n  \"eip155:84532\",\n  new ExactEvmScheme(),\n);\n\n\u002F\u002F app\u002Fapi\u002Freport\u002Froute.ts\nimport { withX402 } from \"@x402\u002Fnext\";\nexport const GET = withX402(handler, { accepts: [...], description: \"...\" }, server);\n```\n\nGotchas worth stating once:\n\n- Register the middleware before the protected handlers.\n- Omitting `environment` means mainnet.\n- Under `\"development\"`, routes default to both Base Sepolia and Solana Devnet.\n\n**Usage-based pricing (`upto`)** only when the user asks for it. The route takes `scheme: \"upto\"`\nand a price that acts as a ceiling; the handler calls `setSettlementOverrides(res, { amount })`\nwith the amount actually used before sending the body. `amount` is a string, and it accepts atomic\nunits (`\"100000\"` is $0.10 in 6-decimal USDC), a dollar price (`\"$0.05\"`), or a percentage of the\nauthorized ceiling (`\"50%\"`) — pick whichever the usage calculation produces naturally. `upto` is\nEVM-only, so under `\"development\"` it resolves to Base Sepolia alone.\n\n#### Python\n\nThere is no `createX402Server` in Python, so assemble the pieces by hand. It is two halves, and\nnaming them is what keeps the Python version from reading as long and arbitrary:\n\n1. A CDP wallet to receive payments, resolved from `cdp.evm.get_or_create_account(...).address`.\n2. The x402 Foundation middleware, pointed at the CDP Facilitator with `create_facilitator_config()`.\n\n```python\nfrom cdp.x402 import create_facilitator_config\nfrom fastapi import FastAPI\nfrom x402.http import HTTPFacilitatorClient, PaymentOption\nfrom x402.http.middleware.fastapi import PaymentMiddlewareASGI\nfrom x402.http.types import RouteConfig\nfrom x402.mechanisms.evm.exact import ExactEvmServerScheme\nfrom x402.server import x402ResourceServer\n\nPAY_TO = \"0x1234567890123456789012345678901234567890\"  # Your EVM address to get paid on Base Sepolia\nNETWORK = \"eip155:84532\"  # Base Sepolia\n\nserver = x402ResourceServer(HTTPFacilitatorClient(create_facilitator_config()))\nserver.register(NETWORK, ExactEvmServerScheme())\n\nroutes = {\n    \"GET \u002Freport\": RouteConfig(\n        accepts=[PaymentOption(scheme=\"exact\", pay_to=PAY_TO, price=\"$0.01\", network=NETWORK)],\n        mime_type=\"application\u002Fjson\",\n        description=\"AI-generated report\",\n    ),\n}\n\napp = FastAPI()\napp.add_middleware(PaymentMiddlewareASGI, routes=routes, server=server)\n```\n\nRun it with `uvicorn.run(app, port=8402)`.\n\nThe sharpest edge is resolving `PAY_TO`. `CdpClient` is an async context manager, but the route\nconfig above is module-level and synchronous, which is why the examples resolve the receiver once\nat import time with `asyncio.run(resolve_pay_to())`. That works when the module is the entry point.\nUnder an ASGI server that imports it from inside a running event loop, it raises `RuntimeError`, and\nthe user needs a lifespan hook instead.\n\n**Flask** is the same code with three substitutions: `x402ResourceServerSync` and\n`HTTPFacilitatorClientSync` in place of the async pair, and `payment_middleware(app, routes=routes,\nserver=server)` from `x402.http.middleware.flask`, which is a function that mutates the app rather\nthan a middleware class. Handing Flask the async `x402ResourceServer` raises a `TypeError`.\n\nTwo more gotchas: `PaymentOption` is a dataclass whose `scheme`, `pay_to`, `price`, and `network`\nhave no defaults, so a missing one is a `TypeError` at construction — which, with a module-level\nroute map, means the server refuses to import rather than failing a request later. And this path is\nEVM-only, with no Solana option.\n\n### 4. Confirm the route is protected\n\nStart the server, then from a second terminal:\n\n```bash\ncurl -i http:\u002F\u002Flocalhost:8402\u002Freport\n```\n\n```console\nHTTP\u002F1.1 402 Payment Required\nPAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MiwiZXJyb3IiOiJQYXltZW50IHJlcXVpcmVkIiwi...\n```\n\nThis is the cheap checkpoint before any money moves, and it needs no buyer. Do not skip to step 5.\n\n### 5. Take a real payment\n\nEither testing path works:\n\n- Point the agentic-wallet\n  [pay-for-service](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fagentic-wallet\u002Fcli\u002Fskills\u002Fpay-for-service) skill\n  at `http:\u002F\u002Flocalhost:8402\u002Freport`.\n- Build a buyer with the `build-x402-client` skill and point it at the same URL.\n\nSuccess is `HTTP 200` on the buyer side. The buyer wallet needs testnet USDC first, which is step 4\nof the client skill — link it rather than re-teaching funding here.\n\n## Troubleshooting\n\n| Symptom                                | Cause                                                                    | Fix                                                          |\n| -------------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------ |\n| Route returns `200` with no payment    | Route key does not match the real method and path, or middleware was registered after the handler | Compare the key to the handler; move `app.use` above it      |\n| `402` with no `PAYMENT-REQUIRED` header | The middleware was never reached                                        | Check registration order and the mount path                  |\n| Verification passes, settlement fails  | Buyer and server are on different chains                                | Match the buyer's network to the one in the `402`            |\n| Auth error at startup                  | `CDP_API_KEY_*` not visible to the process                              | Check how the process loads its environment, not just `.env` |\n| Payments land somewhere unknown        | A CDP wallet was provisioned and the printed `payTo` was never recorded | Read it back from `server.payToEvmAddress` and save it       |\n\n## Runnable examples\n\nTypeScript, under `https:\u002F\u002Fgithub.com\u002Fcoinbase\u002Fcdp-sdk\u002Fblob\u002Fmain\u002Fexamples\u002Ftypescript\u002Fx402\u002Fservers\u002F`:\n`express\u002Fserver.ts` (all three approaches), `express\u002Fx402.config.json` and\n`express\u002Fx402.config.schema.json`, `hono\u002Fserver.ts`, `next\u002Fapp\u002Fapi\u002Freport\u002Froute.ts`,\n`mcp\u002Fserver.ts`.\n\nPython, under `https:\u002F\u002Fgithub.com\u002Fcoinbase\u002Fcdp-sdk\u002Fblob\u002Fmain\u002Fexamples\u002Fpython\u002Fx402\u002Fservers\u002F`:\n`fastapi\u002Fserver.py`, `flask\u002Fserver.py`, `bazaar.py`, `mcp\u002Fserver.py`.\n\n## After the first payment\n\n- Make the endpoint findable: [Get discovered](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Fget-discovered). TypeScript's `createX402Server` handles it automatically; Python needs manual metadata like `bazaar.py` above\n- What settled the payment: [CDP Facilitator](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Ffacilitator)\n- Other networks, schemes, receivers, lifecycle hooks: [Production configuration](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Fproduction-configuration)\n- Charging for MCP tools: [Charge over MCP](https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Fmcp-payments)\n- Mainnet: drop `environment: \"development\"` and confirm with the user first\n",{"data":39,"body":44},{"name":4,"description":6,"compatibility":40,"metadata":41},"Requires a CDP API key and wallet secret. Node.js >= 22 (TypeScript) or Python >= 3.10.",{"author":42,"version":43},"cdp@coinbase.com","0.1.0",{"type":45,"children":46},"root",[47,56,71,76,83,174,180,185,499,504,535,541,548,592,598,640,853,859,884,896,901,906,932,1578,1583,1644,1684,1694,2103,2108,2142,2220,2224,2236,2263,2466,2478,2515,2570,2619,2625,2630,2655,2680,2685,2691,2696,2732,2745,2751,2929,2935,2991,3031,3037,3114],{"type":48,"tag":49,"props":50,"children":52},"element","h1",{"id":51},"build-an-x402-server",[53],{"type":54,"value":55},"text","Build an x402 server",{"type":48,"tag":57,"props":58,"children":59},"p",{},[60,62,69],{"type":54,"value":61},"Take the user from an unprotected HTTP route to one that answers ",{"type":48,"tag":63,"props":64,"children":66},"code",{"className":65},[],[67],{"type":54,"value":68},"402 Payment Required",{"type":54,"value":70}," and settles\na real payment into a CDP-managed wallet.",{"type":48,"tag":57,"props":72,"children":73},{},[74],{"type":54,"value":75},"Resolve the Decisions table below before writing any code, then read only the language and\nframework subsections you resolved to in step 3.",{"type":48,"tag":77,"props":78,"children":80},"h2",{"id":79},"when-not-to-use-this-skill",[81],{"type":54,"value":82},"When not to use this skill",{"type":48,"tag":84,"props":85,"children":86},"ul",{},[87,118,137,155],{"type":48,"tag":88,"props":89,"children":90},"li",{},[91,97,99,108,110,116],{"type":48,"tag":92,"props":93,"children":94},"strong",{},[95],{"type":54,"value":96},"The user sells through Coinbase Business.",{"type":54,"value":98}," The\n",{"type":48,"tag":100,"props":101,"children":105},"a",{"href":102,"rel":103},"https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fcoinbase-business\u002Fcheckout-apis\u002Faccept-x402-payments",[104],"nofollow",[106],{"type":54,"value":107},"Business Checkouts API",{"type":54,"value":109},"\nreturns one checkout with a hosted payment URL for people and a payable ",{"type":48,"tag":63,"props":111,"children":113},{"className":112},[],[114],{"type":54,"value":115},"x402_url",{"type":54,"value":117}," for agents,\nand they run no server at all. Check for this early: for that user it is a genuinely better\nanswer than anything below.",{"type":48,"tag":88,"props":119,"children":120},{},[121,126,128,135],{"type":48,"tag":92,"props":122,"children":123},{},[124],{"type":54,"value":125},"The user is charging for an MCP tool rather than an HTTP route.",{"type":54,"value":127}," See\n",{"type":48,"tag":100,"props":129,"children":132},{"href":130,"rel":131},"https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Fmcp-payments",[104],[133],{"type":54,"value":134},"Charge over MCP",{"type":54,"value":136},".",{"type":48,"tag":88,"props":138,"children":139},{},[140,145,147,153],{"type":48,"tag":92,"props":141,"children":142},{},[143],{"type":54,"value":144},"The user is the one paying.",{"type":54,"value":146}," Use the ",{"type":48,"tag":63,"props":148,"children":150},{"className":149},[],[151],{"type":54,"value":152},"build-x402-client",{"type":54,"value":154}," skill.",{"type":48,"tag":88,"props":156,"children":157},{},[158,163,165,172],{"type":48,"tag":92,"props":159,"children":160},{},[161],{"type":54,"value":162},"The user wants a deployed money-making service with no code.",{"type":54,"value":164}," Use the agentic-wallet\n",{"type":48,"tag":100,"props":166,"children":169},{"href":167,"rel":168},"https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fagentic-wallet\u002Fcli\u002Fskills\u002Fmonetize-service",[104],[170],{"type":54,"value":171},"monetize-service",{"type":54,"value":173},"\nskill. It is the nearest neighbour to this skill and the most likely mis-selection.",{"type":48,"tag":77,"props":175,"children":177},{"id":176},"decisions",[178],{"type":54,"value":179},"Decisions",{"type":48,"tag":57,"props":181,"children":182},{},[183],{"type":54,"value":184},"Resolve every row before writing code. Detect first; only ask when detection is ambiguous.",{"type":48,"tag":186,"props":187,"children":188},"table",{},[189,218],{"type":48,"tag":190,"props":191,"children":192},"thead",{},[193],{"type":48,"tag":194,"props":195,"children":196},"tr",{},[197,203,208,213],{"type":48,"tag":198,"props":199,"children":200},"th",{},[201],{"type":54,"value":202},"Decision",{"type":48,"tag":198,"props":204,"children":205},{},[206],{"type":54,"value":207},"How to detect",{"type":48,"tag":198,"props":209,"children":210},{},[211],{"type":54,"value":212},"Ask only if",{"type":48,"tag":198,"props":214,"children":215},{},[216],{"type":54,"value":217},"Default",{"type":48,"tag":219,"props":220,"children":221},"tbody",{},[222,268,327,366,396,426,459],{"type":48,"tag":194,"props":223,"children":224},{},[225,231,258,263],{"type":48,"tag":226,"props":227,"children":228},"td",{},[229],{"type":54,"value":230},"Language",{"type":48,"tag":226,"props":232,"children":233},{},[234,240,242,248,250,256],{"type":48,"tag":63,"props":235,"children":237},{"className":236},[],[238],{"type":54,"value":239},"package.json",{"type":54,"value":241}," -> TypeScript. ",{"type":48,"tag":63,"props":243,"children":245},{"className":244},[],[246],{"type":54,"value":247},"pyproject.toml",{"type":54,"value":249}," \u002F ",{"type":48,"tag":63,"props":251,"children":253},{"className":252},[],[254],{"type":54,"value":255},"requirements.txt",{"type":54,"value":257}," -> Python.",{"type":48,"tag":226,"props":259,"children":260},{},[261],{"type":54,"value":262},"Both present, or neither",{"type":48,"tag":226,"props":264,"children":265},{},[266],{"type":54,"value":267},"Ask",{"type":48,"tag":194,"props":269,"children":270},{},[271,276,317,322],{"type":48,"tag":226,"props":272,"children":273},{},[274],{"type":54,"value":275},"Framework",{"type":48,"tag":226,"props":277,"children":278},{},[279,281,287,289,295,296,302,303,309,310,316],{"type":54,"value":280},"Read deps for ",{"type":48,"tag":63,"props":282,"children":284},{"className":283},[],[285],{"type":54,"value":286},"express",{"type":54,"value":288},", ",{"type":48,"tag":63,"props":290,"children":292},{"className":291},[],[293],{"type":54,"value":294},"hono",{"type":54,"value":288},{"type":48,"tag":63,"props":297,"children":299},{"className":298},[],[300],{"type":54,"value":301},"next",{"type":54,"value":288},{"type":48,"tag":63,"props":304,"children":306},{"className":305},[],[307],{"type":54,"value":308},"fastapi",{"type":54,"value":288},{"type":48,"tag":63,"props":311,"children":313},{"className":312},[],[314],{"type":54,"value":315},"flask",{"type":54,"value":136},{"type":48,"tag":226,"props":318,"children":319},{},[320],{"type":54,"value":321},"No server framework present",{"type":48,"tag":226,"props":323,"children":324},{},[325],{"type":54,"value":326},"Ask; suggest Express or FastAPI",{"type":48,"tag":194,"props":328,"children":329},{},[330,335,356,361],{"type":48,"tag":226,"props":331,"children":332},{},[333],{"type":54,"value":334},"Wiring approach",{"type":48,"tag":226,"props":336,"children":337},{},[338,340,346,348,354],{"type":54,"value":339},"An existing ",{"type":48,"tag":63,"props":341,"children":343},{"className":342},[],[344],{"type":54,"value":345},"x402ResourceServer",{"type":54,"value":347}," or ",{"type":48,"tag":63,"props":349,"children":351},{"className":350},[],[352],{"type":54,"value":353},"paymentMiddleware",{"type":54,"value":355}," call -> facilitator swap.",{"type":48,"tag":226,"props":357,"children":358},{},[359],{"type":54,"value":360},"—",{"type":48,"tag":226,"props":362,"children":363},{},[364],{"type":54,"value":365},"Greenfield",{"type":48,"tag":194,"props":367,"children":368},{},[369,374,387,391],{"type":48,"tag":226,"props":370,"children":371},{},[372],{"type":54,"value":373},"Route config source",{"type":48,"tag":226,"props":375,"children":376},{},[377,379,385],{"type":54,"value":378},"An ",{"type":48,"tag":63,"props":380,"children":382},{"className":381},[],[383],{"type":54,"value":384},"x402.config.json",{"type":54,"value":386}," already in the project -> config file.",{"type":48,"tag":226,"props":388,"children":389},{},[390],{"type":54,"value":360},{"type":48,"tag":226,"props":392,"children":393},{},[394],{"type":54,"value":395},"Inline in code",{"type":48,"tag":194,"props":397,"children":398},{},[399,404,417,421],{"type":48,"tag":226,"props":400,"children":401},{},[402],{"type":54,"value":403},"Receiver wallet",{"type":48,"tag":226,"props":405,"children":406},{},[407,409,415],{"type":54,"value":408},"The user supplied a ",{"type":48,"tag":63,"props":410,"children":412},{"className":411},[],[413],{"type":54,"value":414},"payTo",{"type":54,"value":416}," address -> use it.",{"type":48,"tag":226,"props":418,"children":419},{},[420],{"type":54,"value":360},{"type":48,"tag":226,"props":422,"children":423},{},[424],{"type":54,"value":425},"CDP-provisioned wallet",{"type":48,"tag":194,"props":427,"children":428},{},[429,434,445,450],{"type":48,"tag":226,"props":430,"children":431},{},[432],{"type":54,"value":433},"Network",{"type":48,"tag":226,"props":435,"children":436},{},[437,443],{"type":48,"tag":63,"props":438,"children":440},{"className":439},[],[441],{"type":54,"value":442},"environment: \"development\"",{"type":54,"value":444}," selects testnets.",{"type":48,"tag":226,"props":446,"children":447},{},[448],{"type":54,"value":449},"Never assume mainnet",{"type":48,"tag":226,"props":451,"children":452},{},[453],{"type":48,"tag":63,"props":454,"children":456},{"className":455},[],[457],{"type":54,"value":458},"development",{"type":48,"tag":194,"props":460,"children":461},{},[462,467,487,491],{"type":48,"tag":226,"props":463,"children":464},{},[465],{"type":54,"value":466},"Scheme",{"type":48,"tag":226,"props":468,"children":469},{},[470,472,478,480,486],{"type":54,"value":471},"Fixed price -> ",{"type":48,"tag":63,"props":473,"children":475},{"className":474},[],[476],{"type":54,"value":477},"exact",{"type":54,"value":479},". Metered or usage-based -> ",{"type":48,"tag":63,"props":481,"children":483},{"className":482},[],[484],{"type":54,"value":485},"upto",{"type":54,"value":136},{"type":48,"tag":226,"props":488,"children":489},{},[490],{"type":54,"value":360},{"type":48,"tag":226,"props":492,"children":493},{},[494],{"type":48,"tag":63,"props":495,"children":497},{"className":496},[],[498],{"type":54,"value":477},{"type":48,"tag":57,"props":500,"children":501},{},[502],{"type":54,"value":503},"Two hard rules, not preferences:",{"type":48,"tag":505,"props":506,"children":507},"ol",{},[508,518],{"type":48,"tag":88,"props":509,"children":510},{},[511,516],{"type":48,"tag":92,"props":512,"children":513},{},[514],{"type":54,"value":515},"Never move a server to mainnet unless the user asks in the current turn.",{"type":54,"value":517}," That puts real\npayers in front of a route that may not be ready.",{"type":48,"tag":88,"props":519,"children":520},{},[521,533],{"type":48,"tag":92,"props":522,"children":523},{},[524,526,531],{"type":54,"value":525},"If the user supplies a ",{"type":48,"tag":63,"props":527,"children":529},{"className":528},[],[530],{"type":54,"value":414},{"type":54,"value":532}," address, echo it back for confirmation before writing it.",{"type":54,"value":534}," A\ntypo'd receiver sends every future payment somewhere unrecoverable.",{"type":48,"tag":77,"props":536,"children":538},{"id":537},"steps",[539],{"type":54,"value":540},"Steps",{"type":48,"tag":542,"props":543,"children":545},"h3",{"id":544},"_1-confirm-credentials",[546],{"type":54,"value":547},"1. Confirm credentials",{"type":48,"tag":57,"props":549,"children":550},{},[551,553,559,560,566,568,574,576,581,583,590],{"type":54,"value":552},"Before installing anything, check the environment for ",{"type":48,"tag":63,"props":554,"children":556},{"className":555},[],[557],{"type":54,"value":558},"CDP_API_KEY_ID",{"type":54,"value":288},{"type":48,"tag":63,"props":561,"children":563},{"className":562},[],[564],{"type":54,"value":565},"CDP_API_KEY_SECRET",{"type":54,"value":567},", and\n",{"type":48,"tag":63,"props":569,"children":571},{"className":570},[],[572],{"type":54,"value":573},"CDP_WALLET_SECRET",{"type":54,"value":575},". The API key authenticates the server to the CDP Facilitator; the wallet secret\nprovisions the wallet that receives payments, and is only needed when the user has not supplied a\n",{"type":48,"tag":63,"props":577,"children":579},{"className":578},[],[580],{"type":54,"value":414},{"type":54,"value":582}," of their own. Send them to\n",{"type":48,"tag":100,"props":584,"children":587},{"href":585,"rel":586},"https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fwallets\u002Fquickstart\u002Fapi-key-auth",[104],[588],{"type":54,"value":589},"API key authentication",{"type":54,"value":591}," if they have\nno key. Also confirm the runtime: Node.js 22 or later, or Python 3.10 or later.",{"type":48,"tag":542,"props":593,"children":595},{"id":594},"_2-install",[596],{"type":54,"value":597},"2. Install",{"type":48,"tag":57,"props":599,"children":600},{},[601,603,609,610,616,617,623,624,630,632,638],{"type":54,"value":602},"Pick the line matching the Decisions table. ",{"type":48,"tag":63,"props":604,"children":606},{"className":605},[],[607],{"type":54,"value":608},"@x402\u002Fcore",{"type":54,"value":288},{"type":48,"tag":63,"props":611,"children":613},{"className":612},[],[614],{"type":54,"value":615},"@x402\u002Fevm",{"type":54,"value":288},{"type":48,"tag":63,"props":618,"children":620},{"className":619},[],[621],{"type":54,"value":622},"@x402\u002Fsvm",{"type":54,"value":567},{"type":48,"tag":63,"props":625,"children":627},{"className":626},[],[628],{"type":54,"value":629},"@x402\u002Fextensions",{"type":54,"value":631}," are optional peer dependencies of the CDP SDK, so they are not installed for you,\nand all four are needed even for an EVM-only server because ",{"type":48,"tag":63,"props":633,"children":635},{"className":634},[],[636],{"type":54,"value":637},"@coinbase\u002Fcdp-sdk\u002Fx402",{"type":54,"value":639}," imports them at\nmodule load. Only the framework and its adapter change between the three TypeScript lines.",{"type":48,"tag":641,"props":642,"children":647},"pre",{"className":643,"code":644,"language":645,"meta":646,"style":646},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","# TypeScript, Express\nnpm install express @coinbase\u002Fcdp-sdk @x402\u002Fcore @x402\u002Fevm @x402\u002Fsvm @x402\u002Fextensions @x402\u002Fexpress\n\n# ...or Hono:    hono @hono\u002Fnode-server, and @x402\u002Fhono in place of @x402\u002Fexpress\n# ...or Next.js: next, and @x402\u002Fnext in place of @x402\u002Fexpress\n\n# Python\npip install \"cdp-sdk\" \"x402[evm,svm,fastapi]\" uvicorn   # FastAPI\npip install \"cdp-sdk\" \"x402[evm,svm,flask]\"             # Flask\n","bash","",[648],{"type":48,"tag":63,"props":649,"children":650},{"__ignoreMap":646},[651,663,714,724,733,742,750,759,811],{"type":48,"tag":652,"props":653,"children":656},"span",{"class":654,"line":655},"line",1,[657],{"type":48,"tag":652,"props":658,"children":660},{"style":659},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[661],{"type":54,"value":662},"# TypeScript, Express\n",{"type":48,"tag":652,"props":664,"children":666},{"class":654,"line":665},2,[667,673,679,684,689,694,699,704,709],{"type":48,"tag":652,"props":668,"children":670},{"style":669},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[671],{"type":54,"value":672},"npm",{"type":48,"tag":652,"props":674,"children":676},{"style":675},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[677],{"type":54,"value":678}," install",{"type":48,"tag":652,"props":680,"children":681},{"style":675},[682],{"type":54,"value":683}," express",{"type":48,"tag":652,"props":685,"children":686},{"style":675},[687],{"type":54,"value":688}," @coinbase\u002Fcdp-sdk",{"type":48,"tag":652,"props":690,"children":691},{"style":675},[692],{"type":54,"value":693}," @x402\u002Fcore",{"type":48,"tag":652,"props":695,"children":696},{"style":675},[697],{"type":54,"value":698}," @x402\u002Fevm",{"type":48,"tag":652,"props":700,"children":701},{"style":675},[702],{"type":54,"value":703}," @x402\u002Fsvm",{"type":48,"tag":652,"props":705,"children":706},{"style":675},[707],{"type":54,"value":708}," @x402\u002Fextensions",{"type":48,"tag":652,"props":710,"children":711},{"style":675},[712],{"type":54,"value":713}," @x402\u002Fexpress\n",{"type":48,"tag":652,"props":715,"children":717},{"class":654,"line":716},3,[718],{"type":48,"tag":652,"props":719,"children":721},{"emptyLinePlaceholder":720},true,[722],{"type":54,"value":723},"\n",{"type":48,"tag":652,"props":725,"children":727},{"class":654,"line":726},4,[728],{"type":48,"tag":652,"props":729,"children":730},{"style":659},[731],{"type":54,"value":732},"# ...or Hono:    hono @hono\u002Fnode-server, and @x402\u002Fhono in place of @x402\u002Fexpress\n",{"type":48,"tag":652,"props":734,"children":736},{"class":654,"line":735},5,[737],{"type":48,"tag":652,"props":738,"children":739},{"style":659},[740],{"type":54,"value":741},"# ...or Next.js: next, and @x402\u002Fnext in place of @x402\u002Fexpress\n",{"type":48,"tag":652,"props":743,"children":745},{"class":654,"line":744},6,[746],{"type":48,"tag":652,"props":747,"children":748},{"emptyLinePlaceholder":720},[749],{"type":54,"value":723},{"type":48,"tag":652,"props":751,"children":753},{"class":654,"line":752},7,[754],{"type":48,"tag":652,"props":755,"children":756},{"style":659},[757],{"type":54,"value":758},"# Python\n",{"type":48,"tag":652,"props":760,"children":762},{"class":654,"line":761},8,[763,768,772,778,783,788,792,797,801,806],{"type":48,"tag":652,"props":764,"children":765},{"style":669},[766],{"type":54,"value":767},"pip",{"type":48,"tag":652,"props":769,"children":770},{"style":675},[771],{"type":54,"value":678},{"type":48,"tag":652,"props":773,"children":775},{"style":774},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[776],{"type":54,"value":777}," \"",{"type":48,"tag":652,"props":779,"children":780},{"style":675},[781],{"type":54,"value":782},"cdp-sdk",{"type":48,"tag":652,"props":784,"children":785},{"style":774},[786],{"type":54,"value":787},"\"",{"type":48,"tag":652,"props":789,"children":790},{"style":774},[791],{"type":54,"value":777},{"type":48,"tag":652,"props":793,"children":794},{"style":675},[795],{"type":54,"value":796},"x402[evm,svm,fastapi]",{"type":48,"tag":652,"props":798,"children":799},{"style":774},[800],{"type":54,"value":787},{"type":48,"tag":652,"props":802,"children":803},{"style":675},[804],{"type":54,"value":805}," uvicorn",{"type":48,"tag":652,"props":807,"children":808},{"style":659},[809],{"type":54,"value":810},"   # FastAPI\n",{"type":48,"tag":652,"props":812,"children":814},{"class":654,"line":813},9,[815,819,823,827,831,835,839,844,848],{"type":48,"tag":652,"props":816,"children":817},{"style":669},[818],{"type":54,"value":767},{"type":48,"tag":652,"props":820,"children":821},{"style":675},[822],{"type":54,"value":678},{"type":48,"tag":652,"props":824,"children":825},{"style":774},[826],{"type":54,"value":777},{"type":48,"tag":652,"props":828,"children":829},{"style":675},[830],{"type":54,"value":782},{"type":48,"tag":652,"props":832,"children":833},{"style":774},[834],{"type":54,"value":787},{"type":48,"tag":652,"props":836,"children":837},{"style":774},[838],{"type":54,"value":777},{"type":48,"tag":652,"props":840,"children":841},{"style":675},[842],{"type":54,"value":843},"x402[evm,svm,flask]",{"type":48,"tag":652,"props":845,"children":846},{"style":774},[847],{"type":54,"value":787},{"type":48,"tag":652,"props":849,"children":850},{"style":659},[851],{"type":54,"value":852},"             # Flask\n",{"type":48,"tag":542,"props":854,"children":856},{"id":855},"_3-price-the-route",[857],{"type":54,"value":858},"3. Price the route",{"type":48,"tag":57,"props":860,"children":861},{},[862,864,869,870,875,877,882],{"type":54,"value":863},"Three things are needed from the user before writing anything. Ask for whichever cannot be inferred:\n",{"type":48,"tag":92,"props":865,"children":866},{},[867],{"type":54,"value":868},"which routes to charge for",{"type":54,"value":288},{"type":48,"tag":92,"props":871,"children":872},{},[873],{"type":54,"value":874},"the price per call",{"type":54,"value":876},", and ",{"type":48,"tag":92,"props":878,"children":879},{},[880],{"type":54,"value":881},"a one-line description of what each\nroute returns",{"type":54,"value":883},". The description is not decoration — it is what buyers see when the service is\nlisted for discovery, so a vague one costs the user customers later.",{"type":48,"tag":57,"props":885,"children":886},{},[887,889,895],{"type":54,"value":888},"State the containment rule plainly: only routes named in the config are protected, everything else\nstays free. That is the sentence that stops someone paywalling ",{"type":48,"tag":63,"props":890,"children":892},{"className":891},[],[893],{"type":54,"value":894},"\u002Fhealth",{"type":54,"value":136},{"type":48,"tag":57,"props":897,"children":898},{},[899],{"type":54,"value":900},"Read only the subsections matching the language and framework resolved above.",{"type":48,"tag":902,"props":903,"children":904},"h4",{"id":14},[905],{"type":54,"value":13},{"type":48,"tag":57,"props":907,"children":908},{},[909,915,917,923,925,931],{"type":48,"tag":63,"props":910,"children":912},{"className":911},[],[913],{"type":54,"value":914},"createX402Server",{"type":54,"value":916}," provisions the receiver wallet, wires the CDP Facilitator, registers the schemes\nand extensions, and returns an object any x402 framework adapter accepts. It is async — ",{"type":48,"tag":63,"props":918,"children":920},{"className":919},[],[921],{"type":54,"value":922},"await",{"type":54,"value":924}," it\nbefore ",{"type":48,"tag":63,"props":926,"children":928},{"className":927},[],[929],{"type":54,"value":930},"app.use",{"type":54,"value":136},{"type":48,"tag":641,"props":933,"children":936},{"className":934,"code":935,"language":14,"meta":646,"style":646},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createX402Server } from \"@coinbase\u002Fcdp-sdk\u002Fx402\";\nimport { paymentMiddlewareFromHTTPServer } from \"@x402\u002Fexpress\";\nimport express from \"express\";\n\nconst app = express();\n\nconst server = await createX402Server({\n  environment: \"development\", \u002F\u002F testnets and test funds\n  routes: {\n    \"GET \u002Freport\": { price: \"$0.01\", description: \"Generate a concise research report\" },\n  },\n});\n\napp.use(paymentMiddlewareFromHTTPServer(server));\napp.get(\"\u002Freport\", (_req, res) => res.json({ report: \"...\" }));\n\napp.listen(8402, () => console.log(`Receiving payments at ${server.payToEvmAddress}`));\n",[937],{"type":48,"tag":63,"props":938,"children":939},{"__ignoreMap":646},[940,987,1028,1061,1068,1101,1108,1143,1179,1196,1275,1284,1302,1310,1346,1470,1478],{"type":48,"tag":652,"props":941,"children":942},{"class":654,"line":655},[943,949,954,960,965,970,974,978,982],{"type":48,"tag":652,"props":944,"children":946},{"style":945},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[947],{"type":54,"value":948},"import",{"type":48,"tag":652,"props":950,"children":951},{"style":774},[952],{"type":54,"value":953}," {",{"type":48,"tag":652,"props":955,"children":957},{"style":956},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[958],{"type":54,"value":959}," createX402Server",{"type":48,"tag":652,"props":961,"children":962},{"style":774},[963],{"type":54,"value":964}," }",{"type":48,"tag":652,"props":966,"children":967},{"style":945},[968],{"type":54,"value":969}," from",{"type":48,"tag":652,"props":971,"children":972},{"style":774},[973],{"type":54,"value":777},{"type":48,"tag":652,"props":975,"children":976},{"style":675},[977],{"type":54,"value":637},{"type":48,"tag":652,"props":979,"children":980},{"style":774},[981],{"type":54,"value":787},{"type":48,"tag":652,"props":983,"children":984},{"style":774},[985],{"type":54,"value":986},";\n",{"type":48,"tag":652,"props":988,"children":989},{"class":654,"line":665},[990,994,998,1003,1007,1011,1015,1020,1024],{"type":48,"tag":652,"props":991,"children":992},{"style":945},[993],{"type":54,"value":948},{"type":48,"tag":652,"props":995,"children":996},{"style":774},[997],{"type":54,"value":953},{"type":48,"tag":652,"props":999,"children":1000},{"style":956},[1001],{"type":54,"value":1002}," paymentMiddlewareFromHTTPServer",{"type":48,"tag":652,"props":1004,"children":1005},{"style":774},[1006],{"type":54,"value":964},{"type":48,"tag":652,"props":1008,"children":1009},{"style":945},[1010],{"type":54,"value":969},{"type":48,"tag":652,"props":1012,"children":1013},{"style":774},[1014],{"type":54,"value":777},{"type":48,"tag":652,"props":1016,"children":1017},{"style":675},[1018],{"type":54,"value":1019},"@x402\u002Fexpress",{"type":48,"tag":652,"props":1021,"children":1022},{"style":774},[1023],{"type":54,"value":787},{"type":48,"tag":652,"props":1025,"children":1026},{"style":774},[1027],{"type":54,"value":986},{"type":48,"tag":652,"props":1029,"children":1030},{"class":654,"line":716},[1031,1035,1040,1045,1049,1053,1057],{"type":48,"tag":652,"props":1032,"children":1033},{"style":945},[1034],{"type":54,"value":948},{"type":48,"tag":652,"props":1036,"children":1037},{"style":956},[1038],{"type":54,"value":1039}," express ",{"type":48,"tag":652,"props":1041,"children":1042},{"style":945},[1043],{"type":54,"value":1044},"from",{"type":48,"tag":652,"props":1046,"children":1047},{"style":774},[1048],{"type":54,"value":777},{"type":48,"tag":652,"props":1050,"children":1051},{"style":675},[1052],{"type":54,"value":286},{"type":48,"tag":652,"props":1054,"children":1055},{"style":774},[1056],{"type":54,"value":787},{"type":48,"tag":652,"props":1058,"children":1059},{"style":774},[1060],{"type":54,"value":986},{"type":48,"tag":652,"props":1062,"children":1063},{"class":654,"line":726},[1064],{"type":48,"tag":652,"props":1065,"children":1066},{"emptyLinePlaceholder":720},[1067],{"type":54,"value":723},{"type":48,"tag":652,"props":1069,"children":1070},{"class":654,"line":735},[1071,1077,1082,1087,1092,1097],{"type":48,"tag":652,"props":1072,"children":1074},{"style":1073},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[1075],{"type":54,"value":1076},"const",{"type":48,"tag":652,"props":1078,"children":1079},{"style":956},[1080],{"type":54,"value":1081}," app ",{"type":48,"tag":652,"props":1083,"children":1084},{"style":774},[1085],{"type":54,"value":1086},"=",{"type":48,"tag":652,"props":1088,"children":1090},{"style":1089},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[1091],{"type":54,"value":683},{"type":48,"tag":652,"props":1093,"children":1094},{"style":956},[1095],{"type":54,"value":1096},"()",{"type":48,"tag":652,"props":1098,"children":1099},{"style":774},[1100],{"type":54,"value":986},{"type":48,"tag":652,"props":1102,"children":1103},{"class":654,"line":744},[1104],{"type":48,"tag":652,"props":1105,"children":1106},{"emptyLinePlaceholder":720},[1107],{"type":54,"value":723},{"type":48,"tag":652,"props":1109,"children":1110},{"class":654,"line":752},[1111,1115,1120,1124,1129,1133,1138],{"type":48,"tag":652,"props":1112,"children":1113},{"style":1073},[1114],{"type":54,"value":1076},{"type":48,"tag":652,"props":1116,"children":1117},{"style":956},[1118],{"type":54,"value":1119}," server ",{"type":48,"tag":652,"props":1121,"children":1122},{"style":774},[1123],{"type":54,"value":1086},{"type":48,"tag":652,"props":1125,"children":1126},{"style":945},[1127],{"type":54,"value":1128}," await",{"type":48,"tag":652,"props":1130,"children":1131},{"style":1089},[1132],{"type":54,"value":959},{"type":48,"tag":652,"props":1134,"children":1135},{"style":956},[1136],{"type":54,"value":1137},"(",{"type":48,"tag":652,"props":1139,"children":1140},{"style":774},[1141],{"type":54,"value":1142},"{\n",{"type":48,"tag":652,"props":1144,"children":1145},{"class":654,"line":761},[1146,1152,1157,1161,1165,1169,1174],{"type":48,"tag":652,"props":1147,"children":1149},{"style":1148},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[1150],{"type":54,"value":1151},"  environment",{"type":48,"tag":652,"props":1153,"children":1154},{"style":774},[1155],{"type":54,"value":1156},":",{"type":48,"tag":652,"props":1158,"children":1159},{"style":774},[1160],{"type":54,"value":777},{"type":48,"tag":652,"props":1162,"children":1163},{"style":675},[1164],{"type":54,"value":458},{"type":48,"tag":652,"props":1166,"children":1167},{"style":774},[1168],{"type":54,"value":787},{"type":48,"tag":652,"props":1170,"children":1171},{"style":774},[1172],{"type":54,"value":1173},",",{"type":48,"tag":652,"props":1175,"children":1176},{"style":659},[1177],{"type":54,"value":1178}," \u002F\u002F testnets and test funds\n",{"type":48,"tag":652,"props":1180,"children":1181},{"class":654,"line":813},[1182,1187,1191],{"type":48,"tag":652,"props":1183,"children":1184},{"style":1148},[1185],{"type":54,"value":1186},"  routes",{"type":48,"tag":652,"props":1188,"children":1189},{"style":774},[1190],{"type":54,"value":1156},{"type":48,"tag":652,"props":1192,"children":1193},{"style":774},[1194],{"type":54,"value":1195}," {\n",{"type":48,"tag":652,"props":1197,"children":1199},{"class":654,"line":1198},10,[1200,1205,1210,1214,1218,1222,1227,1231,1235,1240,1244,1248,1253,1257,1261,1266,1270],{"type":48,"tag":652,"props":1201,"children":1202},{"style":774},[1203],{"type":54,"value":1204},"    \"",{"type":48,"tag":652,"props":1206,"children":1207},{"style":1148},[1208],{"type":54,"value":1209},"GET \u002Freport",{"type":48,"tag":652,"props":1211,"children":1212},{"style":774},[1213],{"type":54,"value":787},{"type":48,"tag":652,"props":1215,"children":1216},{"style":774},[1217],{"type":54,"value":1156},{"type":48,"tag":652,"props":1219,"children":1220},{"style":774},[1221],{"type":54,"value":953},{"type":48,"tag":652,"props":1223,"children":1224},{"style":1148},[1225],{"type":54,"value":1226}," price",{"type":48,"tag":652,"props":1228,"children":1229},{"style":774},[1230],{"type":54,"value":1156},{"type":48,"tag":652,"props":1232,"children":1233},{"style":774},[1234],{"type":54,"value":777},{"type":48,"tag":652,"props":1236,"children":1237},{"style":675},[1238],{"type":54,"value":1239},"$0.01",{"type":48,"tag":652,"props":1241,"children":1242},{"style":774},[1243],{"type":54,"value":787},{"type":48,"tag":652,"props":1245,"children":1246},{"style":774},[1247],{"type":54,"value":1173},{"type":48,"tag":652,"props":1249,"children":1250},{"style":1148},[1251],{"type":54,"value":1252}," description",{"type":48,"tag":652,"props":1254,"children":1255},{"style":774},[1256],{"type":54,"value":1156},{"type":48,"tag":652,"props":1258,"children":1259},{"style":774},[1260],{"type":54,"value":777},{"type":48,"tag":652,"props":1262,"children":1263},{"style":675},[1264],{"type":54,"value":1265},"Generate a concise research report",{"type":48,"tag":652,"props":1267,"children":1268},{"style":774},[1269],{"type":54,"value":787},{"type":48,"tag":652,"props":1271,"children":1272},{"style":774},[1273],{"type":54,"value":1274}," },\n",{"type":48,"tag":652,"props":1276,"children":1278},{"class":654,"line":1277},11,[1279],{"type":48,"tag":652,"props":1280,"children":1281},{"style":774},[1282],{"type":54,"value":1283},"  },\n",{"type":48,"tag":652,"props":1285,"children":1287},{"class":654,"line":1286},12,[1288,1293,1298],{"type":48,"tag":652,"props":1289,"children":1290},{"style":774},[1291],{"type":54,"value":1292},"}",{"type":48,"tag":652,"props":1294,"children":1295},{"style":956},[1296],{"type":54,"value":1297},")",{"type":48,"tag":652,"props":1299,"children":1300},{"style":774},[1301],{"type":54,"value":986},{"type":48,"tag":652,"props":1303,"children":1305},{"class":654,"line":1304},13,[1306],{"type":48,"tag":652,"props":1307,"children":1308},{"emptyLinePlaceholder":720},[1309],{"type":54,"value":723},{"type":48,"tag":652,"props":1311,"children":1313},{"class":654,"line":1312},14,[1314,1319,1323,1328,1332,1337,1342],{"type":48,"tag":652,"props":1315,"children":1316},{"style":956},[1317],{"type":54,"value":1318},"app",{"type":48,"tag":652,"props":1320,"children":1321},{"style":774},[1322],{"type":54,"value":136},{"type":48,"tag":652,"props":1324,"children":1325},{"style":1089},[1326],{"type":54,"value":1327},"use",{"type":48,"tag":652,"props":1329,"children":1330},{"style":956},[1331],{"type":54,"value":1137},{"type":48,"tag":652,"props":1333,"children":1334},{"style":1089},[1335],{"type":54,"value":1336},"paymentMiddlewareFromHTTPServer",{"type":48,"tag":652,"props":1338,"children":1339},{"style":956},[1340],{"type":54,"value":1341},"(server))",{"type":48,"tag":652,"props":1343,"children":1344},{"style":774},[1345],{"type":54,"value":986},{"type":48,"tag":652,"props":1347,"children":1349},{"class":654,"line":1348},15,[1350,1354,1358,1363,1367,1371,1376,1380,1384,1389,1395,1399,1404,1408,1413,1417,1421,1426,1430,1435,1440,1444,1448,1453,1457,1461,1466],{"type":48,"tag":652,"props":1351,"children":1352},{"style":956},[1353],{"type":54,"value":1318},{"type":48,"tag":652,"props":1355,"children":1356},{"style":774},[1357],{"type":54,"value":136},{"type":48,"tag":652,"props":1359,"children":1360},{"style":1089},[1361],{"type":54,"value":1362},"get",{"type":48,"tag":652,"props":1364,"children":1365},{"style":956},[1366],{"type":54,"value":1137},{"type":48,"tag":652,"props":1368,"children":1369},{"style":774},[1370],{"type":54,"value":787},{"type":48,"tag":652,"props":1372,"children":1373},{"style":675},[1374],{"type":54,"value":1375},"\u002Freport",{"type":48,"tag":652,"props":1377,"children":1378},{"style":774},[1379],{"type":54,"value":787},{"type":48,"tag":652,"props":1381,"children":1382},{"style":774},[1383],{"type":54,"value":1173},{"type":48,"tag":652,"props":1385,"children":1386},{"style":774},[1387],{"type":54,"value":1388}," (",{"type":48,"tag":652,"props":1390,"children":1392},{"style":1391},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[1393],{"type":54,"value":1394},"_req",{"type":48,"tag":652,"props":1396,"children":1397},{"style":774},[1398],{"type":54,"value":1173},{"type":48,"tag":652,"props":1400,"children":1401},{"style":1391},[1402],{"type":54,"value":1403}," res",{"type":48,"tag":652,"props":1405,"children":1406},{"style":774},[1407],{"type":54,"value":1297},{"type":48,"tag":652,"props":1409,"children":1410},{"style":1073},[1411],{"type":54,"value":1412}," =>",{"type":48,"tag":652,"props":1414,"children":1415},{"style":956},[1416],{"type":54,"value":1403},{"type":48,"tag":652,"props":1418,"children":1419},{"style":774},[1420],{"type":54,"value":136},{"type":48,"tag":652,"props":1422,"children":1423},{"style":1089},[1424],{"type":54,"value":1425},"json",{"type":48,"tag":652,"props":1427,"children":1428},{"style":956},[1429],{"type":54,"value":1137},{"type":48,"tag":652,"props":1431,"children":1432},{"style":774},[1433],{"type":54,"value":1434},"{",{"type":48,"tag":652,"props":1436,"children":1437},{"style":1148},[1438],{"type":54,"value":1439}," report",{"type":48,"tag":652,"props":1441,"children":1442},{"style":774},[1443],{"type":54,"value":1156},{"type":48,"tag":652,"props":1445,"children":1446},{"style":774},[1447],{"type":54,"value":777},{"type":48,"tag":652,"props":1449,"children":1450},{"style":675},[1451],{"type":54,"value":1452},"...",{"type":48,"tag":652,"props":1454,"children":1455},{"style":774},[1456],{"type":54,"value":787},{"type":48,"tag":652,"props":1458,"children":1459},{"style":774},[1460],{"type":54,"value":964},{"type":48,"tag":652,"props":1462,"children":1463},{"style":956},[1464],{"type":54,"value":1465},"))",{"type":48,"tag":652,"props":1467,"children":1468},{"style":774},[1469],{"type":54,"value":986},{"type":48,"tag":652,"props":1471,"children":1473},{"class":654,"line":1472},16,[1474],{"type":48,"tag":652,"props":1475,"children":1476},{"emptyLinePlaceholder":720},[1477],{"type":54,"value":723},{"type":48,"tag":652,"props":1479,"children":1481},{"class":654,"line":1480},17,[1482,1486,1490,1495,1499,1505,1509,1514,1518,1523,1527,1532,1536,1541,1546,1551,1556,1560,1565,1570,1574],{"type":48,"tag":652,"props":1483,"children":1484},{"style":956},[1485],{"type":54,"value":1318},{"type":48,"tag":652,"props":1487,"children":1488},{"style":774},[1489],{"type":54,"value":136},{"type":48,"tag":652,"props":1491,"children":1492},{"style":1089},[1493],{"type":54,"value":1494},"listen",{"type":48,"tag":652,"props":1496,"children":1497},{"style":956},[1498],{"type":54,"value":1137},{"type":48,"tag":652,"props":1500,"children":1502},{"style":1501},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[1503],{"type":54,"value":1504},"8402",{"type":48,"tag":652,"props":1506,"children":1507},{"style":774},[1508],{"type":54,"value":1173},{"type":48,"tag":652,"props":1510,"children":1511},{"style":774},[1512],{"type":54,"value":1513}," ()",{"type":48,"tag":652,"props":1515,"children":1516},{"style":1073},[1517],{"type":54,"value":1412},{"type":48,"tag":652,"props":1519,"children":1520},{"style":956},[1521],{"type":54,"value":1522}," console",{"type":48,"tag":652,"props":1524,"children":1525},{"style":774},[1526],{"type":54,"value":136},{"type":48,"tag":652,"props":1528,"children":1529},{"style":1089},[1530],{"type":54,"value":1531},"log",{"type":48,"tag":652,"props":1533,"children":1534},{"style":956},[1535],{"type":54,"value":1137},{"type":48,"tag":652,"props":1537,"children":1538},{"style":774},[1539],{"type":54,"value":1540},"`",{"type":48,"tag":652,"props":1542,"children":1543},{"style":675},[1544],{"type":54,"value":1545},"Receiving payments at ",{"type":48,"tag":652,"props":1547,"children":1548},{"style":774},[1549],{"type":54,"value":1550},"${",{"type":48,"tag":652,"props":1552,"children":1553},{"style":956},[1554],{"type":54,"value":1555},"server",{"type":48,"tag":652,"props":1557,"children":1558},{"style":774},[1559],{"type":54,"value":136},{"type":48,"tag":652,"props":1561,"children":1562},{"style":956},[1563],{"type":54,"value":1564},"payToEvmAddress",{"type":48,"tag":652,"props":1566,"children":1567},{"style":774},[1568],{"type":54,"value":1569},"}`",{"type":48,"tag":652,"props":1571,"children":1572},{"style":956},[1573],{"type":54,"value":1465},{"type":48,"tag":652,"props":1575,"children":1576},{"style":774},[1577],{"type":54,"value":986},{"type":48,"tag":57,"props":1579,"children":1580},{},[1581],{"type":54,"value":1582},"Two variants on that shape:",{"type":48,"tag":84,"props":1584,"children":1585},{},[1586,1618],{"type":48,"tag":88,"props":1587,"children":1588},{},[1589,1594,1596,1602,1604,1609,1611,1616],{"type":48,"tag":92,"props":1590,"children":1591},{},[1592],{"type":54,"value":1593},"The user already runs x402.",{"type":54,"value":1595}," Do not rewrite their server. Replace the facilitator argument\nwith ",{"type":48,"tag":63,"props":1597,"children":1599},{"className":1598},[],[1600],{"type":54,"value":1601},"createCdpFacilitatorClient()",{"type":54,"value":1603}," from ",{"type":48,"tag":63,"props":1605,"children":1607},{"className":1606},[],[1608],{"type":54,"value":637},{"type":54,"value":1610}," — same return type, so nothing\nelse in their code moves. This path needs a ",{"type":48,"tag":63,"props":1612,"children":1614},{"className":1613},[],[1615],{"type":54,"value":414},{"type":54,"value":1617}," address, and the factory is synchronous.",{"type":48,"tag":88,"props":1619,"children":1620},{},[1621,1626,1628,1634,1636,1642],{"type":48,"tag":92,"props":1622,"children":1623},{},[1624],{"type":54,"value":1625},"Routes belong in a file.",{"type":54,"value":1627}," Pass ",{"type":48,"tag":63,"props":1629,"children":1631},{"className":1630},[],[1632],{"type":54,"value":1633},"configPath: \".\u002Fx402.config.json\"",{"type":54,"value":1635}," instead of ",{"type":48,"tag":63,"props":1637,"children":1639},{"className":1638},[],[1640],{"type":54,"value":1641},"routes",{"type":54,"value":1643},". Inline\nroutes win per key when both are given, which is how you keep a shared file and still special-case\none route in code. Keep credentials in environment variables, not the file.",{"type":48,"tag":57,"props":1645,"children":1646},{},[1647,1652,1654,1660,1662,1667,1669,1675,1676,1682],{"type":48,"tag":92,"props":1648,"children":1649},{},[1650],{"type":54,"value":1651},"Hono",{"type":54,"value":1653}," is the Express code with ",{"type":48,"tag":63,"props":1655,"children":1657},{"className":1656},[],[1658],{"type":54,"value":1659},"@x402\u002Fhono",{"type":54,"value":1661}," in place of ",{"type":48,"tag":63,"props":1663,"children":1665},{"className":1664},[],[1666],{"type":54,"value":1019},{"type":54,"value":1668}," and ",{"type":48,"tag":63,"props":1670,"children":1672},{"className":1671},[],[1673],{"type":54,"value":1674},"serve({ fetch: app.fetch, port })",{"type":54,"value":1661},{"type":48,"tag":63,"props":1677,"children":1679},{"className":1678},[],[1680],{"type":54,"value":1681},"app.listen",{"type":54,"value":1683},". The server object is identical.",{"type":48,"tag":57,"props":1685,"children":1686},{},[1687,1692],{"type":48,"tag":92,"props":1688,"children":1689},{},[1690],{"type":54,"value":1691},"Next.js",{"type":54,"value":1693}," is the one genuine exception. App Router route files re-evaluate, so build the server\nonce in its own module and import it from the handler:",{"type":48,"tag":641,"props":1695,"children":1697},{"className":934,"code":1696,"language":14,"meta":646,"style":646},"\u002F\u002F app\u002Fx402.ts — note the \u002Fserver subpath: the client ExactEvmScheme needs a signer\nimport { x402ResourceServer } from \"@x402\u002Fcore\u002Fserver\";\nimport { ExactEvmScheme } from \"@x402\u002Fevm\u002Fexact\u002Fserver\";\nimport { createCdpFacilitatorClient } from \"@coinbase\u002Fcdp-sdk\u002Fx402\";\n\nexport const server = new x402ResourceServer(createCdpFacilitatorClient()).register(\n  \"eip155:84532\",\n  new ExactEvmScheme(),\n);\n\n\u002F\u002F app\u002Fapi\u002Freport\u002Froute.ts\nimport { withX402 } from \"@x402\u002Fnext\";\nexport const GET = withX402(handler, { accepts: [...], description: \"...\" }, server);\n",[1698],{"type":48,"tag":63,"props":1699,"children":1700},{"__ignoreMap":646},[1701,1709,1750,1791,1831,1838,1896,1918,1938,1949,1956,1964,2005],{"type":48,"tag":652,"props":1702,"children":1703},{"class":654,"line":655},[1704],{"type":48,"tag":652,"props":1705,"children":1706},{"style":659},[1707],{"type":54,"value":1708},"\u002F\u002F app\u002Fx402.ts — note the \u002Fserver subpath: the client ExactEvmScheme needs a signer\n",{"type":48,"tag":652,"props":1710,"children":1711},{"class":654,"line":665},[1712,1716,1720,1725,1729,1733,1737,1742,1746],{"type":48,"tag":652,"props":1713,"children":1714},{"style":945},[1715],{"type":54,"value":948},{"type":48,"tag":652,"props":1717,"children":1718},{"style":774},[1719],{"type":54,"value":953},{"type":48,"tag":652,"props":1721,"children":1722},{"style":956},[1723],{"type":54,"value":1724}," x402ResourceServer",{"type":48,"tag":652,"props":1726,"children":1727},{"style":774},[1728],{"type":54,"value":964},{"type":48,"tag":652,"props":1730,"children":1731},{"style":945},[1732],{"type":54,"value":969},{"type":48,"tag":652,"props":1734,"children":1735},{"style":774},[1736],{"type":54,"value":777},{"type":48,"tag":652,"props":1738,"children":1739},{"style":675},[1740],{"type":54,"value":1741},"@x402\u002Fcore\u002Fserver",{"type":48,"tag":652,"props":1743,"children":1744},{"style":774},[1745],{"type":54,"value":787},{"type":48,"tag":652,"props":1747,"children":1748},{"style":774},[1749],{"type":54,"value":986},{"type":48,"tag":652,"props":1751,"children":1752},{"class":654,"line":716},[1753,1757,1761,1766,1770,1774,1778,1783,1787],{"type":48,"tag":652,"props":1754,"children":1755},{"style":945},[1756],{"type":54,"value":948},{"type":48,"tag":652,"props":1758,"children":1759},{"style":774},[1760],{"type":54,"value":953},{"type":48,"tag":652,"props":1762,"children":1763},{"style":956},[1764],{"type":54,"value":1765}," ExactEvmScheme",{"type":48,"tag":652,"props":1767,"children":1768},{"style":774},[1769],{"type":54,"value":964},{"type":48,"tag":652,"props":1771,"children":1772},{"style":945},[1773],{"type":54,"value":969},{"type":48,"tag":652,"props":1775,"children":1776},{"style":774},[1777],{"type":54,"value":777},{"type":48,"tag":652,"props":1779,"children":1780},{"style":675},[1781],{"type":54,"value":1782},"@x402\u002Fevm\u002Fexact\u002Fserver",{"type":48,"tag":652,"props":1784,"children":1785},{"style":774},[1786],{"type":54,"value":787},{"type":48,"tag":652,"props":1788,"children":1789},{"style":774},[1790],{"type":54,"value":986},{"type":48,"tag":652,"props":1792,"children":1793},{"class":654,"line":726},[1794,1798,1802,1807,1811,1815,1819,1823,1827],{"type":48,"tag":652,"props":1795,"children":1796},{"style":945},[1797],{"type":54,"value":948},{"type":48,"tag":652,"props":1799,"children":1800},{"style":774},[1801],{"type":54,"value":953},{"type":48,"tag":652,"props":1803,"children":1804},{"style":956},[1805],{"type":54,"value":1806}," createCdpFacilitatorClient",{"type":48,"tag":652,"props":1808,"children":1809},{"style":774},[1810],{"type":54,"value":964},{"type":48,"tag":652,"props":1812,"children":1813},{"style":945},[1814],{"type":54,"value":969},{"type":48,"tag":652,"props":1816,"children":1817},{"style":774},[1818],{"type":54,"value":777},{"type":48,"tag":652,"props":1820,"children":1821},{"style":675},[1822],{"type":54,"value":637},{"type":48,"tag":652,"props":1824,"children":1825},{"style":774},[1826],{"type":54,"value":787},{"type":48,"tag":652,"props":1828,"children":1829},{"style":774},[1830],{"type":54,"value":986},{"type":48,"tag":652,"props":1832,"children":1833},{"class":654,"line":735},[1834],{"type":48,"tag":652,"props":1835,"children":1836},{"emptyLinePlaceholder":720},[1837],{"type":54,"value":723},{"type":48,"tag":652,"props":1839,"children":1840},{"class":654,"line":744},[1841,1846,1851,1855,1859,1864,1868,1872,1877,1882,1886,1891],{"type":48,"tag":652,"props":1842,"children":1843},{"style":945},[1844],{"type":54,"value":1845},"export",{"type":48,"tag":652,"props":1847,"children":1848},{"style":1073},[1849],{"type":54,"value":1850}," const",{"type":48,"tag":652,"props":1852,"children":1853},{"style":956},[1854],{"type":54,"value":1119},{"type":48,"tag":652,"props":1856,"children":1857},{"style":774},[1858],{"type":54,"value":1086},{"type":48,"tag":652,"props":1860,"children":1861},{"style":774},[1862],{"type":54,"value":1863}," new",{"type":48,"tag":652,"props":1865,"children":1866},{"style":1089},[1867],{"type":54,"value":1724},{"type":48,"tag":652,"props":1869,"children":1870},{"style":956},[1871],{"type":54,"value":1137},{"type":48,"tag":652,"props":1873,"children":1874},{"style":1089},[1875],{"type":54,"value":1876},"createCdpFacilitatorClient",{"type":48,"tag":652,"props":1878,"children":1879},{"style":956},[1880],{"type":54,"value":1881},"())",{"type":48,"tag":652,"props":1883,"children":1884},{"style":774},[1885],{"type":54,"value":136},{"type":48,"tag":652,"props":1887,"children":1888},{"style":1089},[1889],{"type":54,"value":1890},"register",{"type":48,"tag":652,"props":1892,"children":1893},{"style":956},[1894],{"type":54,"value":1895},"(\n",{"type":48,"tag":652,"props":1897,"children":1898},{"class":654,"line":752},[1899,1904,1909,1913],{"type":48,"tag":652,"props":1900,"children":1901},{"style":774},[1902],{"type":54,"value":1903},"  \"",{"type":48,"tag":652,"props":1905,"children":1906},{"style":675},[1907],{"type":54,"value":1908},"eip155:84532",{"type":48,"tag":652,"props":1910,"children":1911},{"style":774},[1912],{"type":54,"value":787},{"type":48,"tag":652,"props":1914,"children":1915},{"style":774},[1916],{"type":54,"value":1917},",\n",{"type":48,"tag":652,"props":1919,"children":1920},{"class":654,"line":761},[1921,1926,1930,1934],{"type":48,"tag":652,"props":1922,"children":1923},{"style":774},[1924],{"type":54,"value":1925},"  new",{"type":48,"tag":652,"props":1927,"children":1928},{"style":1089},[1929],{"type":54,"value":1765},{"type":48,"tag":652,"props":1931,"children":1932},{"style":956},[1933],{"type":54,"value":1096},{"type":48,"tag":652,"props":1935,"children":1936},{"style":774},[1937],{"type":54,"value":1917},{"type":48,"tag":652,"props":1939,"children":1940},{"class":654,"line":813},[1941,1945],{"type":48,"tag":652,"props":1942,"children":1943},{"style":956},[1944],{"type":54,"value":1297},{"type":48,"tag":652,"props":1946,"children":1947},{"style":774},[1948],{"type":54,"value":986},{"type":48,"tag":652,"props":1950,"children":1951},{"class":654,"line":1198},[1952],{"type":48,"tag":652,"props":1953,"children":1954},{"emptyLinePlaceholder":720},[1955],{"type":54,"value":723},{"type":48,"tag":652,"props":1957,"children":1958},{"class":654,"line":1277},[1959],{"type":48,"tag":652,"props":1960,"children":1961},{"style":659},[1962],{"type":54,"value":1963},"\u002F\u002F app\u002Fapi\u002Freport\u002Froute.ts\n",{"type":48,"tag":652,"props":1965,"children":1966},{"class":654,"line":1286},[1967,1971,1975,1980,1984,1988,1992,1997,2001],{"type":48,"tag":652,"props":1968,"children":1969},{"style":945},[1970],{"type":54,"value":948},{"type":48,"tag":652,"props":1972,"children":1973},{"style":774},[1974],{"type":54,"value":953},{"type":48,"tag":652,"props":1976,"children":1977},{"style":956},[1978],{"type":54,"value":1979}," withX402",{"type":48,"tag":652,"props":1981,"children":1982},{"style":774},[1983],{"type":54,"value":964},{"type":48,"tag":652,"props":1985,"children":1986},{"style":945},[1987],{"type":54,"value":969},{"type":48,"tag":652,"props":1989,"children":1990},{"style":774},[1991],{"type":54,"value":777},{"type":48,"tag":652,"props":1993,"children":1994},{"style":675},[1995],{"type":54,"value":1996},"@x402\u002Fnext",{"type":48,"tag":652,"props":1998,"children":1999},{"style":774},[2000],{"type":54,"value":787},{"type":48,"tag":652,"props":2002,"children":2003},{"style":774},[2004],{"type":54,"value":986},{"type":48,"tag":652,"props":2006,"children":2007},{"class":654,"line":1304},[2008,2012,2016,2021,2025,2029,2034,2038,2042,2047,2051,2056,2060,2065,2069,2073,2077,2081,2085,2089,2094,2099],{"type":48,"tag":652,"props":2009,"children":2010},{"style":945},[2011],{"type":54,"value":1845},{"type":48,"tag":652,"props":2013,"children":2014},{"style":1073},[2015],{"type":54,"value":1850},{"type":48,"tag":652,"props":2017,"children":2018},{"style":956},[2019],{"type":54,"value":2020}," GET ",{"type":48,"tag":652,"props":2022,"children":2023},{"style":774},[2024],{"type":54,"value":1086},{"type":48,"tag":652,"props":2026,"children":2027},{"style":1089},[2028],{"type":54,"value":1979},{"type":48,"tag":652,"props":2030,"children":2031},{"style":956},[2032],{"type":54,"value":2033},"(handler",{"type":48,"tag":652,"props":2035,"children":2036},{"style":774},[2037],{"type":54,"value":1173},{"type":48,"tag":652,"props":2039,"children":2040},{"style":774},[2041],{"type":54,"value":953},{"type":48,"tag":652,"props":2043,"children":2044},{"style":1148},[2045],{"type":54,"value":2046}," accepts",{"type":48,"tag":652,"props":2048,"children":2049},{"style":774},[2050],{"type":54,"value":1156},{"type":48,"tag":652,"props":2052,"children":2053},{"style":956},[2054],{"type":54,"value":2055}," [",{"type":48,"tag":652,"props":2057,"children":2058},{"style":774},[2059],{"type":54,"value":1452},{"type":48,"tag":652,"props":2061,"children":2062},{"style":956},[2063],{"type":54,"value":2064},"]",{"type":48,"tag":652,"props":2066,"children":2067},{"style":774},[2068],{"type":54,"value":1173},{"type":48,"tag":652,"props":2070,"children":2071},{"style":1148},[2072],{"type":54,"value":1252},{"type":48,"tag":652,"props":2074,"children":2075},{"style":774},[2076],{"type":54,"value":1156},{"type":48,"tag":652,"props":2078,"children":2079},{"style":774},[2080],{"type":54,"value":777},{"type":48,"tag":652,"props":2082,"children":2083},{"style":675},[2084],{"type":54,"value":1452},{"type":48,"tag":652,"props":2086,"children":2087},{"style":774},[2088],{"type":54,"value":787},{"type":48,"tag":652,"props":2090,"children":2091},{"style":774},[2092],{"type":54,"value":2093}," },",{"type":48,"tag":652,"props":2095,"children":2096},{"style":956},[2097],{"type":54,"value":2098}," server)",{"type":48,"tag":652,"props":2100,"children":2101},{"style":774},[2102],{"type":54,"value":986},{"type":48,"tag":57,"props":2104,"children":2105},{},[2106],{"type":54,"value":2107},"Gotchas worth stating once:",{"type":48,"tag":84,"props":2109,"children":2110},{},[2111,2116,2129],{"type":48,"tag":88,"props":2112,"children":2113},{},[2114],{"type":54,"value":2115},"Register the middleware before the protected handlers.",{"type":48,"tag":88,"props":2117,"children":2118},{},[2119,2121,2127],{"type":54,"value":2120},"Omitting ",{"type":48,"tag":63,"props":2122,"children":2124},{"className":2123},[],[2125],{"type":54,"value":2126},"environment",{"type":54,"value":2128}," means mainnet.",{"type":48,"tag":88,"props":2130,"children":2131},{},[2132,2134,2140],{"type":54,"value":2133},"Under ",{"type":48,"tag":63,"props":2135,"children":2137},{"className":2136},[],[2138],{"type":54,"value":2139},"\"development\"",{"type":54,"value":2141},", routes default to both Base Sepolia and Solana Devnet.",{"type":48,"tag":57,"props":2143,"children":2144},{},[2145,2156,2158,2164,2166,2172,2174,2180,2182,2188,2190,2196,2198,2204,2206,2211,2213,2218],{"type":48,"tag":92,"props":2146,"children":2147},{},[2148,2150,2155],{"type":54,"value":2149},"Usage-based pricing (",{"type":48,"tag":63,"props":2151,"children":2153},{"className":2152},[],[2154],{"type":54,"value":485},{"type":54,"value":1297},{"type":54,"value":2157}," only when the user asks for it. The route takes ",{"type":48,"tag":63,"props":2159,"children":2161},{"className":2160},[],[2162],{"type":54,"value":2163},"scheme: \"upto\"",{"type":54,"value":2165},"\nand a price that acts as a ceiling; the handler calls ",{"type":48,"tag":63,"props":2167,"children":2169},{"className":2168},[],[2170],{"type":54,"value":2171},"setSettlementOverrides(res, { amount })",{"type":54,"value":2173},"\nwith the amount actually used before sending the body. ",{"type":48,"tag":63,"props":2175,"children":2177},{"className":2176},[],[2178],{"type":54,"value":2179},"amount",{"type":54,"value":2181}," is a string, and it accepts atomic\nunits (",{"type":48,"tag":63,"props":2183,"children":2185},{"className":2184},[],[2186],{"type":54,"value":2187},"\"100000\"",{"type":54,"value":2189}," is $0.10 in 6-decimal USDC), a dollar price (",{"type":48,"tag":63,"props":2191,"children":2193},{"className":2192},[],[2194],{"type":54,"value":2195},"\"$0.05\"",{"type":54,"value":2197},"), or a percentage of the\nauthorized ceiling (",{"type":48,"tag":63,"props":2199,"children":2201},{"className":2200},[],[2202],{"type":54,"value":2203},"\"50%\"",{"type":54,"value":2205},") — pick whichever the usage calculation produces naturally. ",{"type":48,"tag":63,"props":2207,"children":2209},{"className":2208},[],[2210],{"type":54,"value":485},{"type":54,"value":2212}," is\nEVM-only, so under ",{"type":48,"tag":63,"props":2214,"children":2216},{"className":2215},[],[2217],{"type":54,"value":2139},{"type":54,"value":2219}," it resolves to Base Sepolia alone.",{"type":48,"tag":902,"props":2221,"children":2222},{"id":23},[2223],{"type":54,"value":22},{"type":48,"tag":57,"props":2225,"children":2226},{},[2227,2229,2234],{"type":54,"value":2228},"There is no ",{"type":48,"tag":63,"props":2230,"children":2232},{"className":2231},[],[2233],{"type":54,"value":914},{"type":54,"value":2235}," in Python, so assemble the pieces by hand. It is two halves, and\nnaming them is what keeps the Python version from reading as long and arbitrary:",{"type":48,"tag":505,"props":2237,"children":2238},{},[2239,2251],{"type":48,"tag":88,"props":2240,"children":2241},{},[2242,2244,2250],{"type":54,"value":2243},"A CDP wallet to receive payments, resolved from ",{"type":48,"tag":63,"props":2245,"children":2247},{"className":2246},[],[2248],{"type":54,"value":2249},"cdp.evm.get_or_create_account(...).address",{"type":54,"value":136},{"type":48,"tag":88,"props":2252,"children":2253},{},[2254,2256,2262],{"type":54,"value":2255},"The x402 Foundation middleware, pointed at the CDP Facilitator with ",{"type":48,"tag":63,"props":2257,"children":2259},{"className":2258},[],[2260],{"type":54,"value":2261},"create_facilitator_config()",{"type":54,"value":136},{"type":48,"tag":641,"props":2264,"children":2267},{"className":2265,"code":2266,"language":23,"meta":646,"style":646},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from cdp.x402 import create_facilitator_config\nfrom fastapi import FastAPI\nfrom x402.http import HTTPFacilitatorClient, PaymentOption\nfrom x402.http.middleware.fastapi import PaymentMiddlewareASGI\nfrom x402.http.types import RouteConfig\nfrom x402.mechanisms.evm.exact import ExactEvmServerScheme\nfrom x402.server import x402ResourceServer\n\nPAY_TO = \"0x1234567890123456789012345678901234567890\"  # Your EVM address to get paid on Base Sepolia\nNETWORK = \"eip155:84532\"  # Base Sepolia\n\nserver = x402ResourceServer(HTTPFacilitatorClient(create_facilitator_config()))\nserver.register(NETWORK, ExactEvmServerScheme())\n\nroutes = {\n    \"GET \u002Freport\": RouteConfig(\n        accepts=[PaymentOption(scheme=\"exact\", pay_to=PAY_TO, price=\"$0.01\", network=NETWORK)],\n        mime_type=\"application\u002Fjson\",\n        description=\"AI-generated report\",\n    ),\n}\n\napp = FastAPI()\napp.add_middleware(PaymentMiddlewareASGI, routes=routes, server=server)\n",[2268],{"type":48,"tag":63,"props":2269,"children":2270},{"__ignoreMap":646},[2271,2279,2287,2295,2303,2311,2319,2327,2334,2342,2350,2357,2365,2373,2380,2388,2396,2404,2413,2422,2431,2440,2448,2457],{"type":48,"tag":652,"props":2272,"children":2273},{"class":654,"line":655},[2274],{"type":48,"tag":652,"props":2275,"children":2276},{},[2277],{"type":54,"value":2278},"from cdp.x402 import create_facilitator_config\n",{"type":48,"tag":652,"props":2280,"children":2281},{"class":654,"line":665},[2282],{"type":48,"tag":652,"props":2283,"children":2284},{},[2285],{"type":54,"value":2286},"from fastapi import FastAPI\n",{"type":48,"tag":652,"props":2288,"children":2289},{"class":654,"line":716},[2290],{"type":48,"tag":652,"props":2291,"children":2292},{},[2293],{"type":54,"value":2294},"from x402.http import HTTPFacilitatorClient, PaymentOption\n",{"type":48,"tag":652,"props":2296,"children":2297},{"class":654,"line":726},[2298],{"type":48,"tag":652,"props":2299,"children":2300},{},[2301],{"type":54,"value":2302},"from x402.http.middleware.fastapi import PaymentMiddlewareASGI\n",{"type":48,"tag":652,"props":2304,"children":2305},{"class":654,"line":735},[2306],{"type":48,"tag":652,"props":2307,"children":2308},{},[2309],{"type":54,"value":2310},"from x402.http.types import RouteConfig\n",{"type":48,"tag":652,"props":2312,"children":2313},{"class":654,"line":744},[2314],{"type":48,"tag":652,"props":2315,"children":2316},{},[2317],{"type":54,"value":2318},"from x402.mechanisms.evm.exact import ExactEvmServerScheme\n",{"type":48,"tag":652,"props":2320,"children":2321},{"class":654,"line":752},[2322],{"type":48,"tag":652,"props":2323,"children":2324},{},[2325],{"type":54,"value":2326},"from x402.server import x402ResourceServer\n",{"type":48,"tag":652,"props":2328,"children":2329},{"class":654,"line":761},[2330],{"type":48,"tag":652,"props":2331,"children":2332},{"emptyLinePlaceholder":720},[2333],{"type":54,"value":723},{"type":48,"tag":652,"props":2335,"children":2336},{"class":654,"line":813},[2337],{"type":48,"tag":652,"props":2338,"children":2339},{},[2340],{"type":54,"value":2341},"PAY_TO = \"0x1234567890123456789012345678901234567890\"  # Your EVM address to get paid on Base Sepolia\n",{"type":48,"tag":652,"props":2343,"children":2344},{"class":654,"line":1198},[2345],{"type":48,"tag":652,"props":2346,"children":2347},{},[2348],{"type":54,"value":2349},"NETWORK = \"eip155:84532\"  # Base Sepolia\n",{"type":48,"tag":652,"props":2351,"children":2352},{"class":654,"line":1277},[2353],{"type":48,"tag":652,"props":2354,"children":2355},{"emptyLinePlaceholder":720},[2356],{"type":54,"value":723},{"type":48,"tag":652,"props":2358,"children":2359},{"class":654,"line":1286},[2360],{"type":48,"tag":652,"props":2361,"children":2362},{},[2363],{"type":54,"value":2364},"server = x402ResourceServer(HTTPFacilitatorClient(create_facilitator_config()))\n",{"type":48,"tag":652,"props":2366,"children":2367},{"class":654,"line":1304},[2368],{"type":48,"tag":652,"props":2369,"children":2370},{},[2371],{"type":54,"value":2372},"server.register(NETWORK, ExactEvmServerScheme())\n",{"type":48,"tag":652,"props":2374,"children":2375},{"class":654,"line":1312},[2376],{"type":48,"tag":652,"props":2377,"children":2378},{"emptyLinePlaceholder":720},[2379],{"type":54,"value":723},{"type":48,"tag":652,"props":2381,"children":2382},{"class":654,"line":1348},[2383],{"type":48,"tag":652,"props":2384,"children":2385},{},[2386],{"type":54,"value":2387},"routes = {\n",{"type":48,"tag":652,"props":2389,"children":2390},{"class":654,"line":1472},[2391],{"type":48,"tag":652,"props":2392,"children":2393},{},[2394],{"type":54,"value":2395},"    \"GET \u002Freport\": RouteConfig(\n",{"type":48,"tag":652,"props":2397,"children":2398},{"class":654,"line":1480},[2399],{"type":48,"tag":652,"props":2400,"children":2401},{},[2402],{"type":54,"value":2403},"        accepts=[PaymentOption(scheme=\"exact\", pay_to=PAY_TO, price=\"$0.01\", network=NETWORK)],\n",{"type":48,"tag":652,"props":2405,"children":2407},{"class":654,"line":2406},18,[2408],{"type":48,"tag":652,"props":2409,"children":2410},{},[2411],{"type":54,"value":2412},"        mime_type=\"application\u002Fjson\",\n",{"type":48,"tag":652,"props":2414,"children":2416},{"class":654,"line":2415},19,[2417],{"type":48,"tag":652,"props":2418,"children":2419},{},[2420],{"type":54,"value":2421},"        description=\"AI-generated report\",\n",{"type":48,"tag":652,"props":2423,"children":2425},{"class":654,"line":2424},20,[2426],{"type":48,"tag":652,"props":2427,"children":2428},{},[2429],{"type":54,"value":2430},"    ),\n",{"type":48,"tag":652,"props":2432,"children":2434},{"class":654,"line":2433},21,[2435],{"type":48,"tag":652,"props":2436,"children":2437},{},[2438],{"type":54,"value":2439},"}\n",{"type":48,"tag":652,"props":2441,"children":2443},{"class":654,"line":2442},22,[2444],{"type":48,"tag":652,"props":2445,"children":2446},{"emptyLinePlaceholder":720},[2447],{"type":54,"value":723},{"type":48,"tag":652,"props":2449,"children":2451},{"class":654,"line":2450},23,[2452],{"type":48,"tag":652,"props":2453,"children":2454},{},[2455],{"type":54,"value":2456},"app = FastAPI()\n",{"type":48,"tag":652,"props":2458,"children":2460},{"class":654,"line":2459},24,[2461],{"type":48,"tag":652,"props":2462,"children":2463},{},[2464],{"type":54,"value":2465},"app.add_middleware(PaymentMiddlewareASGI, routes=routes, server=server)\n",{"type":48,"tag":57,"props":2467,"children":2468},{},[2469,2471,2477],{"type":54,"value":2470},"Run it with ",{"type":48,"tag":63,"props":2472,"children":2474},{"className":2473},[],[2475],{"type":54,"value":2476},"uvicorn.run(app, port=8402)",{"type":54,"value":136},{"type":48,"tag":57,"props":2479,"children":2480},{},[2481,2483,2489,2491,2497,2499,2505,2507,2513],{"type":54,"value":2482},"The sharpest edge is resolving ",{"type":48,"tag":63,"props":2484,"children":2486},{"className":2485},[],[2487],{"type":54,"value":2488},"PAY_TO",{"type":54,"value":2490},". ",{"type":48,"tag":63,"props":2492,"children":2494},{"className":2493},[],[2495],{"type":54,"value":2496},"CdpClient",{"type":54,"value":2498}," is an async context manager, but the route\nconfig above is module-level and synchronous, which is why the examples resolve the receiver once\nat import time with ",{"type":48,"tag":63,"props":2500,"children":2502},{"className":2501},[],[2503],{"type":54,"value":2504},"asyncio.run(resolve_pay_to())",{"type":54,"value":2506},". That works when the module is the entry point.\nUnder an ASGI server that imports it from inside a running event loop, it raises ",{"type":48,"tag":63,"props":2508,"children":2510},{"className":2509},[],[2511],{"type":54,"value":2512},"RuntimeError",{"type":54,"value":2514},", and\nthe user needs a lifespan hook instead.",{"type":48,"tag":57,"props":2516,"children":2517},{},[2518,2523,2525,2531,2533,2539,2541,2547,2548,2554,2556,2561,2563,2569],{"type":48,"tag":92,"props":2519,"children":2520},{},[2521],{"type":54,"value":2522},"Flask",{"type":54,"value":2524}," is the same code with three substitutions: ",{"type":48,"tag":63,"props":2526,"children":2528},{"className":2527},[],[2529],{"type":54,"value":2530},"x402ResourceServerSync",{"type":54,"value":2532}," and\n",{"type":48,"tag":63,"props":2534,"children":2536},{"className":2535},[],[2537],{"type":54,"value":2538},"HTTPFacilitatorClientSync",{"type":54,"value":2540}," in place of the async pair, and ",{"type":48,"tag":63,"props":2542,"children":2544},{"className":2543},[],[2545],{"type":54,"value":2546},"payment_middleware(app, routes=routes, server=server)",{"type":54,"value":1603},{"type":48,"tag":63,"props":2549,"children":2551},{"className":2550},[],[2552],{"type":54,"value":2553},"x402.http.middleware.flask",{"type":54,"value":2555},", which is a function that mutates the app rather\nthan a middleware class. Handing Flask the async ",{"type":48,"tag":63,"props":2557,"children":2559},{"className":2558},[],[2560],{"type":54,"value":345},{"type":54,"value":2562}," raises a ",{"type":48,"tag":63,"props":2564,"children":2566},{"className":2565},[],[2567],{"type":54,"value":2568},"TypeError",{"type":54,"value":136},{"type":48,"tag":57,"props":2571,"children":2572},{},[2573,2575,2581,2583,2589,2590,2596,2597,2603,2604,2610,2612,2617],{"type":54,"value":2574},"Two more gotchas: ",{"type":48,"tag":63,"props":2576,"children":2578},{"className":2577},[],[2579],{"type":54,"value":2580},"PaymentOption",{"type":54,"value":2582}," is a dataclass whose ",{"type":48,"tag":63,"props":2584,"children":2586},{"className":2585},[],[2587],{"type":54,"value":2588},"scheme",{"type":54,"value":288},{"type":48,"tag":63,"props":2591,"children":2593},{"className":2592},[],[2594],{"type":54,"value":2595},"pay_to",{"type":54,"value":288},{"type":48,"tag":63,"props":2598,"children":2600},{"className":2599},[],[2601],{"type":54,"value":2602},"price",{"type":54,"value":876},{"type":48,"tag":63,"props":2605,"children":2607},{"className":2606},[],[2608],{"type":54,"value":2609},"network",{"type":54,"value":2611},"\nhave no defaults, so a missing one is a ",{"type":48,"tag":63,"props":2613,"children":2615},{"className":2614},[],[2616],{"type":54,"value":2568},{"type":54,"value":2618}," at construction — which, with a module-level\nroute map, means the server refuses to import rather than failing a request later. And this path is\nEVM-only, with no Solana option.",{"type":48,"tag":542,"props":2620,"children":2622},{"id":2621},"_4-confirm-the-route-is-protected",[2623],{"type":54,"value":2624},"4. Confirm the route is protected",{"type":48,"tag":57,"props":2626,"children":2627},{},[2628],{"type":54,"value":2629},"Start the server, then from a second terminal:",{"type":48,"tag":641,"props":2631,"children":2633},{"className":643,"code":2632,"language":645,"meta":646,"style":646},"curl -i http:\u002F\u002Flocalhost:8402\u002Freport\n",[2634],{"type":48,"tag":63,"props":2635,"children":2636},{"__ignoreMap":646},[2637],{"type":48,"tag":652,"props":2638,"children":2639},{"class":654,"line":655},[2640,2645,2650],{"type":48,"tag":652,"props":2641,"children":2642},{"style":669},[2643],{"type":54,"value":2644},"curl",{"type":48,"tag":652,"props":2646,"children":2647},{"style":675},[2648],{"type":54,"value":2649}," -i",{"type":48,"tag":652,"props":2651,"children":2652},{"style":675},[2653],{"type":54,"value":2654}," http:\u002F\u002Flocalhost:8402\u002Freport\n",{"type":48,"tag":641,"props":2656,"children":2660},{"className":2657,"code":2658,"language":2659,"meta":646,"style":646},"language-console shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","HTTP\u002F1.1 402 Payment Required\nPAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MiwiZXJyb3IiOiJQYXltZW50IHJlcXVpcmVkIiwi...\n","console",[2661],{"type":48,"tag":63,"props":2662,"children":2663},{"__ignoreMap":646},[2664,2672],{"type":48,"tag":652,"props":2665,"children":2666},{"class":654,"line":655},[2667],{"type":48,"tag":652,"props":2668,"children":2669},{},[2670],{"type":54,"value":2671},"HTTP\u002F1.1 402 Payment Required\n",{"type":48,"tag":652,"props":2673,"children":2674},{"class":654,"line":665},[2675],{"type":48,"tag":652,"props":2676,"children":2677},{},[2678],{"type":54,"value":2679},"PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MiwiZXJyb3IiOiJQYXltZW50IHJlcXVpcmVkIiwi...\n",{"type":48,"tag":57,"props":2681,"children":2682},{},[2683],{"type":54,"value":2684},"This is the cheap checkpoint before any money moves, and it needs no buyer. Do not skip to step 5.",{"type":48,"tag":542,"props":2686,"children":2688},{"id":2687},"_5-take-a-real-payment",[2689],{"type":54,"value":2690},"5. Take a real payment",{"type":48,"tag":57,"props":2692,"children":2693},{},[2694],{"type":54,"value":2695},"Either testing path works:",{"type":48,"tag":84,"props":2697,"children":2698},{},[2699,2720],{"type":48,"tag":88,"props":2700,"children":2701},{},[2702,2704,2711,2713,2719],{"type":54,"value":2703},"Point the agentic-wallet\n",{"type":48,"tag":100,"props":2705,"children":2708},{"href":2706,"rel":2707},"https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fagentic-wallet\u002Fcli\u002Fskills\u002Fpay-for-service",[104],[2709],{"type":54,"value":2710},"pay-for-service",{"type":54,"value":2712}," skill\nat ",{"type":48,"tag":63,"props":2714,"children":2716},{"className":2715},[],[2717],{"type":54,"value":2718},"http:\u002F\u002Flocalhost:8402\u002Freport",{"type":54,"value":136},{"type":48,"tag":88,"props":2721,"children":2722},{},[2723,2725,2730],{"type":54,"value":2724},"Build a buyer with the ",{"type":48,"tag":63,"props":2726,"children":2728},{"className":2727},[],[2729],{"type":54,"value":152},{"type":54,"value":2731}," skill and point it at the same URL.",{"type":48,"tag":57,"props":2733,"children":2734},{},[2735,2737,2743],{"type":54,"value":2736},"Success is ",{"type":48,"tag":63,"props":2738,"children":2740},{"className":2739},[],[2741],{"type":54,"value":2742},"HTTP 200",{"type":54,"value":2744}," on the buyer side. The buyer wallet needs testnet USDC first, which is step 4\nof the client skill — link it rather than re-teaching funding here.",{"type":48,"tag":77,"props":2746,"children":2748},{"id":2747},"troubleshooting",[2749],{"type":54,"value":2750},"Troubleshooting",{"type":48,"tag":186,"props":2752,"children":2753},{},[2754,2775],{"type":48,"tag":190,"props":2755,"children":2756},{},[2757],{"type":48,"tag":194,"props":2758,"children":2759},{},[2760,2765,2770],{"type":48,"tag":198,"props":2761,"children":2762},{},[2763],{"type":54,"value":2764},"Symptom",{"type":48,"tag":198,"props":2766,"children":2767},{},[2768],{"type":54,"value":2769},"Cause",{"type":48,"tag":198,"props":2771,"children":2772},{},[2773],{"type":54,"value":2774},"Fix",{"type":48,"tag":219,"props":2776,"children":2777},{},[2778,2811,2843,2866,2896],{"type":48,"tag":194,"props":2779,"children":2780},{},[2781,2794,2799],{"type":48,"tag":226,"props":2782,"children":2783},{},[2784,2786,2792],{"type":54,"value":2785},"Route returns ",{"type":48,"tag":63,"props":2787,"children":2789},{"className":2788},[],[2790],{"type":54,"value":2791},"200",{"type":54,"value":2793}," with no payment",{"type":48,"tag":226,"props":2795,"children":2796},{},[2797],{"type":54,"value":2798},"Route key does not match the real method and path, or middleware was registered after the handler",{"type":48,"tag":226,"props":2800,"children":2801},{},[2802,2804,2809],{"type":54,"value":2803},"Compare the key to the handler; move ",{"type":48,"tag":63,"props":2805,"children":2807},{"className":2806},[],[2808],{"type":54,"value":930},{"type":54,"value":2810}," above it",{"type":48,"tag":194,"props":2812,"children":2813},{},[2814,2833,2838],{"type":48,"tag":226,"props":2815,"children":2816},{},[2817,2823,2825,2831],{"type":48,"tag":63,"props":2818,"children":2820},{"className":2819},[],[2821],{"type":54,"value":2822},"402",{"type":54,"value":2824}," with no ",{"type":48,"tag":63,"props":2826,"children":2828},{"className":2827},[],[2829],{"type":54,"value":2830},"PAYMENT-REQUIRED",{"type":54,"value":2832}," header",{"type":48,"tag":226,"props":2834,"children":2835},{},[2836],{"type":54,"value":2837},"The middleware was never reached",{"type":48,"tag":226,"props":2839,"children":2840},{},[2841],{"type":54,"value":2842},"Check registration order and the mount path",{"type":48,"tag":194,"props":2844,"children":2845},{},[2846,2851,2856],{"type":48,"tag":226,"props":2847,"children":2848},{},[2849],{"type":54,"value":2850},"Verification passes, settlement fails",{"type":48,"tag":226,"props":2852,"children":2853},{},[2854],{"type":54,"value":2855},"Buyer and server are on different chains",{"type":48,"tag":226,"props":2857,"children":2858},{},[2859,2861],{"type":54,"value":2860},"Match the buyer's network to the one in the ",{"type":48,"tag":63,"props":2862,"children":2864},{"className":2863},[],[2865],{"type":54,"value":2822},{"type":48,"tag":194,"props":2867,"children":2868},{},[2869,2874,2885],{"type":48,"tag":226,"props":2870,"children":2871},{},[2872],{"type":54,"value":2873},"Auth error at startup",{"type":48,"tag":226,"props":2875,"children":2876},{},[2877,2883],{"type":48,"tag":63,"props":2878,"children":2880},{"className":2879},[],[2881],{"type":54,"value":2882},"CDP_API_KEY_*",{"type":54,"value":2884}," not visible to the process",{"type":48,"tag":226,"props":2886,"children":2887},{},[2888,2890],{"type":54,"value":2889},"Check how the process loads its environment, not just ",{"type":48,"tag":63,"props":2891,"children":2893},{"className":2892},[],[2894],{"type":54,"value":2895},".env",{"type":48,"tag":194,"props":2897,"children":2898},{},[2899,2904,2916],{"type":48,"tag":226,"props":2900,"children":2901},{},[2902],{"type":54,"value":2903},"Payments land somewhere unknown",{"type":48,"tag":226,"props":2905,"children":2906},{},[2907,2909,2914],{"type":54,"value":2908},"A CDP wallet was provisioned and the printed ",{"type":48,"tag":63,"props":2910,"children":2912},{"className":2911},[],[2913],{"type":54,"value":414},{"type":54,"value":2915}," was never recorded",{"type":48,"tag":226,"props":2917,"children":2918},{},[2919,2921,2927],{"type":54,"value":2920},"Read it back from ",{"type":48,"tag":63,"props":2922,"children":2924},{"className":2923},[],[2925],{"type":54,"value":2926},"server.payToEvmAddress",{"type":54,"value":2928}," and save it",{"type":48,"tag":77,"props":2930,"children":2932},{"id":2931},"runnable-examples",[2933],{"type":54,"value":2934},"Runnable examples",{"type":48,"tag":57,"props":2936,"children":2937},{},[2938,2940,2946,2948,2954,2956,2962,2963,2969,2970,2976,2977,2983,2984,2990],{"type":54,"value":2939},"TypeScript, under ",{"type":48,"tag":63,"props":2941,"children":2943},{"className":2942},[],[2944],{"type":54,"value":2945},"https:\u002F\u002Fgithub.com\u002Fcoinbase\u002Fcdp-sdk\u002Fblob\u002Fmain\u002Fexamples\u002Ftypescript\u002Fx402\u002Fservers\u002F",{"type":54,"value":2947},":\n",{"type":48,"tag":63,"props":2949,"children":2951},{"className":2950},[],[2952],{"type":54,"value":2953},"express\u002Fserver.ts",{"type":54,"value":2955}," (all three approaches), ",{"type":48,"tag":63,"props":2957,"children":2959},{"className":2958},[],[2960],{"type":54,"value":2961},"express\u002Fx402.config.json",{"type":54,"value":2532},{"type":48,"tag":63,"props":2964,"children":2966},{"className":2965},[],[2967],{"type":54,"value":2968},"express\u002Fx402.config.schema.json",{"type":54,"value":288},{"type":48,"tag":63,"props":2971,"children":2973},{"className":2972},[],[2974],{"type":54,"value":2975},"hono\u002Fserver.ts",{"type":54,"value":288},{"type":48,"tag":63,"props":2978,"children":2980},{"className":2979},[],[2981],{"type":54,"value":2982},"next\u002Fapp\u002Fapi\u002Freport\u002Froute.ts",{"type":54,"value":1917},{"type":48,"tag":63,"props":2985,"children":2987},{"className":2986},[],[2988],{"type":54,"value":2989},"mcp\u002Fserver.ts",{"type":54,"value":136},{"type":48,"tag":57,"props":2992,"children":2993},{},[2994,2996,3002,3003,3009,3010,3016,3017,3023,3024,3030],{"type":54,"value":2995},"Python, under ",{"type":48,"tag":63,"props":2997,"children":2999},{"className":2998},[],[3000],{"type":54,"value":3001},"https:\u002F\u002Fgithub.com\u002Fcoinbase\u002Fcdp-sdk\u002Fblob\u002Fmain\u002Fexamples\u002Fpython\u002Fx402\u002Fservers\u002F",{"type":54,"value":2947},{"type":48,"tag":63,"props":3004,"children":3006},{"className":3005},[],[3007],{"type":54,"value":3008},"fastapi\u002Fserver.py",{"type":54,"value":288},{"type":48,"tag":63,"props":3011,"children":3013},{"className":3012},[],[3014],{"type":54,"value":3015},"flask\u002Fserver.py",{"type":54,"value":288},{"type":48,"tag":63,"props":3018,"children":3020},{"className":3019},[],[3021],{"type":54,"value":3022},"bazaar.py",{"type":54,"value":288},{"type":48,"tag":63,"props":3025,"children":3027},{"className":3026},[],[3028],{"type":54,"value":3029},"mcp\u002Fserver.py",{"type":54,"value":136},{"type":48,"tag":77,"props":3032,"children":3034},{"id":3033},"after-the-first-payment",[3035],{"type":54,"value":3036},"After the first payment",{"type":48,"tag":84,"props":3038,"children":3039},{},[3040,3068,3080,3092,3102],{"type":48,"tag":88,"props":3041,"children":3042},{},[3043,3045,3052,3054,3059,3061,3066],{"type":54,"value":3044},"Make the endpoint findable: ",{"type":48,"tag":100,"props":3046,"children":3049},{"href":3047,"rel":3048},"https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Fget-discovered",[104],[3050],{"type":54,"value":3051},"Get discovered",{"type":54,"value":3053},". TypeScript's ",{"type":48,"tag":63,"props":3055,"children":3057},{"className":3056},[],[3058],{"type":54,"value":914},{"type":54,"value":3060}," handles it automatically; Python needs manual metadata like ",{"type":48,"tag":63,"props":3062,"children":3064},{"className":3063},[],[3065],{"type":54,"value":3022},{"type":54,"value":3067}," above",{"type":48,"tag":88,"props":3069,"children":3070},{},[3071,3073],{"type":54,"value":3072},"What settled the payment: ",{"type":48,"tag":100,"props":3074,"children":3077},{"href":3075,"rel":3076},"https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Ffacilitator",[104],[3078],{"type":54,"value":3079},"CDP Facilitator",{"type":48,"tag":88,"props":3081,"children":3082},{},[3083,3085],{"type":54,"value":3084},"Other networks, schemes, receivers, lifecycle hooks: ",{"type":48,"tag":100,"props":3086,"children":3089},{"href":3087,"rel":3088},"https:\u002F\u002Fdocs.cdp.coinbase.com\u002Fx402\u002Fseller\u002Fproduction-configuration",[104],[3090],{"type":54,"value":3091},"Production configuration",{"type":48,"tag":88,"props":3093,"children":3094},{},[3095,3097],{"type":54,"value":3096},"Charging for MCP tools: ",{"type":48,"tag":100,"props":3098,"children":3100},{"href":130,"rel":3099},[104],[3101],{"type":54,"value":134},{"type":48,"tag":88,"props":3103,"children":3104},{},[3105,3107,3112],{"type":54,"value":3106},"Mainnet: drop ",{"type":48,"tag":63,"props":3108,"children":3110},{"className":3109},[],[3111],{"type":54,"value":442},{"type":54,"value":3113}," and confirm with the user first",{"type":48,"tag":3115,"props":3116,"children":3117},"style",{},[3118],{"type":54,"value":3119},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":3121,"total":716},[3122,3133,3141],{"slug":152,"name":152,"fn":3123,"description":3124,"org":3125,"tags":3126,"stars":27,"repoUrl":28,"updatedAt":3132},"implement x402 payment client for HTTP APIs","Write code that pays for an HTTP API returning 402 Payment Required, using the x402 protocol and\na CDP-managed wallet. Covers TypeScript and Python. Use when the user wants to call a paid\nendpoint from their own application or agent, add x402 payments to an HTTP client, hit an API\nthat charges per request, migrate an existing x402 client off a raw private key, or is stuck on\nan unexpected 402 response.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3127,3128,3129,3130,3131],{"name":25,"slug":26,"type":15},{"name":19,"slug":20,"type":15},{"name":22,"slug":23,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":17,"type":15},"2026-08-06T06:09:11.226639",{"slug":4,"name":4,"fn":5,"description":6,"org":3134,"tags":3135,"stars":27,"repoUrl":28,"updatedAt":29},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3136,3137,3138,3139,3140],{"name":25,"slug":26,"type":15},{"name":19,"slug":20,"type":15},{"name":22,"slug":23,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":17,"type":15},{"slug":3142,"name":3142,"fn":3143,"description":3144,"org":3145,"tags":3146,"stars":3161,"repoUrl":3162,"updatedAt":3163},"agentic-wallet","perform crypto wallet operations and payments","Crypto wallet operations via the awal CLI — sign in, check balances, send USDC\u002FETH\u002FPOL\u002FSOL, trade tokens, fund the wallet, and use the x402 payment protocol to discover paid services, pay for API calls, monetize an API, or query onchain data. Use whenever the user mentions signing in, login, authentication, wallet status, balance, address, sending money, paying someone, transferring tokens, ENS names, swapping\u002Ftrading\u002Fconverting tokens, funding\u002Ftopping up\u002Fonramp, USDC, ETH, POL, SOL, the x402 bazaar, paid APIs, monetizing an endpoint, or querying onchain data on Base.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3147,3150,3153,3156,3157,3160],{"name":3148,"slug":3149,"type":15},"Automation","automation",{"name":3151,"slug":3152,"type":15},"CLI","cli",{"name":3154,"slug":3155,"type":15},"Ethereum","ethereum",{"name":19,"slug":20,"type":15},{"name":3158,"slug":3159,"type":15},"Web3","web3",{"name":17,"slug":17,"type":15},121,"https:\u002F\u002Fgithub.com\u002Fcoinbase\u002Fagentic-wallet-skills","2026-08-06T05:39:18.524241",{"items":3165,"total":665},[3166,3174],{"slug":152,"name":152,"fn":3123,"description":3124,"org":3167,"tags":3168,"stars":27,"repoUrl":28,"updatedAt":3132},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3169,3170,3171,3172,3173],{"name":25,"slug":26,"type":15},{"name":19,"slug":20,"type":15},{"name":22,"slug":23,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":17,"type":15},{"slug":4,"name":4,"fn":5,"description":6,"org":3175,"tags":3176,"stars":27,"repoUrl":28,"updatedAt":29},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3177,3178,3179,3180,3181],{"name":25,"slug":26,"type":15},{"name":19,"slug":20,"type":15},{"name":22,"slug":23,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":17,"type":15}]