Documentation
Payments

One Time Payment

Charge once for non-recurring purchases.

AI skill for one time payment

Prompt: Type /payments in your Copilot / Cursor or other chat to use skill with the provided context.
/payments Update one-time payment configurations or payment callbacks.

Use cases

Configure plans

Enable one-time payments

Open src/config/app.ts and set billing.oneTime.enabled: true.

Add one-time payment plans

Under oneTime.items, add your one-time payment plans with their respective descriptions, features, and pricing details.

Plan properties

  • id — Stripe product ID
  • name — Display name for the plan
  • description — Brief description of the plan
  • features — List of features included in the plan. Will be displayed on the pricing page.
  • prices — List of pricing options for the plan:
    • priceId — Stripe product price ID
    • checkoutUrl — URL for the checkout page. Add priceId or checkoutUrl, not both.
    • amount — Billing amount
    • currency — Billing currency

Examples

Guest checkout (Authentication not required)

  • Set authRequired: false to allow users to pay for a product as a guest.
  • After a successful payment, the user will be redirected to src/app/[locale]/(marketing)/purchase/thank-you/page.tsx.
  • The system will automatically send an email confirmation containing the purchase details.
src/config/app.ts
oneTime: {
  enabled: true,
  authRequired: false,
  items: [
    {
      id: 'prod_UANKURkKhIfBSp',
      name: 'Basic',
      description: 'Basic usage with no recurring charge',
      features: [
        'SaaS Next.js v16 starter kit',
        'Authentication and admin panel',
        'AI context for Cursor / Copilot / Claude',
        'Integrate payments or credits via stripe',
        'Shadcn and Tailwind UI',
        'Easy deployment to a VPS via Github',
        'Email support',
        'Lifetime updates',
      ],
      prices: [
        {
          priceId: 'price_1TC2ZmEG4PIIRhjwkdfPZ62U',
          amount: 99,
          currency: 'usd',
        },
      ],
    },
  ],
},

Authentication required

  • Set authRequired: true if you want the user to log in before purchasing.
  • After logging in, the user will be redirected to the checkout page at /dashboard/billings/subscription.
  • Following a successful payment, the user will be returned back to the dashboard.
  • The system will send an email with purchase confirmation details.
  • The payment transaction will be tracked and visible under /dashboard/billings/transactions.

Payment callbacks

You can add your callbacks to Stripe payment events to implement extra logic (e.g., 3rd party API calls, logging, metadata updates). Review the callback service in src/features/common/payments/service/payment-callback.service.ts.

One-Time Purchase Success

Called after a one-time purchase is completed. Add custom logic here: webhooks, CRM updates, 3rd-party integrations, etc.

export async function onOneTimePurchaseSuccess(
  payload: OneTimePurchaseSuccessPayload,
): Promise<void> {
  // Available fields in payload:
  // productId, productName, name, amountText, isGuest, userId
  console.log('[one-time purchase] success', payload);
}

Emails

The system automatically sends emails based on one-time purchase lifecycle events.

  • One-Time Purchase Success: src/shared/emails/one-time-purchase.tsx

FAQ

On this page