yax_process_x402_payment
Process x402 payments to EVM, NEAR, or Stacks addresses. Validates spend cap and returns transaction hash with signed receipt.
Instructions
Sends an x402 payment to any EVM, NEAR, or Stacks address. Validates against your spend cap before signing. Returns transaction hash and signed receipt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recipient | Yes | Recipient address: EVM 0x address, Stacks SP address, or NEAR account name. | |
| amount | Yes | Payment amount as a decimal string, e.g. '0.50'. Validated against policy spend cap. | |
| token | No | Token symbol to pay with. Supported: USDC, STX, NEAR, ETH. Defaults to USDC. | USDC |
| memo | No | Optional human-readable memo attached to the payment transaction. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| run_id | No | Unique run identifier for this payment. | |
| tx_hash | No | On-chain transaction hash of the settled payment. | |
| status | No | Payment status: completed or denied. | |
| proof | No | Filecoin and BTFS CIDs anchoring the payment receipt permanently. | |
| receipt_signature | No | Cryptographic signature over the payment receipt. | |
| anchored_at | No | ISO 8601 timestamp of receipt anchoring. |
Implementation Reference
- sdk-ts/src/index.ts:290-294 (handler)The main handler function `processX402Payment` that calls the remote MCP tool 'yax_process_x402_payment'. It wraps the arguments with an optional idempotency_key header and delegates to the low-level `call` method.
processX402Payment(args: ProcessX402PaymentArgs): Promise<PaymentReceipt> { const headers: Record<string, string> = {}; if (args.idempotency_key) headers["X-Idempotency-Key"] = args.idempotency_key; return this.call<PaymentReceipt>("yax_process_x402_payment", args as unknown as Record<string, unknown>, headers); } - sdk-ts/src/types.ts:92-99 (schema)The input arguments type definition for the x402 payment tool, with fields: recipient, amount, token, memo, and idempotency_key.
export interface ProcessX402PaymentArgs { recipient: string; amount: string; token?: string; memo?: string; /** Pass via arg OR X-Idempotency-Key header. Dedupes 24h per (api_key, key). */ idempotency_key?: string; } - sdk-ts/src/types.ts:101-111 (schema)The return type `PaymentReceipt` containing ok, run_id, tx_hash, status, proof, receipt_signature, anchored_at, idempotency_key, and idempotency_replay fields.
export interface PaymentReceipt { ok: boolean; run_id: string | null; tx_hash: string | null; status: RunStatus; proof?: Proof | null; receipt_signature?: string | null; anchored_at?: string | null; idempotency_key?: string | null; idempotency_replay?: boolean; } - sdk-ts/src/index.ts:293-293 (registration)The tool name 'yax_process_x402_payment' is registered as a string literal passed to the low-level `call` method, which sends it as the tool name in a JSON-RPC 'tools/call' request.
return this.call<PaymentReceipt>("yax_process_x402_payment", args as unknown as Record<string, unknown>, headers);