News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Send Product Name and Attributes to Paypal

Started by kontrolfreek, December 20, 2008, 08:12:49 AM

Previous topic - Next topic

hellodave

I think that is a setting in your paypal profile.
Go to My Account > Profile > Website Payment Preferences
Check off next to "Block Non-encrypted Website Payment".
If it is already off then I dunno  :-\
currently working with -
Joomla 2.5.8
VM 2.0.18a

fire2

Hi there,
   I tried using the last code posted by virtuemart_craig in the sandbox mode and it works pretty good but I'm facing two issues:

- The order status does not update to "confirmed" after successful payments
- The PayPal fee/discount (-3.5% in my case) is not being sent to PayPal, it is not included in the Total Amount when you are redirected to PayPal even though it is included through the checkout until you click Confirm Order and you are redirected to PayPal.

Does anyone know how to fix these issues? I am running a live site and just switched to test mode to see if this code was better but if I can't get the payment method fee i'll have to switch back to the default code.

Does anyone really know how to fix the problem of the order status not updating? I've seen so many topics about this, but nobody has the answer... I found a solution in this forum: http://forum.virtuemart.net/index.php?topic=27261.0 but it is for VM 1.0 and I don't know if this will work in VM 1.1

Thanks in advance.
currently using:
Joomla 2.5.8
VM 2.0.14

helenbn

Hi Yosia,

I get confirmed status, but never in sandbox. Has to do with the notify.php. So, if your site is live, did you by chance use htaccess to lock down your administrator directory? If so, you need to allow the notify.php file.

I can't remember but I think my discount was showing up in the preview in PayPal, but my receipt from PayPal does not list it separate but just a reduced subtotal.

New problem for me:

My VM customer receipt is fine.
My PayPal customer receipt shows Subtotal, Tax and Payment, but no Shipping or Handling. - I would like to see either Shipping or Handling...
My PayPal business transaction details shows Subtotal and tax, but puts my "shipping and handling" into "handling" and no shipping fee - and I want it put into "shipping" and no "handling" fee.

I read this post http://forum.virtuemart.net/index.php?topic=46397.0 and see the problem, but in my case, and the auditors, PayPal and VM and Quickbooks need to agree. But 2 out of 3 isn't bad!
I use Virtue Mart 1.1.3 & Joomla 1.5.10

fire2

Hi helenb, thankyou for your response.
I haven't used an .htaccess to lock down the administrator directory. Somehow I thought in the sandbox mode the status should also update to confirmed, but it didn't. With the default notify.php file and the default paypal config it didn't update either.
One thing is clear, the payment method fee is not being sent to PayPal. PayPal is only charging for the subtotal and shipping handling, but not the 3.5% fee i configured to the PayPal payment method. I attach the screenshots so you can see it clearer.

Greetings.

[attachment deleted by admin]

[attachment cleanup by admin]
currently using:
Joomla 2.5.8
VM 2.0.14

helenbn

The paypal sandbox fix to get the notify to work never worked for me. So I used the sandbox IPN checker and it passed.

I don't think there is a line of code to cover the PayPal fee. And I don't know enough to create one for you.   :(
I use Virtue Mart 1.1.3 & Joomla 1.5.10

fire2

Virtuemart_craig or Ajredding, do any of you know what line covers the payment fee/discount or where it should be?
currently using:
Joomla 2.5.8
VM 2.0.14

helenbn

yosia, my best guess after reading this very useful page https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables is that you would have to pull the value and add it in this line
"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
as you can see it takes the discount off the total. If you know the call for the fee, you might be able to add it after the discount, but I don't think it can be listed on a separate line in PayPal after consulting that page referenced above, just as the discount cannot.

But I'm the blind leading the blind here.  8)
I use Virtue Mart 1.1.3 & Joomla 1.5.10

fire2

#52
I don't necessarily need that fee/discount to be in another line. I just want PayPal to charge it, because this config for the PayPal payment method is not charging it. The default PayPal gateway in VM 1.1.3 includes that fee to the "Item Total" and then shows the "Shipping and Handling" in another line. That's fine for me, but I liked the idea of PayPal showing you the products you ordered and their price, as this code does. So I just want PayPal to charge that fee even if it is not shown in another line.

And, where should I add this line? Does it matter?

Thanx.
currently using:
Joomla 2.5.8
VM 2.0.14

joannah

Hi
I have asked this question tons of times. 

How can I add the short description to show up on the paypal receipt as this is to be used as an E-ticket? Or what are my alternatives!?

This is urgent I am about to get in a lot of strive if we don't get an answer soon,
thanks in advance to any help at all!
Jo

helenbn

By PayPal receipt, do you mean the email that PayPal issues to the customer? or do you mean the top of the Payment page you hit once you leave the store site?
I use Virtue Mart 1.1.3 & Joomla 1.5.10

undersun

Quote from: martin09 on June 03, 2009, 04:30:10 AM
I tried to use the code with its modifications and testing it with sandbox, everything goes well but when I change it to live URL: https://www.paypal.com/cgi-bin/webscr, I get the following error.
===========
Error Detected

The seller accepts encrypted website payments only. You cannot pay the seller through un-encrypted buttons. Please contact your seller for more details.

===============

Do you know what is causing this problem? I appreciate any help

Yes, log into your paypal acc't, and under "profile," then "website payment preferences," change the "Encrypted Website Payments" setting from "Block Non-encrypted" to "Website Payment" OFF.  That should do it!

hotelathome

#56
Is there anyone that might be able to help me with this?
http://forum.virtuemart.net/index.php?topic=63776.0
I just want my paypal customers to see the same thing that they do at check-out and when they loggin to look at their orders.

I want them to see the order number

I want them to see the item descriptions with the price including tax.

I want them to be able to see the discount they recieved (as a total amount).
My discounts come off the whole order (but not the shipping) and this then reduces the amount of tax paid too.

I want them to see the shipping costs including tax

I want it to all add up to the same amount they were shown at checkout and then have the tax component shown at the bottom.

eg:

1 x shoe (inc tax)  $10.00
1 x book (inc tax)  $70.00
subtotal (inc tax)  $80.00
less 10% discount
                  - $8.00
shipping (inc tax)  $10.00
TOTAL    (inc tax)  $82.00
tax paid             $6.54

my items and my shipping include 10% tax.

I have altered my paypal extra so that it just shows the total amount paid in full and nothing else as it was the only fix I came accross that at least made the amounts the same as the checkout.
I would love to know how to fix this.
I dont know enough about coding to combine the best bits from each, but I know I am so close to finding a solution.

******SOLVED FOR ME AT LEAST*******
From this website
http://www.exps.ca/solutions
My situation is a little different from the solutions available from here, but if you send Micah a message, he is sure to help you.
if you click on solutions/virtuemart, you may even find the fix already done for you.

tracer

#57
wow .. I just about have this working .. you folks that've posted code .. THANK YOU

I think I've compiled all the updates that've been in this post -- including the order status getting updated correctly

i had/have 2 outstanding problems
1.) the code that's been here (not sure how old) didn't have an "item_name" param, to sand to paypal -- seems more to be used as an order description. I found it, and added it back .. but what i'd really like is a way to concatenate item#'s into the string .. i can probably figure that out

2.) tax! .. tax seemed to be applied twice. i don't have "Show "(including XX% tax)" when applicable?" enabled, it was correct on the order in VM, but when it got to paypal, tax was totaled into the item AND as a line item -- i can't find why!?!? arghhh

I have Joomla 1.5.15 and VM 1.1.4

here's my code .. any help? (for now .. I had to revert to the default paypal code .. which is sooo lacking .. agkkk!)

<?php
$url 
"https://www.paypal.com/cgi-bin/webscr";
$order_id $db->f("order_id");
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");  

// Query for Order Items
$dboi = new ps_DB;
$q_oi "SELECT * FROM #__vm_order_item ";
$q_oi .= "WHERE #__vm_order_item.order_id='$order_id'";
$dboi->query($q_oi);

$row_num $dboi->num_rows();

//New code Getting Cart Items
$auth $_SESSION['auth'];
$cart $_SESSION['cart'];
$t_quantity 0;
$disc_perItem 0;
$i=1;

// Query to get User Info
$dbb = new ps_DB;
$q "SELECT * FROM #__vm_user_info ";
$q .= "WHERE user_id ='".$my->id."' ";
$dbb->setQuery($q);
$dbb->query();

//New Code
$discount_totalCP $db->f("coupon_discount") + $db->f("order_discount");

while(
$dboi->next_record()) {
  
$t_quantity $t_quantity intval($dboi->f("product_quantity"));
}

$dboi null;
$dboi = new ps_DB;
$dboi->query($q_oi);

if(
$t_quantity 0)
{
  if(
$discount_totalCP 0) {
    
$disc_perItem round($discount_totalCP $t_quantity2);
  }
  else {
    
$disc_perItem 0;
  }
}
else {
  
$disc_perItem 0;
}

while(
$dboi->next_record()) {

  
$prod_attrib $dboi->f("product_attribute");
  
$supp_var['item_name_' $i] = strip_tags("Order #"$db->f("order_id").": "$dboi->f("order_item_name"));
  
  if(
$prod_attrib ''){
    
$attributes_array explode('<br/>',$prod_attrib);
    
$v 0;
    
$z 1;
    foreach ( 
$attributes_array as $attributes_value){
      
$attrib_name trim(substr($attributes_value0strpos($attributes_value':')), " ");
      
$supp_var['on' $z '_' $i] = $attrib_name;
      
$attrib_sel trim(substr_replace(substr_replace($attributes_value""0strrpos($attributes_value':')), ""02));
      
$supp_var['os' $z '_' $i] = $attrib_sel;
      
$v++;
      
$z++;
      unset(
$attributes_value);
    }
  }

  
$supp_var['item_number_' $i] = $dboi->f("order_item_sku");
  
$supp_var['quantity_' $i] = $dboi->f("product_quantity");
  
$supp_var['amount_' $i] = round(($dboi->f("product_item_price") - $disc_perItem),2);
  
$i++;
}
//End New Code


//Start New Code - Ship to Address Versus Bill To Address

//Query used to compare Bill to versus Shipp to address
$dboui = new ps_DB;
$q_oui "SELECT * FROM #__vm_order_user_info ";
$q_oui .= "WHERE #__vm_order_user_info.order_id='$order_id' ORDER BY #__vm_order_user_info.order_info_id DESC";
$dboui->query($q_oui);

$oui_id $dboui->f("order_info_id");

if(
$oui_id == $order_id){
  
$first_name $dbb->f("first_name");
  
$last_name $dbb->f("last_name");
  
$address1 $dbb->f("address_1");
  
$address2 $dbb->f("address_2");
  
$city $dbb->f("city");
  
$state $dbb->f("state");
  
$address_country $dbbt->f("country");
  
$zip $dbb->f("zip");
  
$H_PhoneNumber $dbb->f("phone_1");
}
else {
  
$first_name $dboui->f("first_name");
  
$last_name $dboui->f("last_name");
  
$address1 $dboui->f("address_1");
  
$address2 $dboui->f("address_2");
  
$city $dboui->f("city");
  
$state $dboui->f("state");
  
$address_country $dboui->f("country");
  
$zip $dboui->f("zip");
  
$H_PhoneNumber $dboui->f("phone_1");
}
//End New Code

// Builds array for the form
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"upload" => "1",
"page_style" => "paypal",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => "AWEBand.com ".$VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": "$db->f("order_id"),
"currency_code" => $_SESSION['vendor_currency'],
"amount" => round$db->f("order_subtotal")+$tax_total-$discount_total2),
"handling_cart" => sprintf("%.2f"$db->f("order_shipping")),
"tax" => $tax_total,
"invoice" => $db->f("order_number"),
"image_url" => $vendor_image_url,
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php",
"no_shipping" => "1",
"no_note" => "1",
"email" => $dbb->f("user_email"),
"address_override" => "1",
"first_name" => $first_name,
"last_name" => $last_name,
"address1" => $address1,
"address2" => $address2,
"city" => $city,
"state" => $state,
"address_country" => $address_country,
"zip" => $zip,
"night_phone_b" => $H_PhoneNumber,

"cpp_header_image" => $vendor_image_url
);

if( 
$page == "checkout.thankyou" ) {
  
$query_string "?";

  foreach( 
$post_variables as $name => $value ) {
    
$query_string .= $name"=" urlencode($value) ."&";
  }

  if(
is_array($supp_var) && count($supp_var)) {
    foreach(
$supp_var as $name => $value) {
      
$query_string .= $name"=" urlencode($value) ."&";
    }
  }

  
vmRedirect$url $query_string );

else {
  echo 
'<form action="'.$url.'" method="post" target="_blank">';

  foreach( 
$post_variables as $name => $value ) {
    echo 
'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
  }
  
  if(
is_array($supp_var) && count($supp_var)) {
    foreach(
$supp_var as $name => $value) {
      echo 
'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
    }
  }
  echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!">';
  echo 
'</form>';
}
?>

MacAcer

Is there a complete working "PayPal Extra info" code out there? It works out of the box, but the customer doesn't get any accurate info with PayPal, just charged for the same amount. It would be nice if the customer could get an accurate receipt with paypal, including item, shipping and tax cost.

I am sure that tons of smart people already worked this out. Could anyone be so kind to share this code with a less enlightened one? :)

Thank you in advance!

Seiko

I struggled a lot.
It was really pain working with paypal documents, sandbox and live server.
The sandbox or live server doesn't always behave as their documents.
Well, I think I finally nailed working condition script.
At least, as my test, it worked. But it doesn't guarantee it works for you.
Please always backup your original code and test on the sandbox (even it seems sometimes the sandbox and live server don't act as the same way).
I thank a lot to this topic's contributers and hope my script helps others.

- Seiko

[attachment cleanup by admin]
Do you have questions and need some help for your Virtuemart project?
I'm ready to help you. Hire Me on oDesk