Payments
x402 Agents
Easily create AI agents that can pay for any x402-compatible API calls.
The easiest way to equip your agents with the ability to pay for API calls is to use the remote MCP server and provide the tools to your agent.
The MCP server comes with all the tools by default, but you can filter the tools available by passing a comma-separated list of tools as a query parameter.
In this example, we create a ReAct agent using LangChain and filter the MCP tools to fetchWithPayment
and getWalletBalance
as the only 2 tools we give our agent. You can view the full list of available tools here.
You can also create your own MCP tool or wrap all external calls with the /v1/x402/fetchWithPayment
endpoint to automatically handle payment flows when APIs return a 402 Payment Required
response.
Pass the target url
, method
and optional from
wallet address to the endpoint that will complete the payment. The address should be one of your user wallets or server wallets.