Jump to content
Sign in to follow this  

PayPal will not convert Description with payment

Recommended Posts


After people add items to the cart and go through the check out process, the Description does not get included with the payment. This field remains blank in the email from PayPal stating that a payment has been recieved.


I can go into the admin area and view the order and complete the order but I am cencerned that after I recieve a few orders I will have a hard time identifying which orders are paid for and which are not. Is there a way to ship the description with the $ ammount to PayPal so it is included in the items purchased?



Share this post

Link to post
Share on other sites

You don't mention what particular paypal payment module you are using.

If it's Express then it is entirely possible, by modding the code and using the PayPal API, to pass the cart details to the order -- I tested this much and then something else troubled me.

If it's PayPal IPN then it's supposed to pass on the cart details -- or at least I got it working.

Share this post

Link to post
Share on other sites


I have the same problem with OSC 2.2 RC2 and PayPal Express Checkout.

No description at all, can you help me please ?



Share this post

Link to post
Share on other sites

Okay here's some help.

Edit your file /ext/modules/payment/paypal/express.php

Find this code:

    default:       if (MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_SERVER == 'Live') {         $paypal_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout';       } else {         $paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout';       }        include(DIR_WS_CLASSES . 'order.php');       $order = new order;        $params = array(


Basically everything in the $params code needs to comply with this API reference:


Unfortunately the one our version uses is an OLD deprecated version of the API...

Thus you will probably have to do quite a bit of rewriting, but this should start:

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

$params['L_NAME' . $i] = $order->products[$i]['name'];

$params['L_NUMBER' . $i] = $order->products[$i]['model'];

//To put a description you use this param:

// 'L_DESC' . $i' => 'Size: 8.8-oz',

//But I like to put all my attributes in the description, like this:

$params['L_DESC' . $i] = '';

for ($j=0, $o=sizeof($order->products[$i]['attributes']); $j<$o; $j++) {

$params['L_DESC' . $i] .= $order->products[$i]['attributes'][$j]['option'] . ':' . $order->products[$i]['attributes'][$j]['value'] . ', ';


$params['L_AMT' . $i] = $paypal_express->format_raw($order->products[$i]['final_price']);

$params['L_QTY' . $i] = $order->products[$i]['qty'];



Of course you should properly look at that API reference I sent you and do it properly :) You can contact me for some help.

If you do try and check against the API, note that SetExpressCheckout API is actually called in


which provides these paremeters for the SetExpressCheckout call:



,'VERSION' => '74.0'


,'METHOD' => 'SetExpressCheckout'

,'RETURNURL' => tep_href_link('ext/modules/payment/paypal/express.php', 'osC_Action=retrieve', 'SSL', true, false)

,'CANCELURL' => tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL', true, false)


In other words, don't put the above variables in /ext/modules/payment/paypal/express.php

Share this post

Link to post
Share on other sites

OK, thank you, now i know more.....

I did re-install pp script and now have Version: 1.2 .

Work better , have item decryption on pp page but still no in email.

Please see addated jpg. Any ideas ?


Thank you



Share this post

Link to post
Share on other sites

Indeed it doesn't include the items in the final submission ("before_process" in includes/modules/payment/paypal_express.php) to PayPal.

It includes the final amount and the final shipping address in case it's changed - but no line items.

I think because the logic is you pass it the first time you talk to PayPal, and then when the user confirms on your site, it contacts PayPal again with just the token of the transaction and says "Do that transaction and this is the final amount and the shipping address".


there is however, absolutely nothing wrong with providing the line items AGAIN and that's what I do.

The line items will be provided in ext/modules/payment/paypal/express.php with these lines:


foreach ($order->products as $product) {

$params['L_NAME' . $line_item_no] = $product['name'];

$params['L_AMT' . $line_item_no] = $paypal_express->format_raw($product['final_price']);

$params['L_NUMBER' . $line_item_no] = $product['id'];

$params['L_QTY' . $line_item_no] = $product['qty'];


$product_tax = tep_calculate_tax($product['final_price'], $product['tax']);


$params['L_TAXAMT' . $line_item_no] = $paypal_express->format_raw($product_tax);

$tax_total += $paypal_express->format_raw($product_tax) * $product['qty'];


$items_total += $paypal_express->format_raw($product['final_price']) * $product['qty'];





$params['ITEMAMT'] = $items_total;

$params['TAXAMT'] = $tax_total;


Put the above lines in includes/modules/payment/paypal_express.php in the before_process procedure, AFTER these lines:


if (is_numeric($sendto) && ($sendto > 0)) {

$params['SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];

$params['SHIPTOSTREET'] = $order->delivery['street_address'];

$params['SHIPTOCITY'] = $order->delivery['city'];

$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);

$params['SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];

$params['SHIPTOZIP'] = $order->delivery['postcode'];



but please note that this is untested and you should make backups and you may have to do some debugging.

Share this post

Link to post
Share on other sites



i did try but not working, i know how to add the item name or item description :


for name i use: $params['L_NAME' . $line_item_no] = $product['name']; (on screen first line "Aliens vs Predator (PC) .....)


for description: $params['L_DESC' . $line_item_no] = $product['name']; ( on screen second line "Item description: Aliens vs Predator ... )


this new line: $params['L_PAYMENTREQUEST_0_NAME' . $line_item_no] = $product['name']; (from PP webapi instruction - do nothing)


But after changes still no item name in email from PP but we have price, Qty , so look like part of data is send to pp only no item name.


hmmmm, starnge .....



Share this post

Link to post
Share on other sites

The finall call to PayPal is in the function before_process in paypal_express.php

I've got it working with the item names BUT I am using a newer version of the API than you -- I'm on 76 which you can set on this line:

$this->api_version = '76.0';

so some of the parameters have a slightly different name:

So for example

I use the parameter "PAYMENTREQUEST_0_AMT" but in your version it is probably "AMT"

I use the parameter "PAYMENTREQUEST_0_CURRENCYCODE" but in your version it is probably "CURRENCYCODE"

... PAYMENTREQUEST_0_NOTETEXT ... your version is probably "NOTETEXT"


Here's the API reference but be careful - this is for the latest version (76):



Don't forget to say thanks if this helps you!!!



   function before_process() {
     global $customer_id, $order, $sendto, $ppe_token, $ppe_payerid, $HTTP_POST_VARS, $comments, $response_array;

     if (empty($comments)) {
       if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) {
         $comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']);

         $order->info['comments'] = $comments;

     $params = array('TOKEN' => $ppe_token,
                     'PAYERID' => $ppe_payerid,
                     'PAYMENTREQUEST_0_AMT' => $this->format_raw($order->info['total']),
                     'PAYMENTREQUEST_0_CURRENCYCODE' => $order->info['currency'],
	'PAYMENTREQUEST_0_NOTETEXT' => $order->info['comments'],
	'SHIPPINGOPTIONNAME' => $order->info['shipping_method'],
	'SHIPPINGOPTIONAMOUNT' =>  $this->format_raw($order->info['shipping_cost'])

     $line_item_no = 0;
     $items_total = 0;
     $tax_total = 0;

     foreach ($order->products as $product) {	  
       $params['L_PAYMENTREQUEST_0_NAME' . $line_item_no] = $product['name'];

			$params['L_PAYMENTREQUEST_' . '0' . '_' . 'DESC' . $line_item_no] = '';
			for ($j=0, $o=sizeof($product['attributes']); $j<$o; $j++) {												
		          $params['L_PAYMENTREQUEST_' . '0' . '_' . 'DESC' . $line_item_no] .= $product['attributes'][$j]['option'] . ':' . $product['attributes'][$j]['value'] . ', ';							

			//take off comma at end
			$params['L_PAYMENTREQUEST_' . '0' . '_' . 'DESC' . $line_item_no] = substr($params['L_PAYMENTREQUEST_' . '0' . '_' . 'DESC' . $line_item_no],0,-2);

			$params['L_PAYMENTREQUEST_0_AMT' . $line_item_no] = $this->format_raw($product['final_price']);
       $params['L_PAYMENTREQUEST_0_NUMBER' . $line_item_no] = $product['id'];
       $params['L_PAYMENTREQUEST_0_QTY' . $line_item_no] = $product['qty'];

       $product_tax = tep_calculate_tax($product['final_price'], $product['tax']);

       $params['L_PAYMENTREQUEST_0_TAXAMT' . $line_item_no] = $this->format_raw($product_tax);
       $tax_total += $this->format_raw($product_tax) * $product['qty'];

       $items_total += $this->format_raw($product['final_price']) * $product['qty'];


     $params['PAYMENTREQUEST_0_ITEMAMT'] = $this->format_raw($order->info['subtotal']);//$items_total;
     $params['PAYMENTREQUEST_0_SHIPPINGAMT'] = $this->format_raw($order->info['shipping_cost']);//$items_total;
		$params['PAYMENTREQUEST_0_TAXAMT'] = $this->format_raw($order->info['tax']);							

     if (is_numeric($sendto) && ($sendto > 0)) {
       $params['PAYMENTREQUEST_0_SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
       $params['PAYMENTREQUEST_0_SHIPTOSTREET'] = $order->delivery['street_address'];
       $params['PAYMENTREQUEST_0_SHIPTOCITY'] = $order->delivery['city'];
       $params['PAYMENTREQUEST_0_SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
       $params['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
       $params['PAYMENTREQUEST_0_SHIPTOZIP'] = $order->delivery['postcode'];

//debug email
		tep_mail('Your name', 'you@youraddress.com', 'calling doExpressCheckoutPayment!', print_r($params, true) . '...' . print_r($order, true), 'from Name', 'from@fromaddress.com');		

		$response_array = $this->doExpressCheckoutPayment($params);
     if (($response_array['ACK'] != 'Success') && ($response_array['ACK'] != 'SuccessWithWarning')) {
			tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . stripslashes($response_array['L_LONGMESSAGE0']), 'SSL'));

Edited by rfwoolf

Share this post

Link to post
Share on other sites



so, after 3 days ......... is WORKING !!!!!!!!!!!!


You are the best !!!!!!


Thank you very, very much.

Share this post

Link to post
Share on other sites

I'm glad you came right - sorry I have been really busy these past few days.

I'm glad I was of some help.


What I still want to do is make it so that it sends paypal the 'INVNUM' (or the PAYMENTREQUEST_0_INVNUM in my version) so that the order number appears on the PayPal receipt. But as you know the transaction goes to PayPal during before_process, but the order on OsCommerce is only inserted AFTER that.

So it would need to be rewritten that the order is inserted BEFORE, but with status 'Pending'.

Then after_process the order is set to status 'Processing' or whatever.


Good luck.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this