Fixed it by replacing the whole function custom_get_additional_info_woo to below code
protected function custom_get_additional_info_woo($def_arr) {
global $woocommerce;
$em_cart_total = $woocommerce->cart->cart_contents_total;
$custom_payment_info_arr = $def_arr;
$items = $woocommerce->cart->get_cart();
$c = 0;
foreach($items as $item => $values) {
$title_key = 'L_NAME' . $c;
$amt_key = 'L_AMT' . $c;
$qty_key = 'L_QTY' . $c;
$_product = wc_get_product( $values['data']->get_id());
$_prod_title = $_product->get_title();
$_prod_quantity = $values['quantity'];
$_prod_price = get_post_meta($values['product_id'] , '_price', true);
$custom_payment_info_arr[$title_key] = $_prod_title;
$custom_payment_info_arr[$qty_key] = $_prod_quantity;
$custom_payment_info_arr[$amt_key] = $_prod_price;
$c++;
}
return $custom_payment_info_arr;
}
protected function create_paypal_request() {
//API Reference - https://developer.paypal.com/docs/classic/api/merchant/DoDirectPayment_API_Operation_NVP/
if ( $this->order AND $this->order != null ) {
$def_arr = array(
'PAYMENTACTION' => $this->PAYPAL_NVP_PAYMENTACTION,
'VERSION' => $this->PAYPAL_NVP_API_VERSION,
'METHOD' => $this->PAYPAL_NVP_METHOD,
'PWD' => $this->apipassword,
'USER' => $this->apiusername,
'SIGNATURE' => $this->apisigniture,
'AMT' => $this->order->get_total(),
'ITEMAMT' => $this->order->get_total(),
'FIRSTNAME' => $this->order->get_billing_first_name(),
'LASTNAME' => $this->order->get_billing_last_name(),
'STREET' => $this->order->get_billing_address_1(),
'CITY' => $this->order->get_billing_city(),
'STATE' => $this->order->get_billing_state(),
'ZIP' => $this->order->get_billing_postcode(),
'COUNTRYCODE' => $this->order->get_billing_country(),
'SHIPTONAME' => $this->order->get_shipping_first_name() . " " . $this->order->get_shipping_last_name(),
'SHIPTOSTREET' => $this->order->get_shipping_address_1(),
'SHIPTOSTREET2' => $this->order->get_shipping_address_2(),
'SHIPTOCITY' => $this->order->get_shipping_city(),
'SHIPTOSTATE' => $this->order->get_shipping_state(),
'SHIPTOZIP' => $this->order->get_shipping_postcode(),
'SHIPTOCOUNTRY' => $this->order->get_shipping_country(),
'IPADDRESS' => $_SERVER[ 'REMOTE_ADDR' ],
'CREDITCARDTYPE' => $_POST[ 'billing_cardtype' ],
'ACCT' => $_POST[ 'billing_credircard' ],
'CVV2' => $_POST[ 'billing_ccvnumber' ],
'EXPDATE' => sprintf( '%s%s', $_POST[ 'billing_expdatemonth' ], $_POST[ 'billing_expdateyear' ] ),
'STREET' => sprintf( '%s, %s', $_POST[ 'billing_address_1' ], $_POST[ 'billing_address_2' ] ),
'CURRENCYCODE' => get_woocommerce_currency(),
'INVNUM' => $this->order->get_order_number(),
'BUTTONSOURCE' => 'TipsandTricks_SP',
);
$def_arr = $this->custom_get_additional_info_woo($def_arr);
return $def_arr;
}
return false;
}