Skip to content

NERVsystems/x402-test-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

x402 Test Server

Minimal x402 v2 test server for InferNode wallet and payfetch integration testing.

Quick Start

npm install
npm start

Server runs on http://localhost:4020.

Endpoints

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

Testing with curl

# 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/data

Testing with InferNode payfetch

From the Inferno shell:

payfetch http://localhost:4020/api/data -a veltro-demo-wallet

Configuration

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)

License

MIT

About

x402 test server for InferNode wallet integration testing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors