Payment-gated content and API endpoints powered by x402 protocol on Base network. Access premium content via browser or integrate with AI agents through our API endpoints.
x402-creative-tim is an early-stage TypeScript project in the AI payments / x402 ecosystem, focused on creative-tim-ui, creativetim, open, ui-ux-book. It currently has 3 GitHub stars and 2 forks, and sits alongside related tools like X402-audio-to-audio, sample-agentcore-cloudfront-x402-payments, spritz, x402-facilitator, Vault-0, tdm-sdk.
A Next.js application demonstrating the x402 Protocol for blockchain-based micropayments on Base Network. This project showcases payment-gated content with dual access methods: beautiful browser UIs and JSON API endpoints for AI agents.
x402 is a protocol that enables HTTP 402 (Payment Required) status for the modern web, allowing content creators to monetize their APIs and digital content using cryptocurrency micropayments. This demo shows how to integrate x402 payments into a Next.js application with proper blockchain settlement.
This project demonstrates three payment-gated content offerings with dual access methods:
Routes: /message → /message/user-payment (Browser) | /api/message (API)
Simple message endpoint demonstrating the basic x402 flow. Perfect for testing and understanding the protocol.
What you get:
Routes: /ui-ux-book → /ui-ux-book/user-payment (Browser) | /api/ui-ux-book (API)
Comprehensive UI/UX design book with practical resources.
What's included:
Browser access shows a beautiful payment success page with download links. API access returns JSON with the same download links for programmatic access.
Routes: /shadcn-blocks → /shadcn-blocks/user-payment (Browser) | /api/shadcn-block (API)
Premium UI component blocks from Creative Tim built with shadcn/ui.
What you get:
Browser Users:
┌──────────────┐ ┌─────────────────┐ ┌──────────────────┐
│ Presentation │─────▶│ User Payment │─────▶│ Beautiful UI │
│ Page │ │ Page (Protected)│ │ with Downloads │
└──────────────┘ └─────────────────┘ └──────────────────┘
│
▼
┌──────────────┐
│ x402 │
│ Middleware │
└──────────────┘
API/AI Agents:
┌──────────────┐ ┌─────────────────┐ ┌──────────────────┐
│ API Request │─────▶│ x402 │─────▶│ JSON Response │
│ │ │ Middleware │ │ with Data │
└──────────────┘ └─────────────────┘ └──────────────────┘
/ui-ux-book)/ui-ux-book/user-payment)/api/ui-ux-book)git clone https://github.com/creativetimofficial/x402-creative-tim
cd x402-creative-tim
npm install
# or
pnpm install
Copy .env.example to .env:
cp .env.example .env
Edit .env with your configuration:
# Network Configuration
NETWORK=mainnet
# Wallet Addresses for receiving payments
NEXT_PUBLIC_MAINNET_WALLET_ADDRESS=0xYourMainnetWallet
NEXT_PUBLIC_TESTNET_WALLET_ADDRESS=0xYourTestnetWallet
# CDP API Keys (required for mainnet)
CDP_API_KEY_ID=your-cdp-api-key-id
CDP_API_KEY_SECRET=your-cdp-api-key-secret
# OnchainKit API key (optional but recommended)
NEXT_PUBLIC_ONCHAINKIT_API_KEY=your-onchainkit-api-key
# App URL
NEXT_PUBLIC_APP_URL=http://localhost:3001
# Book Download URLs (for UI/UX book content)
BOOK_URL_PAID=https://your-dropbox-url
NEXT_PUBLIC_BOOK_URL_PREVIEW=https://your-preview-pdf-url
npm run dev
Visit http://localhost:3001 and start exploring!
The application supports both Base Mainnet (production) and Base Sepolia (testnet).
Use the network toggle in the navbar to switch between:
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA029130x036CbD53842c5426634e7929541eC2318f3dCF7eexport const ENDPOINT_PRICING = {
'message': 0.10, // $0.10 USDC
'ui-ux-book': 10.00, // $10.00 USDC
'shadcn-block': 0.01, // $0.01 USDC
}
Prices are centrally configured in lib/x402-config.ts and automatically apply to:
/ - Homepage with all offerings/message - Message content presentation/ui-ux-book - UI/UX book presentation/shadcn-blocks - Component blocks presentation/message/user-payment - Access message after $0.10 payment/ui-ux-book/user-payment - Download book after $10.00 payment/shadcn-blocks/user-payment - View component code after $0.01 payment/api/message - Returns JSON message content/api/ui-ux-book - Returns JSON with download links/api/shadcn-block - Returns JSON with component codex402-next packagex402-creative-tim/
├── app/
│ ├── api/ # API routes (return JSON)
│ │ ├── message/route.ts # Message API ($0.10)
│ │ ├── ui-ux-book/route.ts # Book API ($10.00)
│ │ └── shadcn-block/route.ts # Component API ($0.01)
│ ├── message/
│ │ ├── page.tsx # Message presentation page
│ │ └── user-payment/page.tsx # Payment success page
│ ├── ui-ux-book/
│ │ ├── page.tsx # Book presentation page
│ │ └── user-payment/page.tsx # Payment success page
│ ├── shadcn-blocks/
│ │ ├── page.tsx # Blocks presentation page
│ │ └── user-payment/page.tsx # Payment success page
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Homepage
│ └── providers.tsx # OnchainKit providers
├── lib/
│ ├── x402-config.ts # Pricing & network config
│ ├── x402-middleware-official.ts # Official middleware config
│ └── network-context.tsx # Network switching context
├── components/
│ ├── ui/ # shadcn/ui components
│ ├── navbar.tsx # Navigation with network toggle
│ ├── client-layout.tsx # Client wrapper
│ └── analytics.tsx # Google Tag Manager
├── middleware.ts # Route protection
└── .env.example # Environment template
.env.example file.env files (already in .gitignore)Edit lib/x402-config.ts:
export const ENDPOINT_PRICING = {
'message': 0.10, // Change to your price
'ui-ux-book': 10.00, // Change to your price
'shadcn-block': 0.01, // Change to your price
}
All pages automatically update to reflect new pricing.
lib/x402-config.tslib/x402-middleware-official.tsmiddleware.tsapp/your-content/page.tsxapp/your-content/user-payment/page.tsxapp/api/your-content/route.tsapp/globals.csscomponents/ui/ (shadcn/ui)components/navbar.tsxcomponents/client-layout.tsxNETWORK=mainnet
NEXT_PUBLIC_MAINNET_WALLET_ADDRESS=0x...
NEXT_PUBLIC_TESTNET_WALLET_ADDRESS=0x...
CDP_API_KEY_ID=...
CDP_API_KEY_SECRET=...
NEXT_PUBLIC_ONCHAINKIT_API_KEY=...
NEXT_PUBLIC_APP_URL=https://your-domain.com
BOOK_URL_PAID=https://your-dropbox-url
NEXT_PUBLIC_BOOK_URL_PREVIEW=https://your-preview-url
This project uses specific wallet addresses for receiving payments:
0x45ac00db8bdd4b837abbbf75888cbdfe6b6d89430x92a0f8ac8b8c2ef60d6d46e0f768067fa379f7f3Configure your own addresses in the .env file.
Contributions are welcome! Please:
Apache-2.0 License
Built with ❤️ by Creative Tim UI using Next.js, x402 Protocol, and Base Network
For questions or issues, please open an issue on GitHub.
Transmits signed USDC payments over sound using a custom OOK audio modem with Goertzel detection. Compresses x402 handshakes to 138 bytes, settling on Base through 36 seconds of 2400 Hz beeping.
AWS payment demo of x402 using Bedrock AgentCore, Strands SDK, and CloudFront.
Spritz is a decentralized, permission-less and censorship resistant chat app for web3. Connect with friends using passkeys or wallets. Make HD video calls, go live to your followers, and chat freely on a decentralized network.
Golang implementation of an x402 payment facilitator
Vault-0: Agent Security, Monitor & x402 Wallet for OpenClaw. Encrypted secret vault, real-time agent monitor, policy enforcement, and native x402 payments — built with Rust + Tauri.
Open contract-facing SDK for payable routes and gateway-backed integrations. Thin public surface for authorize, checkout, and session flows.
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
A payments protocol for the internet. Built on HTTP.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
Self-healing infrastructure for AI agent payments. 90.3% auto-recovery.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.