메인 콘텐츠로 건너뛰기

Overview

The Next.js minimal boilerplate provides a ready-to-use starting point for integrating Dodo Payments with your Next.js application. This template includes checkout sessions, webhook handling, customer portal, and modern UI components to help you start accepting payments quickly.
This boilerplate uses Next.js 16 App Router with TypeScript, Tailwind CSS 4, and the @dodopayments/nextjs adapter.

Features

  • Quick Setup - Get started in under 5 minutes
  • Payment Integration - Pre-configured checkout flow using @dodopayments/nextjs
  • Modern UI - Clean, dark-themed pricing page with Tailwind CSS
  • Webhook Handler - Ready-to-use webhook endpoint for payment events
  • Customer Portal - One-click subscription management
  • TypeScript - Fully typed with minimal, focused types
  • Pre-filled Checkout - Demonstrates passing customer data to improve UX

Prerequisites

Before you begin, make sure you have:
  • Node.js 20.9+ (required for Next.js 16)
  • Dodo Payments account (to access API and Webhook Keys from dashboard)

Quick Start

1

Clone the Repository

2

Install Dependencies

3

Get API Credentials

Sign up at Dodo Payments and get your credentials from the dashboard:
Make sure you’re in Test Mode while developing!
4

Configure Environment Variables

Create a .env file in the root directory:
Update the values with your Dodo Payments credentials:
Never commit your .env file to version control. It’s already included in .gitignore.
5

Add Your Products

Update src/lib/products.ts with your actual product IDs from Dodo Payments:
6

Run the Development Server

Open http://localhost:3000 to see your pricing page!

Project Structure

Customization

Update Product Information

Edit src/lib/products.ts to modify:
  • Product IDs (from your Dodo dashboard)
  • Pricing
  • Features
  • Descriptions

Pre-fill Customer Data

In src/app/components/ProductCard.tsx, replace the hardcoded values with your actual user data:

Update Customer Portal

In src/app/components/Header.tsx, replace the hardcoded customer ID:
You can complete a test purchase to get the customer ID for testing.

Webhook Events

The boilerplate demonstrates handling two webhook events in src/app/api/webhook/route.ts:
  • onSubscriptionActive - Triggered when a subscription becomes active
  • onPaymentSucceeded - Triggered when a payment is successful
Add your business logic inside these handlers:
Add more webhook events as needed. For local development, you can use tools like ngrok to create a secure tunnel to your local server and use it as your webhook URL.

Deployment

Build for Production

Deploy to Vercel

[ Deploy with Vercel ](https://vercel.com/new/clone?repository-url=https://github.com/dodopayments/dodo-nextjs-minimal-boilerplate) Don’t forget to add your environment variables in the Vercel dashboard!

Update Webhook URL

After deploying, update your webhook URL in the Dodo Payments Dashboard:

Troubleshooting

Delete node_modules and reinstall dependencies:
Common causes:
  • Invalid product ID - verify it exists in your Dodo dashboard
  • Wrong API key or environment setting in .env
  • Check browser console and terminal for errors
For local testing, use ngrok to expose your server:
Update the webhook URL in your Dodo dashboard to the ngrok URL. Remember to update your .env file with the correct webhook verification key.

Learn More

Support

Need help with the boilerplate?
마지막 수정일 2026년 5월 28일