Mermaid exampleState Diagram

SaaS Subscription Lifecycle State Diagram

A subscription lifecycle diagram is the shared contract between billing, product, and support. It answers the questions that cause the most tickets: what happens when a card fails, how long a canceled account keeps its data, and whether a trial can be revived.

  • subscription lifecycle state diagram
  • saas billing states
  • dunning flow diagram
  • trial to paid state machine
SaaS Subscription Lifecycle State Diagram

sign up

card added and first charge

14 days with no card

renewal charge fails

retry succeeds

3 failed retries

user cancels

reactivates within 30 days

Past due

Trial

Active

Expired

Canceled

Open in editor → 12 linesrenders in GitHub, Notion, Obsidian

Mermaid code

stateDiagram-v2
    state "Past due" as PastDue
    [*] --> Trial : sign up
    Trial --> Active : card added and first charge
    Trial --> Expired : 14 days with no card
    Active --> PastDue : renewal charge fails
    PastDue --> Active : retry succeeds
    PastDue --> Canceled : 3 failed retries
    Active --> Canceled : user cancels
    Canceled --> Active : reactivates within 30 days
    Canceled --> [*]
    Expired --> [*]

Paste this into any tool that renders Mermaid, or into the editor to change the theme and export PNG or SVG. Syntax reference: State Diagram guide.

What this diagram shows

This example has two paths out of Trial: a successful first charge moves the account to Active, and 14 days without a card sends it to Expired. The PastDue state is the dunning window; retry succeeds returns to Active, while three failures end in Canceled. The Canceled --> Active edge documents the 30-day reactivation window so engineers do not hard-delete data on cancel.

How to adapt it

  • Add a Paused state if you let customers freeze billing without losing data.
  • Change 3 failed retries and 14 days with no card to the numbers in your billing settings; these are the two values support gets asked about most.
  • Add Active --> Active : plan change as a self-transition if upgrades and downgrades need to appear in the diagram.
  • Use a composite state to group Active and PastDue as Billable for finance reporting.

FAQ

Why is "Expired" separate from "Canceled"?

An expired trial never paid, so it usually has no invoices, no refund questions, and a shorter data retention period. Keeping it separate lets the billing code and the retention policy treat the two differently.

How do I show how long each state lasts?

Put the duration in the transition label, as this diagram does with 14 days with no card. For a per-state note, use note right of PastDue : retries on day 1, 3, 7.

Should reactivation go back to Trial or to Active?

Back to Active, because the customer has already paid once. A new trial would let the same person repeat the free period, which most billing policies disallow.