Production-ready webhook handlers for Dodo Payments across multiple serverless platforms.
Choose your preferred serverless platform. Each folder contains a complete, ready-to-deploy implementation:
Each guide includes step-by-step setup with CLI installation, authentication, and deployment instructions.
Each implementation includes a webhook handler connected to a PostgreSQL database:
- Cloudflare, Vercel, Netlify use Neon - Serverless PostgreSQL with connection pooling
- Supabase uses Supabase PostgreSQL - Built-in database with your Supabase project
Both are optimized for serverless. You can also use any PostgreSQL database by providing a connection string (AWS RDS, self-hosted, etc.)
💡 First time? See the individual platform guides above for detailed prerequisites, CLI setup, and deployment instructions.
git clone https://github.com/dodopayments/cloud-functions.git
cd cloud-functionsUse your database provider's SQL editor to run schema.sql:
- Neon: Open SQL Editor → paste schema.sql → run
- Supabase: SQL Editor → New Query → paste schema.sql → run
Navigate to your preferred platform folder and follow its detailed setup guide:
Each guide includes:
- ✅ CLI installation & authentication
- ✅ Environment variable setup
- ✅ Deployment instructions
All implementations require PostgreSQL tables. Create them using your database provider's SQL editor:
For Neon (Cloudflare, Vercel, Netlify):
- Create a Neon account
- Create a new project
- Open the SQL Editor in Neon dashboard
- Copy and paste the entire contents of
schema.sql - Run the query
For Supabase:
- Create a Supabase account
- Create a new project
- Go to SQL Editor in your Supabase dashboard
- Create a new query
- Copy and paste the entire contents of
schema.sql - Run the query
The schema creates three tables:
customers- Customer information from Dodo Paymentssubscriptions- Subscription data and statuswebhook_events- Complete webhook event log for audit and retry purposes
All implementations process these Dodo Payments events:
| Event | Description |
|---|---|
subscription.active |
New subscription activated |
subscription.cancelled |
Subscription cancelled |
subscription.renewed |
Subscription renewed (updates billing date) |
Note: These implementations demonstrate handling three core subscription events (
subscription.active,subscription.cancelled,subscription.renewed) with minimal fields. You can easily extend them to support additional event types and fields based on your requirements.
All implementations use the dodopayments library for secure webhook verification.
DODO_PAYMENTS_API_KEY and DODO_PAYMENTS_WEBHOOK_KEY are required.
- ✅ Always verify signatures in production
- ✅ Use environment variables for secrets
- ✅ Enable HTTPS only
- ✅ Monitor webhook logs
- ✅ Set up error alerting
cloud-functions/
├── cloudflare/ # Cloudflare Workers implementation
│ ├── worker.ts
│ ├── wrangler.toml
│ ├── package.json
│ └── README.md
│
├── vercel/ # Vercel Functions implementation
│ ├── api/webhook/index.ts
│ ├── vercel.json
│ ├── package.json
│ └── README.md
│
├── netlify/ # Netlify Functions implementation
│ ├── functions/webhook.ts
│ ├── netlify.toml
│ ├── package.json
│ └── README.md
│
├── supabase/ # Supabase Edge Functions implementation
│ ├── functions/webhook/index.ts
│ ├── package.json
│ └── README.md
│
├── schema.sql # PostgreSQL database schema
└── README.md # This README file
Contributions welcome! Please feel free to submit a Pull Request.
- DodoPayments - Payment platform
- DodoPayments Docs - Official documentation
- Neon Database - Serverless PostgreSQL
- Cloudflare Workers
- Vercel Functions
- Netlify Functions
- Supabase Edge Functions
- DodoPayments: Support Portal
- Issues: GitHub Issues
Made with ❤️ for the DodoPayments community