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
Pausedstate if you let customers freeze billing without losing data. - Change
3 failed retriesand14 days with no cardto the numbers in your billing settings; these are the two values support gets asked about most. - Add
Active --> Active : plan changeas a self-transition if upgrades and downgrades need to appear in the diagram. - Use a composite state to group
ActiveandPastDueasBillablefor 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.