Got HTTP 402? Fund your x402 wallet from any chain
fund_x402Hit a '402 Payment Required' (x402) paywall but your funds are on another chain or token? Paste the 402 response (body JSON or base64 PAYMENT-REQUIRED header, x402 v1 or v2). Swap Ripper reads the invoice, picks the right network and token (e.g. USDC on Base), and tops up YOUR wallet there with an exact amount, paid from any token on any chain (SOL, ETH, BTC, USDC on Solana...). Default top-up ~$5 so dozens of future 402 calls need no swap. Call with only payment_required to decode the invoice and see options; add pay_with_token, wallet and refund_address to get a deposit address.
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": {
"payment_required": "<payment_required>"
},
"name": "fund_x402"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| test | No | Test mode: true = no real money. You get a fake deposit address that completes by itself in ~15s, so you can test status, invoices, receipts and webhooks for free. | |
| speed | No | Optional. Default 'best_price': Swap Ripper quotes two networks at once and uses whichever is cheaper for you (and the other if one fails); the reply's route_choice shows both. 'fast' forces the ~seconds Relay route. | |
| wallet | No | YOUR address on the invoice's network (the wallet your x402 client signs with). | |
| referrer | No | Optional: your NEAR account (e.g. 'myagent.near'). You earn 1/3 of the service fee on every swap routed with it. The user pays the same. | |
| request_id | No | Recommended: your own unique ID for this payment (e.g. a UUID). Retrying with the same request_id returns the SAME payment instructions, so you never pay twice. | |
| top_up_usd | No | Minimum top-up in USD (1-500, default 5). The invoice amount is used if larger. | |
| slippage_bps | No | Max slippage in basis points (default 100 = 1%, range 10-500). | |
| pay_with_chain | No | Chain you pay from, e.g. 'solana'. | |
| pay_with_token | No | Token you hold and will pay with, e.g. 'SOL' or 'USDC'. | |
| prefer_network | No | Optional: which of the invoice's networks to fund, e.g. 'base' or 'solana'. | |
| refund_address | No | Your address on the paying chain, for automatic refunds. | |
| payment_required | Yes | The 402 response body (object or JSON string) or the base64 PAYMENT-REQUIRED header value. |