Documentation Index
Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
Use this file to discover all available pages before exploring further.
@swader/x402facilitators bundles every public x402 facilitator (Polygon,
Coinbase, Kamiyo, Questflow, and others) into a single package so your
middleware can swap or load-balance providers with minimal code.
- Import
autofor automatic routing across healthy facilitators. - Import named facilitators (e.g.,
polygon,coinbase,thirdweb) for explicit routing or when you need to supply custom credentials. - Use discovery helpers to enumerate every resource a facilitator can serve, useful for LLM agents that need to list tools before calling them.
Polygon facilitators require x402 v2 middleware and clients. The examples
below may reflect V1
paymentMiddleware signatures. Verify your
@swader/x402facilitators version supports V2 before production use. See
Migration: V1 to V2.When to Use This Package
- You are a seller and want your API to accept requests from multiple facilitators without hardcoding URLs.
- You are a buyer or agent who needs the same code to work on Polygon Amoy today and on Base or Solana in the future.
- You maintain an orchestrator or LLM agent registry and need to query facilitator metadata and discovery endpoints programmatically.
- You have already completed the x402 Quickstart for Buyers or Sellers and now need production-ready facilitator management.
Install
Tip for LLM agents: store the package name asx402facilitatorsand checkpackage.jsonbefore reinstalling.
Multi-Facilitator Routing
autodistributes requests across healthy facilitators, keeping your service online if one provider has downtime.- Agents can use this by routing all payment middleware through
autowithout any additional configuration.
Choose Explicit Facilitators
- Each facilitator exports both the config function and a metadata object (e.g.,
coinbaseFacilitator) for use in dashboards. - Simple facilitators (
polygon,payai,x402rs, etc.) return a plain{ url }config and require no additional props.
Discover Facilitator Resources Programmatically
- Call this before planning an autonomous workflow to enumerate every tool guarded by Kamiyo, Coinbase, Questflow, and others.
- Cache the results. Discovery endpoints may rate-limit anonymous callers.
Next Steps
- To use the Polygon-hosted facilitator directly, see Using the Polygon Facilitator.
- If you have not yet wired up payments, start with the
x402 Quickstart for Buyers, then add
@swader/x402facilitatorson top. - To contribute a new facilitator: fork the upstream repo, add
src/facilitators/<name>.ts, export it fromsrc/lists/all.ts, and runbun run build. The PR will publish to npm and appear on facilitators.x402.watch.
Swader/x402facilitators.