A modern, developer-focused frontend interface for the ZPayNow crypto payment gateway supporting x402 and 8004 protocols.
The project is deployed using Cloudflare Workers. For local development:
# Install dependencies
npm install
# Start local development server
npx wrangler dev
# Visit http://localhost:8787# Deploy to Cloudflare Workers
npx wrangler deployEdit wrangler.toml to configure your deployment:
name = "zpaynow-playground-server"
main = "index.js"
compatibility_date = "2024-03-20"
[vars]
APIKEY = "your-apikey"
SERVICE = "https://api.zpaynow.com"Environment Variables:
APIKEY: Your ZPayNow API key for authenticating with the payment serviceSERVICE: ZPayNow API service endpoint (default: https://api.zpaynow.com)
UI Components:
- Modern dashboard layout with fixed sidebar and top bar
- Two-column playground interface (Request Builder + Response Viewer)
- Protocol selector tabs (x402 / 8004)
- JSON request/response viewers with syntax highlighting
- Transaction status timeline
- Light/Dark theme toggle
- Fully responsive (mobile-friendly)
- Glassmorphism effects
- Smooth animations and transitions
Backend Integration:
- Cloudflare Workers serverless architecture
- ZPayNow API integration for payment processing
- x402 protocol support (requirements & payments)
- Payment session management
- Webhook handling
- CORS-enabled API endpoints
- Static asset serving with Cloudflare Workers Assets
- Color Scheme: Teal accent (#0ea5a4) with balanced light/dark palettes
- Typography: Inter (UI) + Roboto Mono (code)
- Style: Minimalistic, developer-oriented, secure aesthetic
- Framework: TailwindCSS (CDN-based, no build required)
/playground
├── index.js # Cloudflare Worker (API proxy + static file serving)
├── wrangler.toml # Cloudflare Workers configuration
├── package.json # Dependencies
├── payment.html # Payment UI (default route)
├── x402.html # x402 Protocol playground
├── 8004.html # 8004 Protocol playground
├── DESIGN.md # Complete design system documentation
└── README.md # This file
- ZPayNow branding
- Navigation: Playground, Transactions, Settings, Docs
- Active state indicators
- Network selector (Mainnet/Testnet/Custom)
- Connect Wallet button (UI only)
- Theme toggle (Light/Dark)
- Protocol tabs (x402 / 8004)
- Template dropdown
- JSON editor placeholder
- Send/Clear action buttons
- Transaction status timeline
- JSON response viewer
- Copy as cURL button
- Gas fee and time estimates
Toggle between light and dark themes using the sun/moon icon in the top-right corner.
Light Theme: Clean, professional, high-contrast Dark Theme: Developer-friendly, reduced eye strain
- Desktop (≥1024px): Full two-column layout with visible sidebar
- Mobile (<1024px): Stacked layout, collapsible sidebar with hamburger menu
All customization can be done directly in index.html:
- Colors: Edit
tailwind.configin the<script>tag - Content: Modify HTML sections
- Fonts: Replace Google Fonts links
- Layout: Adjust Tailwind utility classes
- Live JSON editing with validation
- Real-time status updates
- Enhanced form handling
- Transaction history UI
- Enhanced wallet connection (MetaMask, WalletConnect)
- Additional protocol support (8004 full implementation)
- Template library
- Code generation
- Export/import configurations
- API testing suite
- Webhook testing
- Analytics dashboard
- Developer documentation portal
See DESIGN.md for complete design system documentation including:
- Color palette specifications
- Typography scale
- Component library
- Layout principles
- Accessibility guidelines
- Visual effects reference
- Chrome/Edge: Full support
- Firefox: Full support
- Safari: Full support
- Mobile browsers: Responsive design
- TailwindCSS 3.x: Utility-first CSS framework (CDN)
- Google Fonts: Inter + Roboto Mono
- Vanilla JavaScript: Theme toggle and mobile menu
- HTML5: Semantic markup
- Cloudflare Workers: Serverless edge computing platform
- Cloudflare Workers Assets: Static file hosting
- ZPayNow API: Payment processing backend
The Cloudflare Worker serves as both a static file server and an API proxy:
Payment Session Management:
POST /products- Create a payment session for a productGET /sessions/:id- Fetch payment session statusPOST /webhook- Handle payment webhooks
x402 Protocol:
POST /x402/requirements- Get payment requirementsPOST /x402/payments- Submit payment
UI Routes:
/- Payment interface (payment.html)/x402- x402 Protocol playground (x402.html)/8004- 8004 Protocol playground (8004.html)
All API endpoints include CORS headers for cross-origin requests.
The frontend uses CDN-based TailwindCSS and requires no build process. The Cloudflare Worker is deployed as-is with Wrangler CLI.
Version: 2.0.0 Phase: Backend Integration (Complete) Backend: Cloudflare Worker with ZPayNow API proxy Deployment: Production-ready on Cloudflare Workers
Note: The application is now fully integrated with the ZPayNow API for payment processing. The Cloudflare Worker handles API routing, CORS, and static file serving.
For questions or feedback, please refer to the design documentation in DESIGN.md.