Skip to content
State machine (FSM) templates

Subscription Lifecycle (State Machine)

Trial, active, past-due and cancelled states.

Template previewState machine (FSM)
Subscription lifecycle4 states · 6 transitions · 6 eventssubscribeexpirepayment_failedpayment_recovereddunning_exhaustedcancelTrialActivePastDueCancelledAll 4 states are reachable and every transition names states that exist.OKAll 4 states are reachable from `Trial`.OKEvery run from `Trial` can reach the final state.OKAll 6 transitions name states that exist, so every arrow in the figure is drawn.

Make it your own.

title "Subscription lifecycle"
state Trial
state Active
state PastDue
state Cancelled final
initial Trial
transition Trial -> Active on "subscribe"
transition Trial -> Cancelled on "expire"
transition Active -> PastDue on "payment_failed"
transition PastDue -> Active on "payment_recovered"
transition PastDue -> Cancelled on "dunning_exhausted"
transition Active -> Cancelled on "cancel"