using Magento 184.108.40.206. I did write an observer, after the order is placed I need to send data to an external CRM, I used the event sales_order_save_after. In order to know if the order has been paid, I check the order status: when using paypal, the execution of my observer is made 2 times, both with order status processing. My guess is Magento puts the order in processing status immediately when I'm been redirected to paypal.
Is there a way to have different order status in this case?
You can use the sales_order_state_change_before event which provides access to the order and check if the payment was processed or not. So, when the payment is processed, it will be fired again, which will allow you to manage the order processing status along with payment method.
You can update the order status after the paypal payment through the following event. No need to call any other even if not really required
<checkout_onepage_controller_success_action> <observers> <Your_Module_Name> <class>your_module_name/observer</class> <method>automaticallyInvoiceShipCompleteOrder</method> <type>singleton</type> </Your_Module_Name> </observers> </checkout_onepage_controller_success_action>