pay
Call paid APIs that respond with 402, automatically settle the USDC charge, and receive the response and a machine-readable receipt. Provide a unique idempotency key to avoid double billing.
Instructions
SPENDS REAL MONEY — on-chain and irreversible. The complete machine payment path: makes the HTTP request, and if the server answers 402, selects the supported asset/network variant (USDC on Base/Ethereum/Polygon; delegated mode also settles Solana and BNB Chain variants), validates policy, pays, retries the request, and returns the response plus a structured machine-readable receipt. Requires an idempotencyKey: re-calling with a key that already paid returns the cached receipt and does NOT pay again. Mode selection: PAYAGENT_PRIVATE_KEY set → signs locally (self-custody; wallet balance is the only cap); otherwise pays through the stored ArisPay agent whose per-tx/daily/monthly mandate is enforced server-side BEFORE signing. Use inspect first to see the price. Do not use for ordinary unpaid HTTP requests.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The full URL of the API endpoint to call. | |
| body | No | ||
| agent | No | Optional name of a stored x402 payer agent (delegated mode). | |
| method | No | GET | |
| headers | No | ||
| idempotencyKey | Yes | Caller-chosen unique key for this payment intent (min 8 chars, e.g. a UUID). Re-calling with a key that already paid returns the cached receipt WITHOUT paying again. Use a fresh key for each new payment intent. |