> ## 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.

# x402

> GatePay integrates the x402 open payment protocol so clients can complete on-chain payments automatically through standard HTTP flows.

## 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

| Role            | Description                                                                                 |
| --------------- | ------------------------------------------------------------------------------------------- |
| 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 |
| Facilitator     | GatePay 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.

<Card icon="https://mintcdn.com/gateglobalcorp/-BUf7BZGLTCh5iYe/icon/github.svg?fit=max&auto=format&n=-BUf7BZGLTCh5iYe&q=85&s=846d0112b821219571bdcbee940d2d07" title="Gate GitHub Organization" href="https://github.com/gate" width="64" height="64" data-path="icon/github.svg" />

## 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.

```bash theme={null}
npx -y @gatepay/x402-mcp
```

<Card icon="https://mintcdn.com/gateglobalcorp/-BUf7BZGLTCh5iYe/icon/github.svg?fit=max&auto=format&n=-BUf7BZGLTCh5iYe&q=85&s=846d0112b821219571bdcbee940d2d07" title="Local MCP implementation" href="https://github.com/gate/gatepay-local-mcp" width="64" height="64" data-path="icon/github.svg" />

## 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:

```text theme={null}
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

| Network      | Token |
| ------------ | ----- |
| Ethereum     | USDC  |
| Base         | USDC  |
| Arbitrum One | USDC  |
| Polygon      | USDC  |

## Related guides

* [Payment](/essentials/version/100/en/inflow/payment/payment)
* [Authentication](/essentials/version/100/en/common/authentication)
* [Notification](/essentials/version/100/en/common/notification)
* [API Reference](/api-reference/version/100/en/introduction)
