The Billing library (
@bitwarden/billing) represents the public API of the Billing team at Bitwarden. It handles subscription management, payment processing, and billing operations for both individual and organization accounts.Overview
The Billing library provides services and models for managing Bitwarden subscriptions across different product tiers. It handles payment method management, subscription upgrades and downgrades, invoice history, and billing-related user interfaces.Core Concepts
Subscription Types
Bitwarden offers multiple subscription tiers:Individual Plans
Personal Premium and Family Organization subscriptions
Business Plans
Teams and Enterprise organization subscriptions
Free Tier
Limited features for individual users and small teams
Trial Periods
Time-limited evaluation of premium features
Payment Management
The library handles various payment-related operations:- Payment Methods - Credit cards, PayPal, bank transfers
- Invoicing - Invoice generation and history
- Tax Handling - VAT, sales tax, and tax ID management
- Credits - Account credits and promotional codes
Organization Billing
For organization subscriptions, the library manages:- Seat Management - User seat allocation and auto-scaling
- Storage Add-ons - Additional storage beyond plan limits
- Billing Cycles - Monthly and annual billing
- Payment Ownership - Designated billing administrators
Directory Structure
The Billing library is currently a minimal library structure. The team is actively developing billing services that will be exported through this public API. Implementation details are primarily in the web vault and server components.
Subscription Lifecycle
Individual Subscription
Organization Subscription
Billing Models
Subscription Plans
Plan Features
| Plan | Users | Storage | Collections | Premium Features |
|---|---|---|---|---|
| Free | 1 | 10 MB | Unlimited | Limited |
| Premium | 1 | 1 GB | Unlimited | Full |
| Family | 6 | 1 GB shared | Unlimited | Full |
| Teams | Variable | 1 GB per user | Unlimited | Full + Admin |
| Enterprise | Variable | 1 GB per user | Unlimited | Full + Advanced Admin |
Seat-Based Billing
Organization subscriptions use seat-based pricing:Payment Operations
Adding Payment Method
Processing Subscription Change
Invoice Management
Billing Events
The billing system handles various events:Subscription Events
- subscription.created - New subscription started
- subscription.updated - Subscription plan or seats changed
- subscription.cancelled - Subscription cancelled
- subscription.renewed - Subscription successfully renewed
- subscription.expired - Subscription expired (payment failed)
Payment Events
- payment.succeeded - Payment processed successfully
- payment.failed - Payment failed (retry logic)
- payment_method.added - New payment method added
- payment_method.expired - Payment method expired
Invoice Events
- invoice.created - New invoice generated
- invoice.paid - Invoice paid successfully
- invoice.payment_failed - Invoice payment failed
- invoice.voided - Invoice voided/cancelled
Tax Handling
VAT and Tax ID
Tax Exemption
Some organizations may qualify for tax exemption:Credits and Promotions
Account Credits
Promotional Codes
Domain Boundaries
Billing vs. Admin Console: The Admin Console creates organizations and manages users, but Billing handles the financial aspects (subscriptions, payments, invoices). When creating an organization, Admin Console works with Billing to set up the subscription.
Billing vs. Platform: Billing relies on Platform services for API communication, state management, and notification handling. Billing events trigger platform notifications to users.
Billing vs. Subscription Service: The Billing library focuses on payment operations and invoice management. The subscription data itself (active plan, features, limits) may be stored and accessed through platform-level subscription services.
Usage Example
Self-Hosted Billing
For self-hosted Bitwarden instances, billing may work differently:- License Keys - Self-hosted uses license key validation instead of subscription API
- Offline Licensing - License files can be uploaded manually
- Organization Licenses - Separate licensing for self-hosted organizations
- Renewal Process - License renewal through Bitwarden portal
Related Libraries
- @bitwarden/admin-console - Organization creation and management
- @bitwarden/platform - API communication and state management
- @bitwarden/subscription - Subscription feature access and limits