Public networks

NEAR testnet

USDC on NEAR testnet through a NEP-366 delegate action that the facilitator's relayer submits.

x402 exact on NEAR testnet (near:testnet). The buyer signs one USDC ft_transfer in a NEP-366 delegate. The facilitator's relayer wraps it in a transaction and pays gas; the payment flow needs no gateway or merchant key. Omitting the asset fields selects the built-in testnet USDC profile.

Partial supportNEAR payments have settled on a local sandbox, testnet and mainnet, all through the SDK facilitator run by the test suite. None has run through a hosted facilitator.

The gateway loads NEAR support only when a NEAR offer is configured:

bash
npm install @x402/[email protected]
examples/near-testnet/config.yamlyaml
version: 1

merchant:
  id: near-testnet-example
  name: NEAR Testnet Example
  publicBaseUrl: ${GATEWAY_PUBLIC_BASE_URL:-http://localhost:8080}

server:
  port: ${GATEWAY_PORT:-8080}
  host: 0.0.0.0
  # Operator routes (receipts, events) 404 without this. Uncomment and set it
  # before exposing the gateway anywhere.
  # adminToken: ${ADMIN_TOKEN}

storage:
  receipts:
    driver: sqlite
    path: ${RECEIPT_STORE_PATH:-./data/receipts.sqlite}

protocols:
  http:
    enabled: true
  mcp:
    enabled: true
    mountPath: /mcp

resources:
  premium_report:
    name: Premium Report
    description: One paid endpoint, settled in USDC on NEAR testnet.
    input:
      type: object
      properties: {}
      additionalProperties: false
    backend:
      type: http
      method: GET
      url: ${MERCHANT_API_BASE_URL:-http://localhost:3000}/api/report
      timeoutMs: 10000
    pricing:
      type: fixed
      amount: "0.01"
      currency: USDC
    expose: [http, mcp]
    payments: [x402]

payments:
  x402:
    enabled: true
    network: near:testnet
    # No asset fields: the testnet USDC token account, from the built-in profile.
    # This account must hold a storage deposit with that token (NEP-145).
    payTo: ${NEAR_MERCHANT_ACCOUNT}
    networks:
      # Only for health checks: chain id, token code and decimals, storage
      near:testnet:
        rpcUrl: ${X402_RPC_URL:-https://rpc.testnet.fastnear.com}
    maxTimeoutSeconds: 300
    facilitator:
      mode: remote
      url: ${X402_FACILITATOR_URL}
      auth:
        type: none

What you need

A merchant accountNEAR_MERCHANT_ACCOUNT, with a storage deposit on the USDC token (NEP-145 storage_deposit); Circle's faucet makes one when it sends USDC. Health fails without one.
A funded buyertestnet USDC from faucet.circle.com (Near Testnet) and a full-access key: the SDK facilitator refuses a delegate signed with a function-call key.
A NEAR facilitatorX402_FACILITATOR_URL, one that serves near:testnet; it has no default. FastNEAR's hosted facilitator requires an API key: send it with auth.type: bearer.

A facilitator for NEAR runs the SDK's ExactNearScheme from @x402/near/exact/facilitator with a relayer account that holds testnet NEAR for gas. Running a production facilitator is outside this project; the smoke suite below runs one for the length of a test.

bash
NEAR_MERCHANT_ACCOUNT=merchant.testnet X402_FACILITATOR_URL=https://your-facilitator \
  npm run agent-commerce -- validate --config examples/near-testnet/config.yaml

Prove it settles

bash
X402_SMOKE_TARGETS=near-testnet \
X402_NEAR_TESTNET_BUYER_ACCOUNT=buyer.testnet \
X402_NEAR_TESTNET_BUYER_PRIVATE_KEY=ed25519:... \
X402_NEAR_TESTNET_MERCHANT_ACCOUNT=merchant.testnet \
X402_NEAR_TESTNET_RELAYER_ACCOUNT=relayer.testnet \
X402_NEAR_TESTNET_RELAYER_PRIVATE_KEY=ed25519:... \
  npm run test:testnet

Without X402_NEAR_TESTNET_FACILITATOR_URL, the run starts the SDK's facilitator on 127.0.0.1 with that relayer. It then reads the buyer's ft_transfer and the token's successful receipt from the final transaction; see smoke tests.

It has been run: 5tdtGLv4TB… settled 0.01 USDC on 2026-10-10.

Source: examples/near-testnet