Contents

Chapter 1

Features

This chapter covers the core features and capabilities of Subscription Billing.

Features

  • Plan management (create, list, activate/deactivate)
  • Subscription lifecycle: trial → active → past_due → canceled
  • Mid-cycle plan changes with automatic proration
  • Trial periods with configurable duration
  • Grace periods for failed payments
  • Dunning workflow: retry → email → final warning → cancel
  • Billing cycle calculations (monthly, yearly, weekly)
  • Cancel at period end or immediately
  • Full event logging for audit trails
  • Python stdlib only — zero dependencies

Quick Start

bash
# Run the full lifecycle demo
python src/subscription_billing.py --action demo

# Create plans
python src/subscription_billing.py --action create-plan --name "Pro" --price 4999 --interval month

# Create a subscription with trial
python src/subscription_billing.py --action subscribe --customer cus_001 --plan plan_pro

# Upgrade plan with proration
python src/subscription_billing.py --action change-plan --sub-id sub_abc --new-plan plan_enterprise

# View dunning schedule
python src/subscription_billing.py --action dunning-schedule
Chapter 2

CLI Reference

Follow this guide to get Subscription Billing up and running in your environment.

CLI Reference

FlagDescription
--action, -aAction to perform (required)
--namePlan name
--pricePlan price in cents (4999 = $49.99)
--intervalBilling interval: month, year, week
--customerCustomer ID
--planPlan ID
--sub-idSubscription ID
--new-planNew plan ID for upgrades/downgrades
--no-trialSkip trial period
--immediateCancel immediately instead of at period end
--reasonCancellation reason
--data-dirData storage directory (default: ./billing_data)

Dunning Schedule

DayActionDescription
0retryImmediate retry — often temporary
3email_reminderUpdate your payment method
7retrySecond retry attempt
10final_warningSubscription will cancel in 4 days
14cancelAll retries exhausted
Chapter 3
🔒 Available in full product

License

You’ve reached the end of the free preview

Get the full Subscription Billing and unlock everything.

All Chapters

Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.

Full Tool Suite

Access all interactive tools with complete data, all workload profiles, and the full scenario library.

Source Files

Downloadable source code, configuration files, and working examples from every chapter.

Lifetime Updates

Free updates for life. Every new chapter, tool, and improvement included.

Buy Now — $29 →
📦 Free sample included — download another copy for the full product.
Subscription Billing v1.0.0 — Free Preview