A sequence of steps across services cannot be rolled back, so each step has a compensating action that undoes its effect after the fact.
reserve stock → release stock
charge card → refund charge
book courier → cancel booking
step 3 fails:
run compensations for 2 and 1, in reverse order.
what this is NOT:
atomic — there is a window where the card is
charged and the stock is released
invisible — the customer may see the refund
guaranteed — a compensation can fail too
The compensations are business decisions rather than technical ones, and they are the hard part: a refund is not the inverse of a charge, because it is visible on a statement and may attract a fee. Some steps have no compensation at all — an email cannot be unsent — which means the ordering must put the irreversible steps last. A saga that fails during compensation needs a human, which should be a designed path rather than a surprise.