← Back to all guides
Guide

How to actually pay an x402 request: a setup guide

9 min read · Updated June 2026

Understanding x402 conceptually is one thing. Actually sending a payment is another. This walks through what you need before you can pay your first x402-gated request, whether you're doing it manually to test something or setting up an AI agent to do it autonomously.

What you need before you start

If you're testing manually: start with a service you already know supports x402, ideally one with clear documentation about exactly what it expects, rather than guessing at a random API.

Paying manually, step by step

1. Make the initial request

Send a normal request to the endpoint, the same way you'd call any API. You'll get back a 402 response rather than the content.

2. Read the payment terms

The 402 response includes the price, the accepted token, the network, and the address to pay. Confirm these match what you expect — particularly the network, since paying on the wrong chain sends funds nowhere useful.

3. Sign the payment

Using your wallet or a client library that implements the x402 client side, sign a payment matching those exact terms. Most implementations handle this with a software library rather than you manually constructing a transaction.

4. Retry the request with payment attached

Resend the same request, this time with the signed payment included in the appropriate header. The resource server (or its facilitator) verifies it and, if valid, returns the actual content with a 200 OK.

Setting this up for an AI agent

For an agent to do this autonomously, it needs three things: a wallet it can sign with programmatically (not a browser extension waiting for a human click), enough USDC funded to cover its expected usage, and client-side x402 support built into whatever framework or library it's running on. Several agent frameworks have added x402 client support as a built-in capability, meaning you configure a wallet once and the framework handles the 402-detect-and-pay loop automatically on every request that needs it.

The practical risk to manage here isn't the protocol — it's giving an autonomous agent unsupervised spending power. Reasonable safeguards include funding the agent's wallet with only what you're comfortable losing, setting a maximum price the agent will pay per request without escalating to a human, and monitoring the wallet's transaction history rather than assuming it's behaving as expected.

Common first-time mistakes


This is general technical guidance, not financial advice. Always verify current integration details with the specific wallet, library, or facilitator you're using before sending real funds.