Completing commerce order triggering other modules rules checkout complete i've coded a checkout complete but aint triggering other modules checkout complete rules, i'm assuming commerce_checkout_complete($order->order_id); will do this. 

The most important thing for me is that, the items on the cart are files, hence i have commerce licence that grant license to each files which is not triggered by the code below. Any tips on how to do this please?

Thank you very much.

&lt;?php
    function custom_module_complete_order($order_id) {

     $order = commerce_order_load($order_id);

     commerce_order_status_update($order, 'checkout_checkout');

      $payment_method = commerce_payment_method_instance_load('commerce_payment_example|commerce_payment_commerce_payment_example');

      $transaction = commerce_payment_transaction_new('commerce_payment_example', $order-&gt;order_id);
      $transaction-&gt;instance_id = $payment_method['instance_id'];
      $transaction-&gt;amount = $order-&gt;commerce_order_total['und'][0]['amount'];
      $transaction-&gt;currency_code = $order-&gt;commerce_order_total['und'][0]['currency_code'];
      $transaction-&gt;status = COMMERCE_PAYMENT_STATUS_SUCCESS;
      $transaction-&gt;message = 'Name: @name';
      $transaction-&gt;message_variables = array('@name' =&gt; 'Commerce Cartmaker Payment');

      commerce_payment_transaction_save($transaction);
      commerce_payment_commerce_payment_transaction_insert($transaction);

     commerce_order_save($order);
     commerce_checkout_complete($order-&gt;order_id);
}
?&gt;
Updating to checkout_complete status, make the code works. Thanks.

+     $order = commerce_order_status_update($order, 'checkout_complete');
      commerce_order_save($order);
      commerce_checkout_complete($order-&gt;order_id);