Pay an x402 endpoint in USDC or $THREE and return its result
pay_and_callPay for and call a paid x402 endpoint, settling payment automatically. Supports self-custodial signing or session-governed payment via three.ws token.
Instructions
Call a paid x402 endpoint and settle the payment automatically, then return the result.
Two modes:
• Self-custodial (default): signs with SOLANA_SECRET_KEY or secret arg — you hold the key.
• Session-governed: pass session_token (a three.ws Payment Session token) — the platform wallet signs on your behalf; the session's budget, allowlist, and per-tx cap are enforced by the platform. No private key required. Supports Solana USDC and Base USDC sessions.
Pay in USDC (default) or, when the endpoint advertises it, in $THREE (set token:"three"). Bounded by max_usd and the MAX_PAY_USD cap; refuses before any money moves if the price is over the cap. With REQUIRE_CONFIRM on, the call refuses until re-issued with confirm:true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The x402 endpoint to pay and call. | |
| body | No | JSON body for POST requests. | |
| token | No | Settlement token. "usdc" (default) or "three" — the $THREE platform token; the endpoint must advertise it. Ignored when session_token is set. | usdc |
| method | No | HTTP method. | GET |
| secret | No | Per-call base58 signer override (defaults to SOLANA_SECRET_KEY). Ignored when session_token is set. | |
| confirm | No | Must be true to execute when REQUIRE_CONFIRM is on. | |
| max_usd | No | Hard ceiling for THIS call in USD. Can only lower the MAX_PAY_USD cap, never raise it. | |
| session_token | No | three.ws Payment Session token (pss_…). When provided, the platform wallet pays — no local key needed. Overrides `secret`. | |
| idempotency_key | No | Deduplication key for this call. Recommended when using session_token to avoid double-charges on retries. |