Skip to content

@venturekit-pro/billing

Terminal window
npm install @venturekit-pro/billing@dev
import { definePlans } from '@venturekit-pro/billing';
const plans = definePlans([
{
id: 'free', name: 'Free',
price: 0, currency: 'USD', interval: 'month', active: true,
features: [
{ featureKey: 'projects', enabled: true, limit: 3, description: 'Projects' },
{ featureKey: 'support', enabled: false, description: 'Support' },
],
},
{
id: 'pro', name: 'Pro',
price: 2900, currency: 'USD', interval: 'month', active: true,
features: [
{ featureKey: 'projects', enabled: true, limit: 50, description: 'Projects' },
{ featureKey: 'support', enabled: true, description: 'Support' },
],
},
]);
import { getFeatureLimit, hasFeature } from '@venturekit-pro/billing';
const freePlan = plans.find(p => p.id === 'free')!;
getFeatureLimit(freePlan, 'projects'); // → 3
hasFeature(freePlan, 'support'); // → false
import { mapUsageToLineItems } from '@venturekit-pro/billing';
// (plan, usage) — usage is a Record<featureKey, quantity>
const lineItems = mapUsageToLineItems(plan, { projects: 12, apiRequests: 8500 });
import { getBillingMigrationsDir } from '@venturekit-pro/billing';
const dir = getBillingMigrationsDir(); // Path to billing SQL migrations
  • PlanDefinition, PlanFeature — plan configuration types
  • @venturekit/core — required