Install the x402 V2 SDK and configure a preference profile specifying preferred stablecoin assets (e.g. USDC), acceptable chains ordered by priority (e.g. Base first for low fees, then Solana), and any required facilitator allowlist or blocklist
When the agent encounters a 402 response, pass the X-Accept-Payment header content to the SDK's route method; the SDK parses the available payment options advertised by the server
The SDK cross-references the server's accepted chains/assets against the agent's preference profile and wallet balances, scoring each option by fee estimate and preference rank
The SDK returns the selected payment route; the agent confirms and the SDK constructs the signed payment payload for the chosen chain and asset
Use the SDK's discovery extension to prefetch payment metadata from frequently used services so the chain selection decision is cached and does not add latency to the critical payment path
Known gotchas
Fee estimates from the SDK are point-in-time; on congested chains, actual gas costs may exceed the estimate between route selection and transaction broadcast — build a fee tolerance parameter into your preference profile to avoid failed transactions
The discovery extension crawls service metadata on a schedule, not in real time; if a service updates its accepted chains, the cached metadata may be stale for up to the TTL period — force a cache refresh for payment-critical services at agent startup
Multiple facilitators may advertise the same chain/asset combination with different fee structures; the SDK picks based on its scoring algorithm, which may not always minimize cost — review facilitator fee schedules manually for high-volume workloads
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp