Author Topic: Paypal old API - shipping not transferred anymore  (Read 3959 times)

stout_77

  • Beginner
  • *
  • Posts: 3
Paypal old API - shipping not transferred anymore
« on: April 08, 2012, 02:36:36 am »
Hi there,
I need your help!
My website is in Joomla 1.5.22 and Virtuemart 1.1.5.
I have paypal payments set with paypal old API and everything as been working until Thurday 5th April; now I'm getting PayPal IPN Error messages, with Total check failed, and the shipping costs are not transmitted.
This are my configuration settings:

Code: [Select]
<?php
$db1 
= new ps_DB();
$q "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$user->country."' ORDER BY country_2_code ASC";
$db1->query($q);

$url "http://www.paypal.com/cgi-bin/webscr";
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": "$db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"amount" => round$db->f("order_total")-$db->f("order_shipping"), 2),
"shipping" => sprintf("%.2f"$db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],

"address_override" => "0",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $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",
"undefined_quantity" => "0",

"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"no_shipping" => "1",
"no_note" => "1"
);
if( 
$page == "checkout.thankyou" ) {
$query_string "?";
foreach( 
$post_variables as $name => $value ) {
$query_string .= $name"=" urlencode($value) ."&";
}
vmRedirect$url $query_string );
} else {
echo 
'<form action="'.$url.'" method="post" target="_blank">';
echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" alt="Click to pay with PayPal - it is fast, free and secure!" />';

foreach( 
$post_variables as $name => $value ) {
echo 
'<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo 
'</form>';

}
?>

Please help!!


Stefano

vinyldesign.com.au

webgobe

  • Advanced
  • Full Member
  • *****
  • Posts: 535
  • Follow me on Twitter! http://twitter.com/webgobe
    • Internet craftsman carrying on the heritage of European manufacturing traditions through original Web designs.
Re: Paypal old API - shipping not transferred anymore
« Reply #1 on: April 10, 2012, 19:00:06 pm »
Same on 2 different sites: one with VM 1.1.3 - worked fine for years, nothing has changed, and one with VM 1.1.9 and the VM fix from b-planet.com - also worked fine for more, than a year. both sites are running latest Joomla, both wheren't changed, not by me, nor by the site owner, and the hosting environment is also unchanged.
Like a fine wine... Good from the start and getting better over time.
Donations are welcome!

webgobe

  • Advanced
  • Full Member
  • *****
  • Posts: 535
  • Follow me on Twitter! http://twitter.com/webgobe
    • Internet craftsman carrying on the heritage of European manufacturing traditions through original Web designs.
Re: Paypal old API - shipping not transferred anymore
« Reply #2 on: April 11, 2012, 09:14:34 am »
I did an ugly hack to solve it until a real fix is found. I simply added the shipping amount to the total to be passed to PayPal, and send zero instead the real shipping amount, in short replaced this:
Code: [Select]
"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total,
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
with this:
Code: [Select]
"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total+sprintf("%.2f", $db->f("order_shipping")), 2),
"shipping" => "0",
The customers are charged via PayPal with the correct value, and shipping and tax details are still okay in the order - just they aren't passed to PayPal, so won't be shown on PayPal's invoice.
Hopefully I will find a better solution - or somebody else will do it.
Like a fine wine... Good from the start and getting better over time.
Donations are welcome!

mednickm

  • Beginner
  • *
  • Posts: 9
Re: Paypal old API - shipping not transferred anymore
« Reply #3 on: April 15, 2012, 18:31:06 pm »
Hi there,

Very similar situation. I did upgrade to the fedex web service and just yesterday and order was placed and shipping wasn't passed through which really sucks.

I just modifed the paypal info as above and it worked, however, is this the best fix?

I'm using joomla 1.5.20, virtuemart 1.1.9, fedex services 2.2011.04.19.
Thanks.