Mark a cart as complete from a plugin How do I mark a cart as complete from a plugin?
I tried setting isComplete = 1, it gets moved to orders but it is still a cart.
When you take a look at the BookingsController you can see exactly what happens when you need to mark an order as complete

public function actionCompleteOrder(): Response
{
    $this-&gt;requireAcceptsJson();
    $orderId = Craft::$app-&gt;getRequest()-&gt;getParam('orderId');

    $order = Plugin::getInstance()-&gt;getOrders()-&gt;getOrderById($orderId);

    if ($order &amp;&amp; !$order-&gt;isCompleted &amp;&amp; $order-&gt;markAsComplete()) {
        $date = new \DateTime($order-&gt;dateOrdered);
        return $this-&gt;asJson(['success' =&gt; true, 'dateOrdered' =&gt; $date]);
    }

    return $this-&gt;asErrorJson(Craft::t('commerce', 'Could not mark the order as completed.'));
}


So all you need to do is 

$order-&gt;markAsComplete();


Which does 

$this-&gt;isCompleted = true;
$this-&gt;dateOrdered = Db::prepareDateForDb(new \DateTime());
$this-&gt;reference = 'xxxx';
$this-&gt;orderStatusId = y;


You need to set the 4 parameters above to complete an order correctly, not just the isComplete