Skip to main content
This guide covers deploying the webhook handler to Supabase Edge Functions, configuring Dodo Payments webhooks, and launching your application.

Deploy Webhook Handler

The webhook handler processes subscription events from Dodo Payments in real-time.
1

Login to Supabase CLI

Authenticate with Supabase:
npx supabase login
This will open your browser to complete authentication.
2

Find Your Project Reference

Your project reference ID is in your Supabase project URL:
https://[your-project-ref].supabase.co
            ^^^^^^^^^^^^^^^^
For example, if your URL is https://abcdefgh12345678.supabase.co, your project reference is abcdefgh12345678.
3

Deploy the Webhook Function

Deploy the Dodo webhook handler to your Supabase project:
npm run deploy:webhook -- --project-ref your-project-ref
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.
4

Verify Deployment

After successful deployment, you’ll see output like:
Deployed Function dodo-webhook on project your-project-ref
URL: https://your-project-ref.supabase.co/functions/v1/dodo-webhook
Copy this URL for the next step.

Configure Dodo Payments Webhook

1

Add Webhook Endpoint

  1. Go to your Dodo Payments Dashboard
  2. Navigate to SettingsWebhooks
  3. Click Add Endpoint
  4. Enter your webhook URL:
    https://[your-project-ref].supabase.co/functions/v1/dodo-webhook
    
2

Select Events

Enable these webhook events to sync subscription data:
  • payment.succeeded
  • payment.failed
  • subscription.created
  • subscription.updated
  • subscription.cancelled
  • subscription.renewed
You can select “All events” to automatically receive new event types as Dodo Payments adds them.
3

Save Configuration

Click Save to activate the webhook. Dodo Payments will now send real-time events to your application.

Create Subscription Products

Before launching, create at least one subscription product in Dodo Payments.
1

Create Product

  1. In your Dodo Payments dashboard, go to Products
  2. Click Create Product
  3. Fill in the basic information:
    • Product name (e.g., “Pro Plan”)
    • Description
    • Price
    • Billing cycle (monthly, yearly, etc.)
2

Add Feature Metadata

In the Metadata section, add a features array to display plan features in your UI:
{
  "features": [
    "Unlimited projects",
    "Priority support",
    "Advanced analytics",
    "Custom branding"
  ]
}
These features will automatically appear in your pricing page.
3

Save Product

Click Save to create the product. Repeat for additional pricing tiers if needed.

Launch Development Server

1

Start the Application

Launch the development server:
npm run dev
The application will start on http://localhost:3000.
2

Test the Application

  1. Open http://localhost:3000 in your browser
  2. Click Sign In to test Google OAuth
  3. Navigate to the pricing page to view your subscription plans
  4. 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

1

Quick Deploy

Use the one-click deploy button:Deploy with Vercel
2

Configure Environment Variables

During deployment, add all environment variables from your .env.local file.
For production, change DODO_PAYMENTS_ENVIRONMENT from test_mode to live_mode.
3

Update OAuth Redirect URI

Add your production domain to Google OAuth:
  1. Go to Google Cloud Console
  2. Navigate to APIs & ServicesCredentials
  3. Edit your OAuth 2.0 Client ID
  4. Add authorized redirect URI:
    https://your-project-ref.supabase.co/auth/v1/callback
    
4

Test Production Deployment

  1. Visit your deployed URL
  2. Test authentication flow
  3. Process a real subscription
  4. Verify webhook events in Supabase logs

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:
Run this command to view your database:
npm run db:studio
Verify that users, subscriptions, and payments tables exist.
In Supabase, go to Edge Functions and verify that dodo-webhook shows as deployed and healthy.
Test signing in with Google. You should be redirected to Google’s consent screen and then back to your application.
Your pricing page should display products from Dodo Payments with the features you defined in metadata.
Make a test subscription and check Supabase logs to confirm webhook events are being received and processed.

Troubleshooting

  • Verify you’re logged in: supabase whoami
  • Check project reference ID is correct
  • Ensure you have necessary permissions on the Supabase project
  • 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
  • Verify DODO_PAYMENTS_API_KEY is set correctly
  • Check that products are created in the correct environment (test/live)
  • Ensure DODO_PAYMENTS_ENVIRONMENT matches your product environment
  • Verify DATABASE_URL connection 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

Build docs developers (and LLMs) love