x402 SE-2 Extension

Scaffold-ETH 2 supercharged with HTTP 402 payment-gated routes.

Monetize your APIs and pages with micropayments using the x402 protocol. All the power of Scaffold-ETH 2 with seamless payment middleware integration.

Protected Routes Demo

Try accessing these protected routes - payment required to view content

Frontend Route

$0.01
/payment/builder

Protected page route - requires payment to access content

Try it now

API Route

$0.01
/api/payment/builder

Protected API endpoint - requires payment to access data

1. Get a 402 payment required response:

curl http://localhost:3000/api/payment/builder

2. Send a crafted 402 response:

yarn send402request

(check packages/hardhat/scripts/send402request.ts)

Configure Protected Routes

Edit middleware.ts to add or modify protected routes, set pricing, and configure payment options.

Tweak .env.development as needed (or copy it to .env.local and fill in your data).