add billing information in Drupal Commerce Programatically I am developing api access point for drupal commerce, from that access point user can upload his/her billing information during checkout process. Here is my code, but it can not add user full name in billing information. Any suggestion is greatly appreciated.

Thanks

  function commerce_services_bill_ship_create($data, $flatten_fields) {
    $status; $message;
    $orderId; $uid;

    $orderId =$data["orderId"];
    $uid = $data["uid"];
    $fullname = $data['fullname'];

    $order = commerce_cart_order_load($uid);
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    $order_wrapper-&gt;commerce_customer_billing-&gt;commerce_customer_address-&gt;name_line = $fullname;
    $order_wrapper-&gt;commerce_customer_billing-&gt;commerce_customer_address-&gt;thoroughfare = "No.1, ABC street";    

    $order_wrapper-&gt;commerce_customer_billing-&gt;commerce_customer_address-&gt;locality = "New York";
     try{
        // Save the order.
        commerce_order_save ($order);
        $status = 1;
        $message = "order update successfully.";
    }catch(Exception $ex){
        $status = 0;
        $message = "order can't update successfully.";
    }
    $reply= (array('status' =&gt; $status,'message' =&gt; $message));

    return $reply;
 }
To add billing information in checkout process first we have to create a profile object and assign it to the order. This code works for me

For adding new profile for billing information

function commerce_services_bill_ship_create($data, $flatten_fields) {
$status; $message;
$orderId; $uid;

$orderId =$data["orderId"];
$fullname = $data['fullname'];
$city = $data["city"];
$address = $data["address"];

//load order that you want to add billing information
$order = commerce_cart_order_load($uid);


// We'll assume that the current user will be the customer of our order
global $user;

$profile = commerce_customer_profile_new('billing', $user-&gt;uid);
$profile-&gt;commerce_customer_address = array(LANGUAGE_NONE =&gt; array(0 =&gt; addressfield_default_values()));

//for updating existing profile, uncomment the line below and comment commerce_customer_profile_new()
//$profile = commerce_customer_profile_load($profile_id); //

//add fullname
$profile -&gt; commerce_customer_address['und'][0]['name_line'] = $fullname;

//add address
$profile-&gt;commerce_customer_address['und'][0]['thoroughfare'] = $address;


//add city
$profile-&gt;commerce_customer_address['und'][0]['locality'] = $city;


// You sould pass the entire $profile object as parameter.
commerce_customer_profile_save($profile);

//assign profile_id to the order
$order-&gt;commerce_customer_billing[LANGUAGE_NONE][0]['profile_id'] = $profile-&gt;profile_id;

try{
    // Now you can save the order.
    commerce_order_save($order);
    $status = 1;
    $message = "order update successfully.";
}catch(Exception $ex){
    $status = 0;
    $message = "order can't update successfully.";
}


$reply= (array('status' =&gt; $status,'message' =&gt; $message));

return $reply;
}


Reference site - Programatically Create Order with Customer Profile
, Creating Customer Profiles Programmatically