wallet_buy
Get a link to buy credits for your wallet. Use this to purchase credits that power AI tools. $10 = 1000 credits. Each AI call costs ~1 credit. After purchasing, use your API key with the AI tools.
This record as markdown: /tools/com-gadgethumans-swarm-x402-middleware/wallet-buy.md
What wallet_buy does on X402 Middleware
AI agents use wallet_buy to commit financial operations through X402 Middleware, usually the final step of a payment, billing, or trading workflow. A call moves real money.
Why wallet_buy is rated Critical
This tool initiates a financial transaction — purchasing credits for a wallet. Even though it returns a 'link' rather than directly charging, it is the entry point to a financial commitment (real money exchanged for credits). This falls squarely in the Financial category. Severity is high because an AI agent could misuse this to trigger unwanted purchases or repeatedly initiate payment flows.
From the tool's definition "buy credits for your wallet", "purchase credits", "$10 = 1000 credits"
Attacks that exploit this kind of access
The rule that runs wallet_buy safely
PolicyLayer is an MCP gateway: it sits between your AI agents and X402 Middleware, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For wallet_buy, this is the rule to start with:
Any call to wallet_buy is blocked until a human approves it. The rest of the server keeps working.
The button opens the PolicyLayer dashboard: create your workspace, connect X402 Middleware, apply this rule, and every wallet_buy call is checked against it from then on.
Questions about wallet_buy
Get a link to buy credits for your wallet. Use this to purchase credits that power AI tools. $10 = 1000 credits. Each AI call costs ~1 credit. After purchasing, use your API key with the AI tools. It is categorised as a Financial tool in the X402 Middleware MCP Server, which means it involves financial transactions. Block by default and require explicit approval.
Register the X402 Middleware MCP server in PolicyLayer and add a rule for wallet_buy: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches X402 Middleware. Nothing to install.
wallet_buy is a Financial tool with critical risk. Critical-risk tools should be blocked by default and only enabled with explicit human approval.
Yes. Add a rate_limit block to the wallet_buy rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for wallet_buy. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
wallet_buy is provided by the X402 Middleware MCP server (@gadgethumans/x402). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on X402 Middleware, and thousands of servers like it.
Across the catalogue