402 with the price and payment requirements, the buyer authorizes payment, and your server uses a facilitator to verify and settle it before delivering the resource.
PayAI lets you start accepting ordinary exact payments on Mainnet without creating a portal account or obtaining an API key. You supply a receiving wallet and the route you want to charge for. The free allowance gets the integration started; an agent can later buy credits and a key programmatically, without sending a human through signup.
Choose the shortest path to a working payment
For a first integration, choose one network, one asset and one route. The Mainnet Express example uses Solana USDC and charges
0.001 USDC per request. To charge one cent, use 0.01 USDC (10000 atomic units for USDC) and update the buyer’s explicit cap to match. Do not raise a buyer’s limit silently.
What you need—and what you do not
- A receiving wallet address. Keep its private key out of the API server unless a specific feature requires signing.
- The framework integration for your service, and a price for each paid operation.
- A disposable, funded buyer wallet to verify the complete flow. A
402response alone does not prove a payment settled. - On Solana, the merchant’s USDC associated token account (ATA) must exist. Creating it requires a setup fee payer with SOL. PayAI sponsors settlement gas; account setup and later recovery transfers are separate operations.
/supported response. Testnets are free.
Add payments without rebuilding your application
- Choose a bounded operation: a report, lookup, inference request or premium API response.
- Apply x402 middleware to that route. Leave health checks and public documentation free.
- Configure the receiving address, network, asset and price. Connect the standard x402 facilitator client to PayAI using the
@payai/facilitatorpackage, or the equivalent configuration in your language. - Keep existing API keys and subscriptions for existing customers. Offer x402 as another access path; do not remove authorization from private data or user-specific operations.
- Deploy the service over HTTPS and run the paid-path checks below.
Prove the paid path, not just the implementation
The runnable Mainnet example includes a guarded smoke buyer and reconciliation command. Before calling an integration complete, retain evidence of:- An unpaid request returning
402with the expected recipient, asset, network and price. - A buyer authorization within an explicit spending cap.
- A successful paid HTTP response and the matching finalized on-chain settlement with exact balance changes.
- Recovery of disposable test funds, where you control both wallets. Recovery has its own network fee; a merchant refund is not automatic.

