x402 micropayments is payment platform for using x402 (x402 API, x402 integration) This project is a movie streaming platform integrated with x402 for secure and seamless payments. Users can pay and watch movies directly through the x402 payment gateway. The backend handles x402 API interactions, ensuring reliable transaction processing and subscription management using x402 services.
- Simple Express.js server with x402 payment middleware
- Paywalled endpoint for accessing premium video content
- Secure payment processing and verification
- Base Sepolia testnet integration for easy testing
- Modern, Professional UI - Beautiful gradient design with smooth animations
- Responsive Landing Page - Hero section with feature cards and "How It Works" guide
- Payment Processing Page - Real-time status indicators with animated loader
- Premium Content Page - Clean video player interface with payment confirmation
- Consistent Navigation - Navbar with x402 branding and quick links across all pages
- Professional Footer - Social links, quick navigation, and resource links
- Font Awesome Icons - Enhanced visual design throughout the interface
- SEO Optimized - Complete meta tags for social sharing (OpenGraph, Twitter Cards)
- Favicon Support - Custom branding with SVG favicon
- Node.js (v22 or higher)
- A EVM-compatible wallet with Base Sepolia USDC
-
Clone this repository:
git clone https://github.com/enlomy/x402.git cd x402 -
Install dependencies:
npm install
-
Rename
.env.localto.envand add the following variables (remember to replaceWALLET_ADDRESSwith your actual wallet address you want to receive payments for)WALLET_ADDRESS=your_ethereum_wallet_address NODE_ENV=development PORT=402 -
Get Base Sepolia USDC for testing:
- Visit https://faucet.circle.com/
- Select Base Sepolia in the network dropdown
- Request test USDC
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:402
- The server uses the
x402-expressmiddleware to protect the/authenticateendpoint - When a user tries to access the protected endpoint, they are required to make a payment
- After successful payment, the user is redirected to
/video-content, where the premium video content is served
- To change the price of the video, modify the
priceparameter inapi/index.js - To use a different video, update the video source in
public/video-content.html - To deploy on Base mainnet, update the network configuration in
api/index.js(you will need also need CDP API Keys and need to use a different Facilitator)