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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL to access (will handle 402 payment if required) | |
| wallet_id | Yes | Wallet ID to pay from | |
| method | No | HTTP method (GET, POST, PUT, DELETE) | GET |
| headers | No | Optional JSON string of additional request headers | |
| body | No | Optional request body for POST/PUT requests | |
| max_payment | No | Maximum payment in human-readable format (e.g. "1.00" for 1 USDC). Rejects payments above this amount. Strongly recommended to prevent overspending. | |
| prefer_chain | No | Preferred chain ID if the server accepts payment on multiple chains (e.g. 8453 for Base, 1 for Ethereum) |