.do
Business

plans

Subscription plan management and pricing

plans

Subscription plan management with recurring billing, metered usage, tiered pricing, and plan upgrades/downgrades for SaaS businesses.

Overview

The plans primitive provides subscription plan management including pricing tiers, billing intervals, feature gating, usage limits, and automated plan transitions.

Parent Primitive: payments - Payment processing

Quick Example

import { plans, payments } from 'sdk.do'

// Create pricing plan
const proPlan = await plans.create({
  name: 'Pro Plan',
  amount: 2999, // $29.99
  currency: 'usd',
  interval: 'month',
  features: ['Unlimited projects', 'Advanced analytics', 'Priority support', 'API access'],
  limits: {
    users: 10,
    storage: 100, // GB
    apiCalls: 10000,
  },
})

// Create tiered plan
const enterprisePlan = await plans.create({
  name: 'Enterprise',
  currency: 'usd',
  interval: 'month',
  tiers: [
    { upTo: 10, unitAmount: 5000 }, // $50/user for first 10
    { upTo: 50, unitAmount: 4000 }, // $40/user for 11-50
    { upTo: null, unitAmount: 3000 }, // $30/user for 50+
  ],
  billingScheme: 'tiered',
})

// Subscribe customer to plan
const subscription = await payments.createSubscription({
  customer: 'user-123',
  items: [{ plan: proPlan.id }],
  trialPeriodDays: 14,
})

// Upgrade plan
await subscription.update({
  items: [{ plan: enterprisePlan.id }],
  prorationBehavior: 'create_prorations',
})

// Check plan limits
const usage = await plans.checkUsage('user-123', {
  plan: proPlan.id,
})

if (usage.apiCalls >= proPlan.limits.apiCalls) {
  throw new Error('API call limit reached')
}

Core Capabilities

  • Recurring Billing - Monthly, yearly, custom intervals
  • Metered Usage - Pay-per-use pricing models
  • Tiered Pricing - Volume-based pricing tiers
  • Feature Gating - Control access by plan
  • Usage Limits - Enforce plan limits
  • Plan Changes - Upgrades, downgrades, prorations

Access Methods

SDK

TypeScript/JavaScript library for plan management

await plans.create({ name: 'Pro Plan', amount: 2999, interval: 'month' })

SDK Documentation

CLI

Command-line tool for plan operations

do plan create "Pro Plan" --amount 29.99 --interval month

CLI Documentation

API

REST/RPC endpoints for plan management

curl -X POST https://api.do/v1/plans -d '{"name":"Pro Plan","amount":2999,"interval":"month"}'

API Documentation

MCP

Model Context Protocol for AI-driven plan management

Create a subscription plan named "Pro Plan" with monthly billing at $29.99

MCP Documentation

Parent Primitive

Sibling Primitives

  • webhooks - Subscription event notifications
  • analytics - Subscription analytics and metrics
  • user - User subscription management