When Payment fails in Magento the order statues is set to incomplete because it is waiting for the payment, so what is the best to integrate with and ERP system the orders when completed?
Is the Cron the only possible way? Do I really need to be asking Magento every hour if the orders are completed? Isn't there a event based api for this?
Thanks in advanced.
Yes Cron is the best way. Assuming that you are using many payments methods, like Skill or Paypal, the process is not immediate. Let's see this example:
1 - The user checkouts and selects PAYPAL 2 - The order is saved in Magento as PENDING - PAYMENT 3 - Imagine then that is Paypal the CARD is expired or not approved then the client goes for all this process of adding or changing another card to paypal, only after this change the client can finished the process
Until the payment is done, the order stays as PENDING PAYMENT
So with a CRON you can keep checking all orders and if this client actually finished the order, on the next CRON call the integration with the ERP can be made.
What also happens is that is the client gives up on paypal this order will stay pending forever. You need to decide what to do with this orders.