How best to handle Business Transactions


#1

I am curious in others might be handling Business Transactions, meaning for example, you have an automation that has 2 steps within an Transaction. 1st step processes a Credit Card and once that has completed successfully, then the 2nd step is to update a SQL Database, but in the case that 1st step completes, but 2nd step fails - how does or should the automation handle this failure scenario…?
Obviously, one cannot back-out nor reverse the 1st step, so overall, how does the automation or process handle the transaction?


#2

We use a state machine to handle things like this. You can define transitions between stages and use these to recover from failures. For example, if stage 2 fails you wouldn’t go back to stage 1. You could go to a recovery stage or attempt the second stage again.