I am trying to set the order status of orders to "Complete" using the API. I am running Magento Enterprise 2.2.2. Am I missing something in the data?

This is the url I am calling


This is the data I am sending

{"entity": {"entity_id": 10000001, "status": "Complete"}}

This is the error I am getting

"Fatal Error: 'Uncaught Error: Call to a member function getMethodInstance() on null in /vendor/magento/module-payment/Observer/SalesOrderBeforeSaveObserver.php:24

Stack trace:

0 /vendor/magento/framework/Event/Invoker/InvokerDefault.php(72): Magento\Payment\Observer\SalesOrderBeforeSaveObserver->execute(Object(Magento\Framework\Event\Observer))

1 /vendor/magento/framework/Event/Invoker/InvokerDefault.php(60): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\Payment\Observer\SalesOrderBeforeSaveObserver),


2 /vendor/magento/module-staging/Model/Event/Manager.php(97): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array,


3 /generated/code/Magento/Stag' in '/vendor/magento/module-payment/Observer/SalesOrderBeforeSaveObserver.php'

on line 24"

  • Hi There, Is this increment id or order id (primary key of sales_order table) because if this is increment id then you need to replace it with order id, I am sure this is the issue in your case. May 26, 2019 at 11:19

1 Answer 1


You are sending order increment id as order id (primary key of sales order table). Thats why this error pops up. You need to send actual order id.

Let me know if this doesn't fix your issue.

  • That gets rid of the error but still does not change the status of the order but your comment is correct in fixing the error.
    – Trevor Orr
    May 26, 2019 at 16:36
  • If I just have the increment id would I need to do a get to retrieve the order details and then use the order id from that returned data to then do a post to set the order status? Which I found out that I had to use lowercase "complete" for the status to set correctly.
    – Trevor Orr
    May 26, 2019 at 18:13
  • Yes exactly @TrevorOrr, I think you need to create new API for this as I think there is no default API which returns order data from increment id. May 27, 2019 at 4:46
  • Actually I did find a way to get the order id from the increment id from another post here. Multiple steps to set the status but at least it works
    – Trevor Orr
    May 27, 2019 at 5:04
  • Great @TrevorOrr, Happy coding :) May 27, 2019 at 5:05

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.