Deploy Webhook Handler
The webhook handler processes subscription events from Dodo Payments in real-time.Login to Supabase CLI
Authenticate with Supabase:This will open your browser to complete authentication.
Find Your Project Reference
Your project reference ID is in your Supabase project URL:For example, if your URL is
https://abcdefgh12345678.supabase.co, your project reference is abcdefgh12345678.Deploy the Webhook Function
Deploy the Dodo webhook handler to your Supabase project:Replace
your-project-ref with your actual project reference ID.The
--no-verify-jwt flag is included in the script because Dodo Payments uses webhook signatures for authentication instead of JWT tokens.Configure Dodo Payments Webhook
Add Webhook Endpoint
- Go to your Dodo Payments Dashboard
- Navigate to Settings → Webhooks
- Click Add Endpoint
- Enter your webhook URL:
Select Events
Enable these webhook events to sync subscription data:
payment.succeededpayment.failedsubscription.createdsubscription.updatedsubscription.cancelledsubscription.renewed
Create Subscription Products
Before launching, create at least one subscription product in Dodo Payments.Create Product
- In your Dodo Payments dashboard, go to Products
- Click Create Product
- Fill in the basic information:
- Product name (e.g., “Pro Plan”)
- Description
- Price
- Billing cycle (monthly, yearly, etc.)
Add Feature Metadata
In the Metadata section, add a These features will automatically appear in your pricing page.
features array to display plan features in your UI:Launch Development Server
Start the Application
Launch the development server:The application will start on
http://localhost:3000.Test the Application
- Open http://localhost:3000 in your browser
- Click Sign In to test Google OAuth
- Navigate to the pricing page to view your subscription plans
- Test the subscription flow with a test payment
Your application is now running locally with full subscription functionality!
Production Deployment
When you’re ready to deploy to production:Deploy to Vercel
Configure Environment Variables
During deployment, add all environment variables from your
.env.local file.Update OAuth Redirect URI
Add your production domain to Google OAuth:
- Go to Google Cloud Console
- Navigate to APIs & Services → Credentials
- Edit your OAuth 2.0 Client ID
- Add authorized redirect URI:
Alternative Platforms
You can also deploy to:- Netlify - Configure build command:
npm run build - Railway - Automatic Next.js detection
- Render - Use Next.js deployment preset
- Self-hosted - Run
npm run build && npm start
Ensure you configure environment variables and OAuth redirect URIs for whichever platform you choose.
Verify Deployment
Check that everything is working correctly:Database Tables Created
Database Tables Created
Run this command to view your database:Verify that
users, subscriptions, and payments tables exist.Webhook Function Active
Webhook Function Active
In Supabase, go to Edge Functions and verify that
dodo-webhook shows as deployed and healthy.Google OAuth Working
Google OAuth Working
Test signing in with Google. You should be redirected to Google’s consent screen and then back to your application.
Dodo Payments Connected
Dodo Payments Connected
Your pricing page should display products from Dodo Payments with the features you defined in metadata.
Webhooks Receiving Events
Webhooks Receiving Events
Make a test subscription and check Supabase logs to confirm webhook events are being received and processed.
Troubleshooting
Webhook deployment fails
Webhook deployment fails
- Verify you’re logged in:
supabase whoami - Check project reference ID is correct
- Ensure you have necessary permissions on the Supabase project
Google OAuth not working
Google OAuth not working
- Verify redirect URI matches exactly:
https://[project-ref].supabase.co/auth/v1/callback - Check that Google+ API is enabled
- Ensure Client ID and Secret are correctly configured in Supabase
Products not showing
Products not showing
- Verify
DODO_PAYMENTS_API_KEYis set correctly - Check that products are created in the correct environment (test/live)
- Ensure
DODO_PAYMENTS_ENVIRONMENTmatches your product environment
Database connection errors
Database connection errors
- Verify
DATABASE_URLconnection string is correct - Check that you replaced
[YOUR-PASSWORD]with your actual password - Ensure IP allowlist includes your deployment platform (if applicable)
Next Steps
Customize Your App
Learn how to customize the UI, add features, and brand your application
Manage Subscriptions
Understand subscription lifecycle and management features
API Reference
Explore available APIs and integration options
Webhooks Guide
Learn about webhook events and how to handle them
