🔍⌘K

Start typing to search docs.

Payments Module

1.0.0

Stripe billing helpers exposed via @app-factory/payments.

Stripe helpers

import {
  createCheckoutSession,
  createBillingPortalSession,
  syncStripeProducts,
} from '@app-factory/payments/stripe';
  • createCheckoutSession handles plan metadata, trial windows, and redirect URLs.
  • createBillingPortalSession links customers to Stripe Billing self-service.
  • syncStripeProducts seeds plans based on ops/pricing templates.

Webhooks

The payments package exposes a Next.js handler that validates signatures and routes events.

import { handleStripeWebhook } from '@app-factory/payments/webhooks';

export const POST = handleStripeWebhook({
  signingSecret: process.env.STRIPE_WEBHOOK_SECRET!,
});
  • Persists subscription state in the Supabase org_subscriptions table.
  • Emits telemetry for analytics dashboards.

Billing seed script

Seed Stripe plans
pnpm forge billing:seed --env staging --dry-run
  • Syncs Stripe products/prices and updates .env.generated.
  • Use --force to overwrite existing products when pricing changes.

Warning

Keep Stripe secrets in Doppler. Avoid storing them in .env.local files; the CLI will materialize secrets when needed.