Overview
The Dodo Starter kit includes a comprehensive invoice management system that tracks all payments, displays payment methods, and allows users to download invoices.Invoice History Component
The invoice history component displays a table of all user payments:components/dashboard/invoice-history.tsx
Get Invoices Action
The server action retrieves all invoices for the current user:actions/get-invoices.ts
- Get the current user’s subscription details
- Query all payments associated with the user’s Dodo customer ID
- Return the complete invoice history
Invoice Data Structure
Each invoice contains comprehensive payment information:Payment Method Display
The component displays branded payment method logos:Card Network Detection
- Visa
- Mastercard
- American Express
- Generic fallback for other cards
Payment Status Badges
Visual status indicators show payment state:| Status | Badge Color | Display |
|---|---|---|
succeeded | Green | Paid |
failed | Red | Failed |
processing | Yellow | Processing |
cancelled | Gray | Cancelled |
Download Invoices
Users can download PDF invoices hosted by Dodo Payments:- Test mode:
https://test.dodopayments.com/invoices/payments/{paymentId} - Live mode:
https://live.dodopayments.com/invoices/payments/{paymentId}
Currency Formatting
The component supports multiple currencies:- USD ($) - US Dollar
- EUR (€) - Euro
- GBP (£) - British Pound
- INR (₹) - Indian Rupee
- And more (displayed with currency code)
Date Formatting
Invoice dates are formatted with full timestamp:Empty State
When no invoices exist, a helpful message is displayed:Webhook Integration
Invoices are automatically created and updated via webhooks:supabase/functions/dodo-webhook/index.ts
- New payments are automatically added
- Payment status updates are synced in real-time
- Card details are captured for display
- Full webhook data is stored for reference
Invoice Features
Payment Details
Amount, currency, date, and status for each transaction
Card Information
Card network logos and last 4 digits
PDF Download
Download official invoices from Dodo Payments
Real-time Sync
Automatic updates via webhooks
Responsive Design
The invoice table is fully responsive:- Mobile: Scrollable table with compact layout
- Tablet: Optimized column widths
- Desktop: Full table with all details visible
Next Steps
Payment Processing
Learn about the payment flow
Dashboard Overview
Explore all dashboard features
