Payments
Drop-in pricing page with checkout, subscription management and webhook-synced state — powered by Dodo Payments and Zod. Configure your plans and ship.
Preview
.env before installingThe CLI checks for these at install time — missing values mean the database step gets skipped, and the feature won't work until it's added.
DATABASE_URLrequiredPostgreSQL connection string.
e.g. postgresql://user:pass@localhost:5432/mydbDODO_PAYMENTS_API_KEYrequiredDodo API key. Get it from your Dodo dashboard →
DODO_PAYMENTS_WEBHOOK_KEYrequiredWebhook signing secret. Set up your webhook →
DODO_PAYMENTS_RETURN_URLrequiredPost-checkout redirect URL.
e.g. http://localhost:3000/checkout/successDODO_PAYMENTS_ENVIRONMENTrequiredtest_mode or live_mode.
e.g. test_mode
Install via CLI
npx feature101@latest add paymentsPostInstall Guides
- 01Visit
/pricingto see the checkout flow, pricing page, and webhook handler in action - 02Fill in your product IDs in features
/payments/payment.config.ts - 03Register your products & webhook in the Dodo dashboard pointing to POST
/api/webhook/dodo-payments
Data Flow
What the user clicks and types.
Updates the screen instantly, before the server replies.
Validates and saves the change securely.
Your data, permanently written to the database.
What the user clicks and types.
Updates the screen instantly, before the server replies.
Validates and saves the change securely.
Your data, permanently written to the database.
Files
import { Checkout } from "@dodopayments/nextjs";
// This route handler exists for direct and external integrations
// (e.g. mobile clients, third-party tools, or future use cases that
// can't use server actions). The payments primitive itself calls the
// Dodo SDK directly via createCheckoutSessionAction — this file is
// not in that path.
export const POST = Checkout({
bearerToken: process.env.DODO_PAYMENTS_API_KEY!,
returnUrl: process.env.DODO_PAYMENTS_RETURN_URL,
environment: process.env.DODO_PAYMENTS_ENVIRONMENT as
| "live_mode"
| "test_mode"
| undefined,
type: "session",
});