All or nothingadvanced
A sequence of writes has to either all happen or none of them, because the state in between is one where the money has left one account and not arrived at the other.
The debit succeeded. The credit threw. The money is now nowhere. Build the thing that makes a sequence of writes either all happen or none of them.
A failed transfer leaves every balance exactly where it started.
Published in full, before you start — every point is one of these and there is nothing else. Each one runs your code; it is not a search for keywords.
A sequence of writes has to either all happen or none of them, because the state in between is one where the money has left one account and not arrived at the other.
Network calls fail. Code that assumes they succeed turns a slow connection into a blank screen with no explanation.