When checking out, redirected to front page and not payment page I am creating a new order, and line item (without a product, since this is just a fee we're collecting from the customer).  The order is created, with line item, but when I go to /checkout/[order_id], I'm just redirected to the front page.

My code for the order creation is:

function mymod_form_submit($form, &amp;$form_state) {
        global $user;
        $order = commerce_order_new($user-&gt;uid, 'checkout_checkout');
        commerce_order_save($order);
ddl($order);

        $line_item = commerce_line_item_new('app_fee_type', $order-&gt;order_id);
        $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);

        $line_item_wrapper-&gt;line_item_label = t('Application Fee');
        $line_item_wrapper-&gt;quantity = 1;
        $line_item_wrapper-&gt;commerce_unit_price-&gt;amount = 3500;
        $line_item_wrapper-&gt;commerce_unit_price-&gt;currency_code = 'USD';
        $line_item_wrapper-&gt;commerce_total-&gt;amount = 0;
        $line_item_wrapper-&gt;commerce_unit_price-&gt;data = commerce_price_component_add(
                $line_item_wrapper-&gt;commerce_unit_price-&gt;value(),
                'base_price',
                $line_item_wrapper-&gt;commerce_unit_price-&gt;value(),
                TRUE,
                FALSE
        );
        commerce_line_item_save($line_item);

ddl($line_item);


        $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
        $order_wrapper-&gt;commerce_line_items[] = $line_item;
        commerce_order_save($order);
ddl($order);
        commerce_order_status_update($order, 'checkout_payment');
        drupal_goto('checkout/' . $order-&gt;order_id);
}


The customer should just be taken to the checkout screen.  What am I missing?
It looks like the order ID isn't being saved for the session.  Add this:

$_SESSION['commerce_cart_orders'][] = $order-&gt;order_id;


Just make sure you do this before you save the final version of your order.