Overview
The Dodo Starter kit integrates Dodo Payments for secure payment processing. The system handles checkout sessions, payment webhooks, and automatic subscription updates.Checkout Flow
Creating a Checkout Session
When a user selects a plan, the system creates a checkout session:components/dashboard/dashboard.tsx
Checkout Route Handler
The checkout route uses the Dodo Payments Next.js SDK:app/checkout/route.ts
- Static: Pre-configured checkout page hosted by Dodo
- Session: Dynamic checkout session created from your application
Webhook Processing
Dodo Payments sends webhooks to your Supabase Edge Function when payment events occur:Webhook Handler
supabase/functions/dodo-webhook/index.ts
Payment Event Handler
Subscription Event Handler
User Tier Updates
When subscriptions become active, update the user’s tier:Subscription Cancellation Handling
Webhook Events
Payment Events
| Event | Description | Action |
|---|---|---|
payment.succeeded | Payment completed successfully | Store payment record |
payment.failed | Payment failed | Store failure, notify user |
payment.processing | Payment being processed | Update status |
payment.cancelled | Payment was cancelled | Update status |
Subscription Events
| Event | Description | Action |
|---|---|---|
subscription.active | Subscription activated | Update user tier, grant access |
subscription.plan_changed | User changed plans | Update subscription, adjust billing |
subscription.renewed | Subscription renewed | Update next billing date |
subscription.cancelled | User cancelled | Schedule downgrade |
subscription.expired | Subscription ended | Remove access |
subscription.failed | Renewal payment failed | Put subscription on hold |
subscription.on_hold | Awaiting payment retry | Limited access |
Payment Methods
Dodo Payments supports multiple payment methods:- Credit/Debit Cards (Visa, Mastercard, Amex)
- Digital Wallets (Apple Pay, Google Pay)
- Bank Transfers (ACH, SEPA)
- Buy Now, Pay Later (Klarna, Afterpay)
Security
- PCI DSS Compliant: All payment data is handled by Dodo Payments
- Webhook Signature Verification: All webhooks are cryptographically signed
- Secure Checkout: Hosted checkout pages with SSL/TLS encryption
- 3D Secure: Supports 3DS2 authentication for card payments
Testing
Dodo Payments provides test mode for development:.env.local
Test Card Numbers
| Card Number | Result |
|---|---|
| 4242 4242 4242 4242 | Success |
| 4000 0000 0000 0002 | Decline |
| 4000 0000 0000 9995 | Insufficient funds |
Environment Variables
.env.example
Next Steps
Invoice History
View and download customer invoices
Dashboard Features
Explore the full dashboard
