Imagen that you have a stored procedure in a database that you call from PHP. That procedure works like a transaction and selects/inserts data into the database. If it succeeds it commits, if it fails it rollbacks.
Now imagen that you need to store the same data in a external system via REST - in a transaction.
So if you run the stored procedure first and it commits you wont be able to rollback the database if the API call fails. If you run the API call first and it succeeds you wont be able to rollback the API call if stored procedure fails.
I'm in a situation where I need to update local database (SP) and two different API endpoints in one transaction in PHP.
Could anyone give advice on how this transaction is supposed to be managed?
Thanks!