.do
Business

products

Pricing products and SKUs for billing

products

Pricing product management for billing and subscriptions, including product catalog, SKUs, pricing strategies, and integration with plans.

Overview

The products primitive provides product definitions for billing systems, including SKUs, descriptions, metadata, and relationships to pricing plans and subscription models.

Parent Primitive: payments - Payment processing

Quick Example

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

// Create product
const saasProduct = await products.create({
  name: 'Platform Subscription',
  description: 'Access to the full platform',
  type: 'service',
  active: true,
  metadata: {
    category: 'saas',
    features: ['api-access', 'analytics', 'integrations'],
  },
})

// Create prices for product
const monthlyPrice = await plans.create({
  product: saasProduct.id,
  amount: 2999, // $29.99
  currency: 'usd',
  interval: 'month',
  nickname: 'Monthly Pro',
})

const yearlyPrice = await plans.create({
  product: saasProduct.id,
  amount: 29900, // $299/year (save $60)
  currency: 'usd',
  interval: 'year',
  nickname: 'Yearly Pro',
})

// Create product with metered billing
const apiProduct = await products.create({
  name: 'API Calls',
  description: 'Pay-per-use API access',
  type: 'service',
})

const meteredPrice = await plans.create({
  product: apiProduct.id,
  currency: 'usd',
  billingScheme: 'per_unit',
  unitAmount: 10, // $0.10 per API call
  recurring: {
    interval: 'month',
    usageType: 'metered',
  },
})

// Create product with tiers
const enterpriseProduct = await products.create({
  name: 'Enterprise Platform',
  description: 'Volume-based enterprise pricing',
})

const tieredPrice = await plans.create({
  product: enterpriseProduct.id,
  currency: 'usd',
  billingScheme: 'tiered',
  tiers: [
    { upTo: 100, unitAmount: 1000 }, // $10/seat for first 100
    { upTo: 500, unitAmount: 800 }, // $8/seat for 101-500
    { upTo: null, unitAmount: 500 }, // $5/seat for 500+
  ],
  recurring: {
    interval: 'month',
  },
})

// Subscribe customer
const subscription = await payments.createSubscription({
  customer: 'user-123',
  items: [{ price: monthlyPrice.id }],
})

// List products with prices
const productList = await products.list({
  active: true,
  expand: ['prices'],
})

productList.forEach((product) => {
  console.log(`${product.name}:`)
  product.prices.forEach((price) => {
    console.log(`  - ${price.nickname}: $${price.amount / 100}`)
  })
})

Core Capabilities

  • Product Catalog - Define billable products and services
  • SKU Management - Track product variants and codes
  • Pricing Integration - Link products to pricing plans
  • Metadata - Store product features and attributes
  • Product Types - Services, goods, or usage-based products

Access Methods

SDK

TypeScript/JavaScript library for product management

await products.create({ name: 'Platform Subscription', type: 'service' })

SDK Documentation

CLI

Command-line tool for product operations

do product create "Platform Subscription" --type service

CLI Documentation

API

REST/RPC endpoints for product management

curl -X POST https://api.do/v1/products -d '{"name":"Platform Subscription","type":"service"}'

API Documentation

MCP

Model Context Protocol for AI-driven product management

Create a product named "Platform Subscription" of type service

MCP Documentation

Parent Primitive

Sibling Primitives

  • plans - Subscription plan management
  • webhooks - Product event notifications
  • analytics - Product revenue analytics
  • user - User product access