Billing engine

State Machine Demo

One order, three states, one immutable trail. In-memory only.

Order ID
BLG-1042
Customer
Acme Retail
Total
Rp 1.500.000
OPEN
Payments
Outstanding balance
Rp 1.500.000
Paid to date
Rp 0
Payment records

No payments recorded.

State machine
OPEN
→
PAID
→
CLOSED
  • · Payments only while OPEN
  • · Close only from PAID
  • · Reversal only from PAID, never after CLOSED
  • · Reversal always requires a reason
Audit trail — immutable
TimestampActorFrom → ToReason
No state changes yet.