A simple Next.js application for creating and paying invoices on the Arb network using thirdweb's X402 payment system.
- 🧾 Create invoices with customer details
- 💰 Pay invoices directly on Arb network using thirdweb
- 📊 Dashboard to view all invoices
- ✅ Payment confirmation with transaction details
- 🔗 Direct links to ArbScan for transaction verification
- Next.js 14 - React framework with App Router
- thirdweb - Web3 SDK for wallet connections and payments
- TailwindCSS - Styling
- shadcn/ui - UI components
- MongoDB - Database for invoice storage
- Install dependencies:
npm install- Set up environment variables:
Create a
.env.localfile:
NEXT_PUBLIC_THIRDWEB_CLIENT_ID=your-thirdweb-client-id
THIRDWEB_SECRET_KEY=your-thirdweb-secret-key
SERVER_WALLET_ADDRESS=0xYourWalletAddress
MONGODB_URI=mongodb://localhost:27017/basepay-invoice
- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
- Create Invoice: Navigate to
/newand fill in the invoice details - View Invoice: Share the invoice link
/invoice/[id]with the customer - Pay Invoice: Customer connects wallet and clicks "Pay with Arb"
- Success: After payment, view transaction details on ArbScan
├── app/
│ ├── api/
│ │ ├── invoices/route.ts # Create invoice endpoint
│ │ └── pay/route.ts # Payment processing with X402
│ ├── invoice/[id]/page.tsx # Invoice view page
│ ├── new/page.tsx # Create invoice page
│ ├── success/[id]/page.tsx # Payment success page
│ └── page.tsx # Dashboard
├── components/
│ ├── invoice-payment.tsx # Payment component
│ └── ui/ # shadcn components
└── lib/
└── invoices.ts # Invoice storage utilities
- Invoices are stored in MongoDB database
- Payments use thirdweb's X402 payment system
- All transactions are on Arb network