Pay for an x402 API
pay_x402Call a URL that may answer 402 Payment Required, pay it in USDC from this wallet after presign-guard checks spending limits, then return the API response.
Instructions
Call a URL that may answer 402 Payment Required and pay it in USDC from this wallet, then return the response. Works with x402 and with MPP (the Machine Payments Protocol): method evm (USDC on this wallet's chain) and method tempo (USDC.e on Tempo, from this wallet's address there). With a Solana or Algorand account set up, x402 offers in USDC there are paid too, and with an XRPL account x402 offers in RLUSD on the XRP Ledger (all after USDC on this chain). When an API offers several, x402 comes first, then MPP evm, then Tempo. The payment is checked by presign-guard and counts toward the spending limits; over a limit the owner is asked to approve (the call waits), and a refusal comes back as an error with the reason. max_price_usd caps the price of this call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The API URL | |
| body | No | Request body: a string, or an object sent as JSON | |
| method | No | HTTP method (default GET) | |
| reason | No | What this is for, in a few words (shown to the owner on the receipt and in approval requests) | |
| headers | No | Extra request headers, e.g. content-type | |
| max_price_usd | No | The most this call may cost, in dollars (never above the server's MAX_PAYMENT_USD) |