Forward-Only Transition

A forward-only transition allows a record to move from an expected earlier state to a permitted later state without returning to a previous state or moving sideways. In this course, payment transitions use a conditional database UPDATE that changes the status only when the current status is PENDING, ensuring that competing webhook requests cannot both win.

Minimal example

sql
UPDATE payments
SET status = 'CAPTURED'
WHERE id = ?
AND status = 'PENDING';

Learn this concept

Lesson 8.3 · HMAC webhooks and payment sagas

Used in exercises

Exercise 8.4 · Payment processing service