Example servers
Minimal server examples (x402 v1 and v2) and how they integrate with the facilitator
The facilitator repo includes two example integrations:
monorepo/facilitator/examples/v1-server/: x402 v1 viax402-expressmonorepo/facilitator/examples/v2-server/: x402 v2 via@x402/*(Exact EVM scheme)
Common environment variables
Both examples expect:
FACILITATOR_URL=http://localhost:4022
ADDRESS=0x... # payTo / merchant address
AGENT_PRIVATE_KEY=0x... # used for registration + signing feedbackAuth hash
DELEGATE_CONTRACT_ADDRESS=0x...v1 example
v1-server shows:
paymentMiddleware(...)protectingGET /resourceGenerating an EIP-7702 authorization (
walletClient.signAuthorization)Calling facilitator
POST /registerwithx402Version: 1
v2 example
v2-server shows:
@x402/expresspayment middleware protectingGET /weatherPassing an x402
feedbackextension with:feedbackEnabled: trueagentId: "..."(example uses"1133")feedbackAuthEndpoint: "/signFeedbackAuth"
Implementing
POST /signFeedbackAuthso the facilitator can request the agent owner’s signature
Last updated