Documentation

Configuration

Learn how to configure payment providers and plans in your application.

Payment Configuration

All payment configuration is managed in config/index.ts. This centralized configuration makes it easy to manage your payment settings across your entire application.

Selecting a Payment Provider

Set your payment provider in the payments.provider field:

config/index.ts
export const config = {
  // ... other config
  payments: {
    provider: "stripe", // Can be: stripe, lemonsqueezy, dodopayments, polar
    plans: {
      // Your pricing plans
    },
  },
} as const satisfies Config;

Defining Pricing Plans

Define your pricing plans in the payments.plans object. Each plan can have multiple price options with different billing frequencies:

config/index.ts
export const config = {
  payments: {
    provider: "stripe",
    plans: {
     // ...other configuration options

      // Subscription plans
      pro: {
        recommended: false,
        prices: [
          {
            type: "subscription",
            productId: process.env.NEXT_PUBLIC_PRICE_ID_PRO_MONTHLY as string,
            amount: 10,
            currency: "USD",
            interval: "month",
          },
          {
            type: "subscription",
            productId: process.env.NEXT_PUBLIC_PRICE_ID_PRO_YEARLY as string,
            amount: 90,
            currency: "USD",
            interval: "year",
          },
        ],
      },
      // ...other configuration options
    },
  },
};

Price Configuration Options

Each price in your plans can have the following properties:

Required Fields

  • type: Either "one-time" or "recurring"
  • productId: The price/product ID from your payment provider (stored in environment variables)
  • amount: The price amount in the currency's standard unit (e.g., 10 means $10 USD, not 10 cents)
  • currency: ISO currency code (e.g., "USD", "EUR", "GBP")

Optional Fields

  • interval: For subscriptions - "month", "year", or "week" (default: "month")
  • seats: For seat-based pricing
    • min: Minimum number of seats
    • max: Maximum number of seats

Multi-Currency Support

You can define the same plan with prices in different currencies:

pro: {
  recommended: true,
  prices: [
    {
      type: "subscription",
      productId: process.env.NEXT_PUBLIC_PRICE_ID_PRO_USD as string,
      amount: 19,
      currency: "USD",
      interval: "month",
    },
    {
      type: "subscription",
      productId: process.env.NEXT_PUBLIC_PRICE_ID_PRO_EUR as string,
      amount: 17,
      currency: "EUR",
      interval: "month",
    },
  ],
},

The system will automatically select the appropriate price based on the user's locale setting. See locale

Environment Variables

Store your product/price IDs in environment variables to keep them secure and allow different values for development and production:

.env.local
NEXT_PUBLIC_PRICE_ID_PRO_MONTHLY=price_xxxxx
NEXT_PUBLIC_PRICE_ID_PRO_YEARLY=price_xxxxx
NEXT_PUBLIC_PRICE_ID_LIFETIME=price_xxxxx

Billing for Organizations vs Users

Configure whether billing applies to organizations or individual users:

config/index.ts
export const config = {
  organizations: {
    enable: true,
    // Enable billing for organizations
    enableBilling: true,
  },
  users: {
    // Enable billing for individual users
    enableBilling: false,
  },
};

Displaying Plans

Plans configured in config/index.ts are automatically available in your pricing components. The system will:

  1. Filter prices by the user's selected currency
  2. Mark the recommended plan
  3. Support seat-based quantity selection
  4. Handle trial periods (if supported by the provider)