Build a paywall API that charges 1 MOVE to unlock premium content using the x402 protocol.
- Node.js 18+
- Movement-compatible wallet (Nightly recommended)
- MOVE tokens on mainnet
x402_workshop/
├── workshop-code/ # Next.js frontend
├── server/ # Express backend with x402 paywall
└── WORKSHOP.md # Workshop script/guide
cd server
npm installcp .env.example .envEdit .env and set your Movement wallet address:
MOVEMENT_PAY_TO=0x<your_address>
cd ../workshop-code
npm install --legacy-peer-depscd server
npm run devServer runs at http://localhost:4402
cd workshop-code
npm run devFrontend runs at http://localhost:3000
- Open http://localhost:3000
- Connect your wallet (Movement mainnet)
- Click "Unlock (1 MOVE)"
- Approve the transaction in your wallet
- Content unlocks after payment confirms
- Client requests
/api/premium-content - Server returns HTTP 402 with payment requirements
- Client signs a transfer transaction (but doesn't submit)
- Client retries with signed tx in
X-PAYMENTheader - Facilitator verifies signature and submits transaction
- After on-chain confirmation, server releases content
See WORKSHOP.md for the full workshop script with explanations.