How do I programmatically update the order status?
You want to use the State Machine methods of the Commerce Order class. 

It would be something like this, but it will depend on what you called your order states.

$order_state = $orderObj-&gt;getState();
$order_state_transitions = $order_state-&gt;getTransitions();
$order_state-&gt;applyTransition($order_state_transitions['complete']);

$orderObj-&gt;save();


If you aren't sure, you can always check the $order_state_transitions array to see what options you have.