pay_x402
Pay for a resource using the x402 protocol (HTTP 402 Payment Required).
When an API returns HTTP 402 with x402 paymentRequirements, use this tool to initiate the payment. The payment requires user approval in the Moneda app before it executes.
Parameters map to x402 paymentRequirements fields:
payTo: the recipient wallet address from the 402 response
amount: the payment amount (e.g. "0.01")
currency: USD or EUR (maps to USDC or EURC on Base)
resource: the URL being paid for (shown to the user for context)
network: must match the Moneda deployment ("base" or "base-sepolia")
After calling this tool, poll get_payment_status every 10-15 seconds until a terminal status (COMPLETED, FAILED, EXPIRED, REJECTED). On COMPLETED the funds settle on-chain to payTo. Note: Moneda does not yet emit the x402 X-PAYMENT proof header, so a bare retry only unlocks the resource if its facilitator accepts on-chain settlement as proof.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"amount": "<amount>",
"currency": "<currency>",
"payTo": "<payTo>",
"resource": "<resource>",
"network": "<network>"
},
"name": "pay_x402"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| payTo | Yes | Recipient wallet address (0x-prefixed, 42 chars) from paymentRequirements.payTo. | |
| amount | Yes | Payment amount in human-readable form (e.g. "0.01"). From paymentRequirements.maxAmountRequired or the exact price. | |
| network | Yes | Blockchain network from paymentRequirements.network. Must be "base" or "base-sepolia". | |
| currency | Yes | Payment currency. USD maps to USDC, EUR maps to EURC. | |
| resource | Yes | The URL that returned HTTP 402. Stored for audit and shown to the user. | |
| reference | No | Optional payment memo/reference (max 140 chars). | |
| maxAmountRequired | No | Maximum amount from the 402 response, if different from amount. |