Minimal x402 v2 test server for InferNode wallet and payfetch integration testing.
npm install
npm startServer runs on http://localhost:4020.
| Endpoint | Method | Description |
|---|---|---|
/api/data |
GET | Protected — returns 402 without payment, 200 with valid PAYMENT-SIGNATURE |
/api/free |
GET | Free — always returns 200 |
/health |
GET | Health check |
# Get 402 response
curl -i http://localhost:4020/api/data
# Send payment (test server accepts any well-formed payload)
curl -H 'PAYMENT-SIGNATURE: {"x402Version":2,"payload":{"signature":"0x...","authorization":{"from":"0x..."}}}' \
http://localhost:4020/api/dataFrom the Inferno shell:
payfetch http://localhost:4020/api/data -a veltro-demo-wallet
| Variable | Default | Description |
|---|---|---|
PORT |
4020 | Server port |
PAY_TO |
0x...dEaD |
Payment recipient address |
NETWORK |
eip155:11155111 |
Ethereum Sepolia |
USDC_ADDRESS |
0x1c7D...7238 |
Sepolia USDC contract |
PRICE |
100000 |
Price in USDC base units (0.1 USDC) |
MIT