Build your first paid API on Sei in under 10 minutes by using @sei-js/x402
Node.js & Package Management
node --version
should output v18.0.0 or higherSei Wallet & Test Funds
1328
, RPC https://evm-rpc-testnet.sei-apis.com
Environment Variables
FACILITATOR_URL
- URL of your x402 facilitator serviceADDRESS
- Your Sei wallet address (0x format) to receive paymentsInstall x402 packages
Create a simple paid API server
facilitatorUrl
environment variable that need to be configured. You’ll need to set up a facilitator to process payments or use a public facilitator. See the Facilitator Example here.server.js
with a protected API endpoint:Test the payment requirement
402 Payment Required
response with payment details.