How can I attach a line item field to a custom checkout pane? How can I attach a line item field (as form element) to a custom checkout pane ? 

I tried the following with commerce_line_item_save($line_item);

function MODULE_pane_checkout_form($form, &amp;$form_state, $checkout_pane, $order) {  
  //...
  //1st TRY, which in my opinion should be the right API fn ?
  global $language;
  field_attach_form('commerce_order', $order, $pane_form, $form_state, $language-&gt;language, array('field_name' =&gt; 'field_paxsup'));


Which returns 


  Fatal error: Cannot access empty property in field.attach.inc on line
  208.


field.attach.inc on line 208  $items = isset($entity-&gt;{$field_name}[$langcode]) ? $entity-&gt;{$field_name}[$langcode] : array();

Precision: the custom checkout pane is working great with a basic field as below 

$pane_form['nickname'] = array(
 '#type' =&gt; 'textfield',
 //and so on...
);
Got the answer just after posting : so the correct one is 

field_attach_form($entity_type, $entity, &amp;$form, &amp;$form_state, $langcode = NULL, $options = array())

First parameter 

entity_type is the entity type you want to attach, not the one you want to attach to (see why non native english speakers have problems sometimes... Duh !). 

Second parameter 

entity expects an object , not a string ! Don't do

field_attach_form('commerce_line_item', 'my_line_item_type' ... 

but :

$line_item = new stdClass();
$line_item-&gt;type = 'line_item_liberte'; 

field_attach_form('commerce_line_item', $line_item, $pane_form, $form_state, $langcode, array('field_name' =&gt; 'field_paxsup'));


In checkout pane context, load the line item

function MODULE_pane_checkout_form($form, &amp;$form_state, $checkout_pane, $order) { 

  $line_item = commerce_line_item_load($order-&gt;commerce_line_items['und'][0]['line_item_id']);
  field_attach_form('commerce_line_item', $line_item, $pane_form, $form_state, $langcode, array('field_name' =&gt; 'field_paxsup'));
  //...