Sage Pay orphan transactions

Written by: Pablo S. Benitez

The concept is simple, all Sage Pay transactions started by a customer are saved in a Magento table, if everything goes as expected and the customer actually completes the order that transaction will be linked to the Magento Order, that transaction has a "parent" Magento order, so far so good. 
 
Then we have transactions that do not complete, this could be caused either by the customer abandoning the order at some point (3DS check in example), a declined transaction (rejected payment), or by an error caused when Magento saves the order. These cases are considered "orphans", because there's a Sage Pay transaction in your "My Sage Pay" account, and no order in Magento.
 
So, "orphan" transactions are not always a bad thing, actually, if you keep an eye on that list, you can use the information to recover lost sales, in example you could phone those customers that abandon the order at 3DS check and enter the order manually. 
 
Screen Shot 2013-07-01 at 2.47.16 PM.png
 
The worst case here, and the one that needs more attention, is to have "orphan" Sage Pay orders in OK status, this means that the customer completed the checkout process but for some reason the order has not been saved in Magento. These issues are usually caused by timeouts or communication issues (when Sage Pay posts confirmation details to Magento in background) or even by coding erros that prevent the order from being saved.
 
Fortunately, Sage Pay Suite (even the free version) has a "Profiler" tool that can be enabled by a setting, this tool, will log all the order saving process, pretty much as Magento's Profiler does, this come very handy at detecting timeout bottlenecks and other errors.
In order to enable the "Profiler" you need to go to System > Configuration > Sales > Sage Pay > GLOBAL and set "Profile requests" to Yes.
 
Configuration   System   Magento Admin.png
 
This will only affect requests to our callback urls so it won't slowdown your store's performance, its not recommended to leave this on though, its just a debugging tool.
 
After you enable the "Profiler", you will start seeing profile logs under this folder $PATH_TO_MAGENTO$/var/log/SagePaySuite/PROFILER/Year-Month-Day.Hour-Minute-Second_sagepaysuite_$controllerName$_$controllerAction$.txt you should be able to open any of these files on any text reader, you should always look for the biggest one, for example on the one shown below:
 
Screen Shot 2013-07-01 at 3.04.31 PM.png
 
For example, this full request was 3.6 seconds, its okay, if you see a bigger number, something is not correct, for example, a module could be delaying the process, here is a good tip on how to improve the order saving process.
 
What can you do with Orphan transactions aparte from contacting the customer to be able to not lose the sale.
Screen Shot 2013-07-01 at 3.09.22 PM.png
 
Recover [beta]
This option would let you create an order from an orphan transaction, for example, if you have an approved payment orphan this would let you create the order in Magento so your records match. It says "[beta]" because its yet a work in progress.
 
VOID
This will trigger a VOID transaction on this Sage Pay transaction.
 
Delete
This option will just delete the row from the local database table.
 
Sync from API
This option will attempt to download updated information from Sage Pay's admin & reporting API, for this to work you have to fill in correct My Sage Pay details under System > Configuration > Sales > Sage Pay > Sage Pay Suite [Backend - Reporting & Third Man API Integration]
 
Last but not least, Sage Pay Suite does not tell Magento to save the order unless payment has been successfully taken, this is because saving the order early on would cause other problems for not completed orders, like inventory issues (Magento reserves stock upon order creation) and administrative mistakes (shipping orders that have not actually been paid). This is why our module is built the way it is.
 
Bottom line, pay attention to the "Orphan" transaction list notifications, as it will not only help you spot any issues but could also help you recover a few sales. And keep in mind that we offer free forum based support (same business day) to the free Sage Pay Suite CE version.

NEWSLETTER

Subscribe to our newsletter to receive emails and useful news articles