Skip to main content
For x402 routes, the gateway behaves like a standard x402 resource server. Any x402-compatible client library works against those routes. This page shows the most common integration path: TypeScript/Node, using the official @x402 packages.

Install

Load a Solana wallet

The wallet is used to sign both x402 exact payments and SIWX messages. It must be a funded Solana mainnet wallet (USDC + a small SOL balance for transaction fees) and must not equal the gateway’s payTo wallet.

Wrap fetch with x402

@x402/fetch transparently handles the 402 challenge/retry cycle, including exact payment and SIWX signing.
gatewayFetch is now a drop-in replacement for fetch against any gateway route.

Call a paid RPC route

The first call inside gatewayFetch will:
  1. Hit the gateway and receive 402 Payment Required.
  2. Build an SVM exact transfer for the price advertised in the challenge.
  3. Retry with PAYMENT-SIGNATURE.
  4. Return the upstream response to your code.
You do not need to parse the challenge envelope yourself.

Call a Tokens API (SIWX) route

No USDC is transferred. Under the hood gatewayFetch constructed a SIWX payload, signed it with your wallet, and sent it in the SIGN-IN-WITH-X header.

Discover routes dynamically

For agent-style clients that need to enumerate available routes:
Each entry’s inputSchema, outputSchema, and (for templated paths) pathParamsSchema are valid JSON Schema documents. You can feed them to any validator.

Common integration patterns

Pay-per-call worker

Best fit: background jobs that need Solana data but are cost-sensitive.

SIWX-only Tokens client

Best fit: dashboards and explorers that want Tokens API data without shipping an API key.

Agent wallet

Best fit: autonomous agents that reason about which route to call and should pay directly.
  • Fetch GET /v1/catalog at startup.
  • Pass the route descriptors into the agent’s tool schema.
  • Use gatewayFetch to invoke selected routes.
  • For packaged skills, CLI, MCP servers, and LLM-readable docs, see Agentic tools.
Because x402 paid routes advertise priceUsd, channel routes advertise priceTokenAmount, and SIWX routes advertise accessMode: "siwx", agents can budget and choose between paid and unpaid calls deterministically.

Error handling

See Payment headers reference for the full list of headers and error shapes. In brief:
  • 400 - invalid input (guardrails violated, malformed body or query params). No settlement.
  • 402 - payment or SIWX challenge. Your x402 client library retries automatically.
  • 429 - rate limited. Back off; retryAfterMs is included in the body.
  • 5xx - upstream or facilitator failure. No settlement on failed paid requests.

Base URL

The hosted gateway is at https://gateway.Ryvo.network.

See also