I am using third-party integration for on-site credit/debit card payment functionality.

With a purpose to audit transactions and as well as for order status flow customization, I need to save customer and payment related details in custom table.

But whenever, any error is detected from third-party gateway(i.e. Insufficient balance) while placing an order and thus invoking authorize/capture request to third party gateway, Magento rollbacks transaction including my custom table audit entries. I know, reverting transaction to its begin stage is a perfect thing for data integrity and according to standard Magento architecture, but I just do not want to get my custom entries in my custom table to get rolled back.

How do I prevent Magento from doing this?

Can observer(dispatchEvent) be used to audit data as I am not sure if observer actually bypasses the standard transaction rollback call?


  1. dispatching custom using Mage::dispatchEvent, is of no help
  2. direct query(core/resource) to insert records will also get rolled back in case of any error/exception before order successfully gets placed.

1 Answer 1


Everything in between starting and rolling back the transaction will be rolled back as well, so you have the choice to either save your custom data before or after the transaction. Unfortunately the "save_before" and "save_after" events are triggered within the transaction and the "commit_after" event is only triggered after a successful commit. There is no such thing as a "rollback _after" event.

What should work is the sales_model_service_quote_submit_failure event (See Mage_Sales_Model_Service_Quote).

You can observe this together with sales_model_service_quote_submit_after with the same observer (both receive the same parameters and always only one of them is dispatched)

  • I will try your solution for sure...
    – SOlearner
    Commented Sep 4, 2015 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.