I have a custom extension that uses sales_order_save_after basically i want to create an invoice after the customer put a payment data , the problem is the order seems not been created at so i got an error like this:

Call to a member function getAdditionalInformation() on null in vendor/magento/module-sales/Model/OrderRepository.php:172

then i remove the create invoice function from my observer, then it does not got any error.

After i successfully place an order , i try this create invoice function again using the success order , the create invoice function run smoothly.

It seems the function is triggered before the payment has been placed, is there a way to detect if the payment has been placed using this observer or order?

1 Answer 1


Please try using the event checkout_onepage_controller_success_action

It will help you with the solution.

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.