Universal Checkout
Enable any AI agent to make x402 purchases through one-time purchase tokens
Universal Checkout
AgnicPay's Universal Checkout lets any AI agent — not just those using the MCP server — make x402 purchases. It works with ChatGPT, Gemini, Claude, LangChain agents, or any system that can send an HTTP header.
How It Works
- AI generates a link to the
/buypage with the merchant URL and network - User opens the link, authenticates with AgnicPay, and approves the payment amount
- User copies the one-time token (
agnic_ot_...) back to the AI - AI calls
/api/x402/fetchwith the token as theX-Agnic-Tokenheader - AgnicPay handles payment signing, KYA credential attachment, and transaction logging — same as always
The /buy Page
The buy page is hosted at pay.agnic.ai/buy and accepts these URL parameters:
| Parameter | Required | Description |
|---|---|---|
merchant | Yes | The merchant API endpoint (e.g., wine-merchant-test.fly.dev/api/wine/purchase) |
network | No | Blockchain network. Default: base. Options: base, base-sepolia, solana, solana-devnet |
amount | No | Pre-fill the max amount field |
Example URL:
The page offers two actions:
- Pay Now — Creates a token and immediately executes the payment. Shows a receipt when done.
- Approve & Copy Token — Creates a token and displays it for the user to copy back to their AI agent.
Purchase Token API
Create a Token
Response:
Use the Token
The token works identically to regular API tokens — the existing x402/fetch proxy handles everything.
Security Model
Purchase tokens are designed to be maximally safe:
- One-time use: Token is consumed on first successful payment. Cannot be reused.
- 5-minute expiry: Unused tokens expire automatically.
- Merchant-bound: Token only works for the specific merchant URL it was created for.
- Network-bound: Token only works on the specified blockchain network.
- Amount-capped: The
max_amount_usdacts as a spending ceiling. The actual charge may be less. - Hash-only storage: Only the SHA-256 hash is stored. The raw token is returned once and never persisted.