Your Help Group

How to add shipping charges to the invoice after the discount is applied

I might be thrilled to provide data about including shipping charges after discounts are applied when we create the Invoice/Bill using QB api.
Please check the below code.

Code Block Example

					    
                            First we create the line item object like below
$itemLine[] =array(   
'Amount'=>$price*$details['quantity'],  
'DetailType'=>'SalesItemLineDetail',   
  "Description"=>$details['title'],  
     'SalesItemLineDetail'=>array(   
   "Qty"=> $details['quantity'],    
    "UnitPrice"=> $price,  
     'ItemRef'=>array(   
  'value'=>$itemId, 
    'name'=>''    
    ),   
  "TaxCodeRef"=>[   
       "value"=> '7'  
                     ],
         ),            
    );            

  Then add shipping object into same array 
  $shipcost = 0;   
          $itemLine[]=array(   
           'Amount'=>$shipcost, 
            'DetailType'=>'SalesItemLineDetail',    
           "SalesItemLineDetail"=>array(            
     'ItemRef'=>'SHIPPING_ITEM_ID',             
     "TaxCodeRef"=>[                      
  "value"=> '7'              
        ],          
       ),        
    );  
  Then add option as ship method id that you can find that id from quickbooks . 
  'ShipMethodRef'=>7,