Payments Module
1.0.0Stripe billing helpers exposed via @app-factory/payments.
On this page
Stripe helpers
import {
createCheckoutSession,
createBillingPortalSession,
syncStripeProducts,
} from '@app-factory/payments/stripe';
createCheckoutSessionhandles plan metadata, trial windows, and redirect URLs.createBillingPortalSessionlinks customers to Stripe Billing self-service.syncStripeProductsseeds plans based onops/pricingtemplates.
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_subscriptionstable. - 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
--forceto 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.