Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.payai.network/llms.txt

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

Why use x402 with your client

x402 standardizes how clients discover payment requirements, construct payment payloads, and complete on-chain payments for HTTP resources. Benefits include: โœ… Customers donโ€™t pay network fees.
โœ… Payment settles in < 1 second.
โœ… Universal compatibility โ€” if it speaks HTTP, it speaks x402.

Architecture at a glance

x402 sequence diagram
  • Client (buyer): Calls protected resources and constructs payment payloads.
  • Server: Advertises payment requirements, verifies/settles payments, fulfills requests.
  • Facilitator: Verifies and/or settles payments for the resource server.
  • Blockchains: Execute and confirm payments.

Itโ€™s that easy

Make x402 payments with just a few lines:
import { wrapFetchWithPayment } from "x402-fetch";

const fetchWithPayment = wrapFetchWithPayment(fetch, account);

const response = await fetchWithPayment("https://api.example.com/premium");

Getting started

Select one of the quickstart examples, or read the reference for more details.

Axios

Quickstart for building an x402 client with Axios.

Fetch

Quickstart for building an x402 client with Fetch.

x402 reference

For a deeper dive into message shapes, headers, verification and settlement responses, see the x402 Reference.

Need help?

Join our Community

Have questions or want to connect with other developers? Join our Discord server.