Skip to main content
Glama

pay_x402

Process HTTP requests requiring payment by automatically handling x402 payment flows: fetches URLs, detects payment requirements, executes on-chain payments, and retries with proof of payment.

Instructions

Handle an x402 payment flow. Fetches a URL, and if the server returns HTTP 402 Payment Required, parses the payment requirements, executes the on-chain payment, and retries the request with proof of payment. Returns the final response. Supports the x402 open payment standard (https://x402.org). Set max_payment to prevent overspending.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to access (will handle 402 payment if required)
wallet_idYesWallet ID to pay from
methodNoHTTP method (GET, POST, PUT, DELETE)GET
headersNoOptional JSON string of additional request headers
bodyNoOptional request body for POST/PUT requests
max_paymentNoMaximum payment in human-readable format (e.g. "1.00" for 1 USDC). Rejects payments above this amount. Strongly recommended to prevent overspending.
prefer_chainNoPreferred chain ID if the server accepts payment on multiple chains (e.g. 8453 for Base, 1 for Ethereum)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hifriendbot/agentwallet-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server