$order->set_cust_name('M Мiхail Slеpcоv');//ship to name
$order->set_ship_add1('Осtуzhеva, 5a, 201 ');//ship to address1
$order->set_ship_add2('M');//ship to address2
$order->set_ship_city('Вороnеzh');//ship to city
$order->set_ship_state('Россia');//ship to state
$order->set_ship_zip('11205');//ship to postal code
$order->set_ship_meth('FDG');//ship method FDG=Ground, FD2=2nd Day, FDO=Overnight
$order->set_order_num('28');//customer PO#
$order->set_ship_country('RU');//ship to country code
// $order->set_conf_number($ConfNumber);//confirmation from DST
// $order->set_paypal_number($BTN);//paypal reference number
// $order->set_tax_amount($TAX);//tax on order
// $order->set_ship_amount($HSC);//calculated shipping cost of order


///pass line item information
$order->addItem(array('line_code'=>'vg','part_num'=>'JV8','quantity'=>2,'cost'=>3.16));
$order->set_status('test');//takes either ('test') or ('live')

echo "\r\n";
print_r($order->sendOrder('enterOrder'));


$ret = json_decode($order->sendOrder('enterOrder')); //order entry response in json string


var_dump($ret);

 
?>
     $unitPrice[] = $item->getPrice();
     $sku[] = $item->getSku();
     $ids[] = $item->getProductId();
     //$qty[]=$item->getQtyToInvoice();
     $qty[] = $item->getQtyInvoiced();
     $linecode = strtoupper(substr($item->getSku(), 0, 2));
     $partnumber = substr($item->getSku(), 2);
     $partnumber = substr($partnumber, 0, strpos($partnumber, '.'));
     /*
     echo "Linecode = ".$linecode." | Partnumber = ".$partnumber." | sku = ".$sku[$i];
     //echo $linecode.", ";
     echo "\r\n";
     echo "Quantity = ".$qty[$i]." | Cost = ".$unitPrice[$i]; 
     echo "\r\n";
     */
     $paOrder->addItem(array('line_code' => $linecode, 'part_num' => $partnumber, 'quantity' => $qty[$i], 'cost' => $unitPrice[$i]));
     $i++;
 }
 /*
 */
 if ($itemcount > 0 && $CustomerName && $PostalCode && $ShippingMethod2 && $InvoiceId) {
     $paOrder->set_status($apiMode);
     //takes either ('test') or ('live')
     $ret = json_decode($paOrder->sendOrder('enterOrder'));
     //order entry response in json string
 }
 /*
 echo "************ RESPONSE ******************";
 echo "\r\n";
 var_dump($ret);
 echo "\r\n";
<?
require_once('paAPI.php');
$order = new paAPI();//construct paAPI class
$order->setUser('username','pass');//api account username and pass
$order->setClient("Sample Client v1");//passes the name of the connection client *optional*
$order->set_cust_name($CustomerName);//ship to name
$order->set_ship_add1($Address1);//ship to address1
$order->set_ship_add2($Address2);//ship to address2
$order->set_ship_city($City);//ship to city
$order->set_ship_state($State);//ship to state
$order->set_ship_zip($PostalCode);//ship to postal code
$order->set_ship_meth($ShippingMethod2);//ship method FDG=Ground, FD2=2nd Day, FDO=Overnight
$order->set_order_num($PONumber);//customer PO#
$order->set_ship_country('US');//ship to country code
$order->set_conf_number($ConfNumber);//confirmation from DST
$order->set_paypal_number($BTN);//paypal reference number
$order->set_tax_amount($TAX);//tax on order
$order->set_ship_amount($HSC);//calculated shipping cost of order


///pass line item information
$order->addItem(array('line_code'=>$lc1,'part_num'=>$part1,'quantity'=>$qty1,'cost'=>$cost1));
$order->addItem(array('line_code'=>$lc2,'part_num'=>$part2,'quantity'=>$qty2,'cost'=>$cost2));
$order->addItem(array('line_code'=>$lc3,'part_num'=>$part3,'quantity'=>$qty3,'cost'=>$cost3));
$order->set_status('test');//takes either ('test') or ('live')
$ret = json_decode($order->sendOrder('enterOrder'));//order entry response in json string
?>