ワンクリックで
x402-payment
Pay for x402-enabled Agent endpoints using ERC20 tokens (USDT/USDC) on EVM or TRC20 tokens (USDT/USDD) on TRON.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Pay for x402-enabled Agent endpoints using ERC20 tokens (USDT/USDC) on EVM or TRC20 tokens (USDT/USDD) on TRON.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | x402-payment |
| description | Pay for x402-enabled Agent endpoints using ERC20 tokens (USDT/USDC) on EVM or TRC20 tokens (USDT/USDD) on TRON. |
| user-invokable | true |
| argument-hint | url(required): Base URL of the agent (v2) or full URL (v1/Discovery); entrypoint(optional): Entrypoint name to invoke (e.g., 'chat', 'search'); input(optional): Input object to send to the entrypoint; method(optional): HTTP method (GET/POST), default POST(v2)/GET(Direct) |
| compatibility | {"tools":["x402_invoke"]} |
| metadata | {"version":"1.0.2","author":"cppay.finance","homepage":"https://x402.org","tags":["crypto","payments","x402","agents","api","usdt","usdd","usdc","tron","ethereum","evm","erc20","trc20","sdk"],"requires_tools":["x402_invoke"],"tool_implementation_mapping":{"x402_invoke":"dist/cli/x402_invoke.js"},"dependencies":["mcp-server-tron"]} |
Invoke x402-enabled AI agent endpoints with automatic token payments on both TRON (TRC20) and EVM-compatible (ERC20) chains.
The x402-payment package provides two ways to handle x402 payments:
import it to gain x402 payment capabilityx402_invoke directly from the command lineWhen an HTTP 402 Payment Required response is received, the package automatically handles negotiation, signing, and execution of the on-chain payment.
npm install @springmint/x402-paymentx402-config.json, ~/.mcporter/mcporter.json)npx @springmint/x402-payment --checkOther skills can add x402 payment capability by importing this package:
npm install @springmint/x402-payment
import { createX402FetchClient, invokeEndpoint } from "@springmint/x402-payment";
// Option 1: Fetch client with automatic 402 handling
const client = await createX402FetchClient();
const response = await client.request("https://paid-api.com/endpoint", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query: "hello" }),
});
// Option 2: High-level invoke helper
const result = await invokeEndpoint("https://api.example.com", {
entrypoint: "chat",
input: { prompt: "hello" },
});
| Function | Description |
|---|---|
createX402FetchClient(options?) | Create a fetch client with automatic 402 payment handling |
createX402Client(options?) | Create the underlying X402Client with payment mechanisms |
invokeEndpoint(url, options?) | High-level: create client, request, return parsed response |
findPrivateKey(type) | Discover private key from env/config files |
findApiKey() | Discover TronGrid API key |
Before making payments, verify your wallet status:
npx @springmint/x402-payment --check
Most modern x402 agents use the v2 "invoke" pattern:
npx @springmint/x402-payment \
--url https://api.example.com \
--entrypoint chat \
--input '{"prompt": "Your query here"}'
npx @springmint/x402-payment --url https://api.example.com/.well-known/agent.json
npx @springmint/x402-payment --url https://api.example.com/entrypoints
The SDK automatically detects the required chain from the server's 402 response. No need to specify the network manually — it matches the payment requirements with registered mechanisms.
TRON_PRIVATE_KEYEVM_PRIVATE_KEY or ETH_PRIVATE_KEY| Chain | Network Name | Common Tokens | USDT Contract |
|---|---|---|---|
| TRON | mainnet | USDT, USDD | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t |
| TRON | nile | USDT, USDD | TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf |
| BSC | bsc | USDT, USDC | 0x55d398326f99059fF775485246999027B3197955 |
| BSC | bsc-testnet | USDT, USDC, DHLU | 0x337610d27c682E347C9cD60BD4b3b107C9d34dDd |
[!CAUTION] Private Key Safety: NEVER output your private keys to the logs or console. The package loads keys from environment variables internally.
[[ -n $TRON_PRIVATE_KEY ]] && echo "Configured" || echo "Missing" to verify configuration without leaking secrets.x402-payment --check to safely verify addresses.If the endpoint returns an image or binary data (CLI mode only):
/tmp/x402_image_...).file_path, content_type, and bytes.If you get an allowance error, approve the token first:
# Check current allowance
npx @springmint/x402-payment --allowance --token <TOKEN_ADDRESS> --network <NETWORK>
# Approve token spending
npx @springmint/x402-payment --approve --token <TOKEN_ADDRESS> --network <NETWORK>
Or in code:
import { approveToken } from "@springmint/x402-payment";
await approveToken("evm", "0x55d3...7955", "eip155:97");
Ensure you have native tokens (TRX or BNB/ETH) for gas.
Ensure you have enough USDT/USDC/USDD in your wallet on the specified network.
Last Updated: 2026-03-17