Skip to main content
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

1

Free User

User creates account with free tier access
2

Trial (Optional)

User may start a premium trial period
3

Upgrade

User selects plan and provides payment method
4

Active Subscription

User has access to premium features
5

Renewal or Cancellation

Subscription auto-renews or user cancels

Organization Subscription

1

Create Organization

Admin creates new organization (free or paid)
2

Select Plan

Admin chooses Teams or Enterprise plan
3

Configure Seats

Admin sets initial user seat count
4

Payment Setup

Admin provides payment method and billing details
5

Manage Subscription

Admin can add seats, change plan, or cancel

Billing Models

Subscription Plans

Plan Features

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