Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.gate.com/llms.txt

Use this file to discover all available pages before exploring further.

Overview

x402 is an open payment standard built around the HTTP 402 Payment Required status code. When a client requests a paid resource, the server returns a 402 response with payment requirements. The client signs and completes the on-chain payment automatically, keeping the flow transparent to the end user.

Why x402?

  • Native micropayments for usage-based APIs
  • Programmatic payments without traditional account registration
  • Low-friction settlement through on-chain signatures
  • HTTP-native integration that works with standard web services

Core roles

RoleDescription
Client (Buyer)Client or developer that requests a paid resource and signs the payment
Server (Seller)Merchant server that declares payment requirements and serves the resource after validation
FacilitatorGatePay service that verifies payment payloads and finalizes settlement

Merchant integration

Merchants can integrate through the SDK and client repositories published under the official Gate GitHub organization, while declaring x402 payment requirements at the route layer. The currently public resources include Go, Java, Python, Node.js / TypeScript, and PHP repositories. Use the organization page as the latest source of truth.
https://mintcdn.com/gateglobalcorp/-BUf7BZGLTCh5iYe/icon/github.svg?fit=max&auto=format&n=-BUf7BZGLTCh5iYe&q=85&s=846d0112b821219571bdcbee940d2d07

Gate GitHub Organization

Client integration

For MCP-compatible clients, install and configure the x402 MCP package with the following command. Follow the MCP configuration format required by your client.
npx -y @gatepay/x402-mcp
https://mintcdn.com/gateglobalcorp/-BUf7BZGLTCh5iYe/icon/github.svg?fit=max&auto=format&n=-BUf7BZGLTCh5iYe&q=85&s=846d0112b821219571bdcbee940d2d07

Local MCP implementation

Payment flow

  1. The client calls the merchant API.
  2. The merchant returns 402 Payment Required with payment requirements in headers.
  3. The client signs a payment payload based on the selected chain and token.
  4. The client retries the request with the PAYMENT-SIGNATURE header.
  5. The merchant sends the payload to the GatePay Facilitator for validation.
  6. After validation, the merchant serves the resource and the Facilitator submits settlement on-chain.
  7. The merchant returns 200 OK and a PAYMENT-RESPONSE header.

Minimum integration path

If you are integrating x402 for the first time, begin with one protected resource and validate the following path:
Declare one paid HTTP route -> Return 402 payment requirements -> Let the client sign and retry -> Validate through GatePay -> Return the resource
Once the single-route flow is stable, you can expand to multiple resources, tiered pricing, and more advanced AI agent payment scenarios with less coordination overhead.

GatePay Facilitator

GatePay acts as the x402 Facilitator and provides:
  • Payment verification
  • On-chain settlement submission and confirmation tracking
  • Sponsored gas for supported payment flows

Supported networks and token

NetworkToken
EthereumUSDC
BaseUSDC
Arbitrum OneUSDC
PolygonUSDC