Skip to main content

SPEC 011: Billing and Subscriptions

Status: DRAFT Priority: P0 Created: 2026-02-21 Approved: pending Repo(s): equa-web, equa-server

1. Feature Purpose

The Billing and Subscriptions module handles the commercial side of the Equa platform: subscription tier management, payment profile collection, checkout flows, coupon redemption, and waitlist positioning. It integrates with Chargify as the external payment processor and subscription lifecycle manager. The module enforces tier-based limits (e.g. member caps) across the platform and provides self-service upgrade/downgrade flows for organization admins.

2. Current State (Verified)

Frontend modules:
Frontend service layer:
Backend module:
Backend endpoints:

3. Data Model

Entities

Key Fields — MemberLimits

Key Fields — UserCoupons

Key Fields — Waitlists

Relationships

External Integration: Chargify

Chargify manages the canonical subscription state. The Equa backend syncs via:
  • API calls to Chargify for creating/updating subscriptions, applying coupons, and managing payment profiles.
  • Webhooks from Chargify for subscription lifecycle events (activation, renewal, cancellation, payment failure, dunning).
The local MemberLimits entity is updated when subscription tier changes are confirmed by Chargify.

4. API Endpoints

Served by equa-server/modules/api/src/endpoints/billing-endpoints.ts.

5. Frontend Components

Payments Module

Subscriptions Module

Routes

State Management

Payment and subscription state is split across two module stores. The payments store manages payment profiles, invoices, and checkout state. The subscriptions store manages the active subscription, tier details, and usage. Both sync with Chargify-backed API endpoints.

6. Business Rules and Validation

7. Acceptance Criteria

  • AC-1: User can view available subscription plans with pricing on the public pricing page
  • AC-2: User can add a payment profile (credit card) and complete checkout
  • AC-3: Subscription is created in Chargify and reflected in the Equa billing dashboard
  • AC-4: Organization member limit is enforced based on subscription tier
  • AC-5: User can upgrade subscription; change takes effect immediately with proration
  • AC-6: User can downgrade subscription; change takes effect at next billing cycle
  • AC-7: User can cancel subscription; access remains until period end
  • AC-8: Coupon codes apply correct discounts and prevent duplicate redemption
  • AC-9: Chargify webhooks are received, verified, and correctly update local subscription state
  • AC-10: Failed payments trigger appropriate user notifications and dunning flow
  • AC-11: Waitlist users can check their position and are notified when promoted
  • AC-12: Invoice history is accessible from the billing dashboard

8. Risks and Edge Cases

9. Dependencies