Author Topic: Multi-currency store : wrong currency on paypal interface  (Read 56952 times)

JonathanNZ

  • Jr. Member
  • **
  • Posts: 66
Re: Multi-currency store : wrong currency on paypal interface
« Reply #15 on: March 05, 2009, 22:23:42 pm »
Is there anyone on the development team looking into this issue?
It seems like a MAJOR issue in my opinion.
I am also facing this issue.
I am very surprised there is no mention of a solution.
What's up with that? I see so many posts in the forums with questions that go completely unanswered. That has also surprised me... I am used to open source projects having great user-to-user and even developer-to-user support. Seems lacking here... especially when an issue as significant as this has gone unresolved for nearly two months (not including all the earlier posts from other people facing the same issue)

A solution to this BUG would be greatly appreciated.

With thanks,

Jonathan

Webdongle

  • Jr. Member
  • **
  • Posts: 99
Re: Multi-currency store : wrong currency on paypal interface
« Reply #16 on: March 06, 2009, 00:18:52 am »
I altered one of the test items to be £ then viewed the item with USD selected.  Then ordered.  All was ok, the cart passed the price with the USD amount that was showing on the creen when ordered.  That is correct because the customer is paying in USD and does not want to pay differently than they see on the screen.  The fact that Paypal charges @ a adifferent rate and then adds charges for cross border currencies is irrelevant to the way VM works.

I did the same test with £ showing and all was well.  The cart passed the correct £ amount to the cart.  In that instance Paypal would deduct the USD equivilant(based on their own exchange rate) from the customers card.  The amount of USD that would be deducted would not be the same as the amount that shows in VM when conversion is on.

The only time that there is a problem is when i have the site set to show £ but the product has an amount in a different currency.

If the Site is set to ones own currency and the item is given a value in the same currency then VM works correctly as it is installed.

The confusion arises because people do not understand that banks use their own exchange rates.  And do not change the currency of the test products.
When I'm right no one remembers but when I'm wrong no one forgets  :'(

Icewraithuk

  • Beginner
  • *
  • Posts: 7
Re: Multi-currency store : wrong currency on paypal interface
« Reply #17 on: March 06, 2009, 10:25:35 am »
Hi,

I'll state this again, because clearly I've not been clear enough THIS IS NOTHING TO DO WITH PAYPAL DOING A CURRENCY EXCHANGE!!!!

Set your item price to £, change your site currency to USD, check out - everything looks fine at PayPal, but when you ACTUALLY PAY, it screws up and sends the amount in the other currency.

Seriously, I'm not a retard, I know when it's a currency conversion issue (the difference will be a very small amount) and when it's a programmatic error (which this is)

A currency exchange rate difference would not result in a USD23.35 order being paid as GBP23.35 - it would result in me getting something like £12.53 instead of £12.99 - this is NOT what is happening...

I re-iterate, it all looks absolutely correct until you actually finish the checkout with PayPal - to the customer, it all looks correct, the PayPal site says GBP/EUR/USD all the way through, it's just what you get in the end.

I'm guessing it's more of a PayPal issue than a VirtueMart one, but the easiest way to fix it would be to get VirtueMart to show whatever currency the user wants, but only ever send the amount in the store currency to PayPal - that way I'll always get my £12.99 and the customer takes the hit on the PayPal conversion...

Which I guess would be something like "currency_code" => $_SESSION['product_currency'], but always send GBP rather than USD?

Anyway, I've just turned it off for now - anyone know if there's a way to just get the store to display all prices in USD/EUR/GBP as the kind of "guide price" on every item and in the cart? That would be a lot more elegant

Webdongle

  • Jr. Member
  • **
  • Posts: 99
Re: Multi-currency store : wrong currency on paypal interface
« Reply #18 on: March 06, 2009, 13:40:29 pm »
Sorry did not mean to imply that you are a retard.  I now see your problem, you need to set prefferences in paypal.  Personaly i would just leave all as £ on VM and have a page linking to an example exchange rate and have a disclaimer saying the rate varies.



[attachment cleanup by admin]
When I'm right no one remembers but when I'm wrong no one forgets  :'(

yorkweb

  • Beginner
  • *
  • Posts: 1
Re: Multi-currency store : wrong currency on paypal interface
« Reply #19 on: April 10, 2009, 13:25:49 pm »
Having had this exact issue I found this thread whilst trying to find a fix.

In my experience although the idea of forcing one currency and giving a currency comparison "page" for people to look at is a valid solution, it is also extremely off putting for a customer wishing to pay in their own currency - not only that but its also forcing them to quite visually bare the currency conversion cost (as others have suggested could be the root problem with this).

The solution I have come up with seems to deal with the problem reasonably well - I'm no php expert so if anyone can up with something better then lets do it, but it's working on my sites and stopping me losing money.

I have simply created a variable to use in the paypal array combined with some if statements to check which product_currency should be passed. I've found that by passing the actual currency code instead of the product_currency stored in $_SESSION it seems to do the trick:

$mycash = "";
if ($_SESSION['product_currency'] == "GBP" )
      {
      $mycash = "GBP";
      }
elseif ($_SESSION['product_currency'] == "USD" )
      {
      $mycash = "USD";
      }
else
{$mycash = "EUR";}


$url = "https://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_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $mycash,

craiggunn

  • Beginner
  • *
  • Posts: 3
Re: Multi-currency store : wrong currency on paypal interface
« Reply #20 on: April 16, 2009, 11:45:49 am »
tried the above, and it seems to work, thanks yorkweb, this was becoming a major issue for me!

chac416

  • Jr. Member
  • **
  • Posts: 80
Re: Multi-currency store : wrong currency on paypal interface
« Reply #21 on: May 04, 2009, 18:44:08 pm »
which file did you edit, and which lines?

Having had this exact issue I found this thread whilst trying to find a fix.

In my experience although the idea of forcing one currency and giving a currency comparison "page" for people to look at is a valid solution, it is also extremely off putting for a customer wishing to pay in their own currency - not only that but its also forcing them to quite visually bare the currency conversion cost (as others have suggested could be the root problem with this).

The solution I have come up with seems to deal with the problem reasonably well - I'm no php expert so if anyone can up with something better then lets do it, but it's working on my sites and stopping me losing money.

I have simply created a variable to use in the paypal array combined with some if statements to check which product_currency should be passed. I've found that by passing the actual currency code instead of the product_currency stored in $_SESSION it seems to do the trick:

$mycash = "";
if ($_SESSION['product_currency'] == "GBP" )
      {
      $mycash = "GBP";
      }
elseif ($_SESSION['product_currency'] == "USD" )
      {
      $mycash = "USD";
      }
else
{$mycash = "EUR";}


$url = "https://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_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $mycash,

ufo_hk

  • Jr. Member
  • **
  • Posts: 79
    • 4success Ltd
Re: Multi-currency store : wrong currency on paypal interface
« Reply #22 on: June 08, 2009, 02:35:26 am »
Ok I need to ask again as this is a major issue, currently using VM 1.1.2 and decided to test with Beta VM 1.1.4 but see the same results.

Where a site is using the multi-currency module on the site, when accepting paypal payments, on the first order the currency sent to paypal is USD not the currency selected/displayed on the site.

Note: i also applied the change:
"currency_code" => $_SESSION['vendor_currency']
to
"currency_code" => $_SESSION['product_currency']

Does anyone have a successful solution to this issue, which seems to have been around for a while. Surely someone has the multi-currency module working correctly with paypal.

Thanks

creagenzia

  • Beginner
  • *
  • Posts: 3
Re: Multi-currency store : wrong currency on paypal interface
« Reply #23 on: July 02, 2009, 20:08:20 pm »
having the same issue - running VM 1.1.3 on Joomla 1.5.10

Problem: selected currency is showed correctly in cart and on order confirmation, but booked as store currency in PayPal.

Standard Shipping Module seems to convert into selected currency, then use new value as store currency and convert once more. this amount is finally also booked in store currency.(...great I get more on shipping!!!)

this behavious renders currency conversion useless and puts off customers.

Looks like a very old issue with quite a number of VM users and that still has not experienced any fixing???? Simply incomprehensible how such a grave bug can be ignored so consistently by the devteam...

thought I write my experience here just to state that there is another currency victim out there :-(

haven't tried yorkwebs fix and go with chac416 wanting to know as WHERE to apply this fix - this info would maybe help to alleviate the pain a bit...

Thanks

Nded

  • Beginner
  • *
  • Posts: 7
Re: Multi-currency store : wrong currency on paypal interface
« Reply #24 on: July 27, 2009, 21:53:35 pm »
I just applied this $mycash fix to my VM 1.3 Joomla 1.5 store and it seems to be perfect.  I blended it with the improved PayPal screen generator at http://www.gjcwebdesign.com/configuration-paypal-payment-module-virtuemart.html to get a very good finished product.

Nded

  • Beginner
  • *
  • Posts: 7
Re: Multi-currency store : wrong currency on paypal interface
« Reply #25 on: July 27, 2009, 22:02:56 pm »
Here is my PayPal "Payment Extra Info" field with the improved PayPal output and the Multi-Currency patch $mycash applied:

Quote
<?php

$mycash = "";
if ($_SESSION['product_currency'] == "GBP" )
      {
      $mycash = "GBP";
      }
elseif ($_SESSION['product_currency'] == "AUD" )
      {
      $mycash = "AUD";
      }
elseif ($_SESSION['product_currency'] == "CAD" )
      {
      $mycash = "CAD";
      }
elseif ($_SESSION['product_currency'] == "EUR" )
      {
      $mycash = "EUR";
      }
else
{$mycash = "USD";}

$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();
 
//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();
 
//logic for applying discounts to multiple items
$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_quantity, 2);
  }
  else {
    $disc_perItem = 0;
  }
}
else {
  $disc_perItem = 0;
}
//query to optain product attributes
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_value, 0, strpos($attributes_value, ':')), " ");
      $supp_var['on' . $z . '_' . $i] = $attrib_name;
      $attrib_sel = trim(substr_replace(substr_replace($attributes_value, "", 0, strrpos

($attributes_value, ':')), "", 0, 2));
      $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++;
}
 
 
//Query used to find whether to use Bill Address or Ship 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");
}
 
// Builds array for the form
$post_variables = Array(
"cmd" => "_cart",
"upload" => "1",
"page_style" => "paypal",
"business" => PAYPAL_EMAIL,
"currency_code" => $mycash,
"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"handling_cart" => sprintf("%.2f", $db->f("order_shipping")),
"tax" => $tax_total,
"tax_cart" => $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",//change this to 0 if you have - Paypal does not allow your country of residence to ship to the country you wish to - errors
"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
);
//add and send the new variables
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!">';
//Change the above image url for different languages and countries
  echo '</form>';
}
?>

It really is amazing that the Virtuemart development team is overlooking this major bug.

atrus

  • Jr. Member
  • **
  • Posts: 127
Re: Multi-currency store : wrong currency on paypal interface
« Reply #26 on: July 31, 2009, 15:33:52 pm »
Good job with Multi-Currency patch $mycash! It certainly works better. However i'm facing problems with the shipping & handling fees.

More specifically:

Store Default Currency: Euro

Shipping Fees (Standard Module) are input in Euro.

Now,whenever pressing confirm to go to Paypal, everything is passed properly, including the currency, however the shipping and handling fees in Paypal are wrong (even though Virtuemart has calculated them correctly in the checkout page). Pls note that this happens with all other currencies except for the default one!

After a small investigation i found out that the shipping & handling fees are re-multiplied by the exchange rate of the default store's currency and the one the customer is using immediately after pressing the confirm button to go to paypal. The problem is actually with the order_shipping variable passed to Paypal; seems like a Virtuemart's bug.

Anybody found a workaround to the problem?

Working with Joomla 1.5.8 and Virtuemart 1.1.2

Nded

  • Beginner
  • *
  • Posts: 7
Re: Multi-currency store : wrong currency on paypal interface
« Reply #27 on: July 31, 2009, 18:40:43 pm »
Good job with Multi-Currency patch $mycash! It certainly works better. However i'm facing problems with the shipping & handling fees.

More specifically:

Store Default Currency: Euro

Shipping Fees (Standard Module) are input in Euro.

Now,whenever pressing confirm to go to Paypal, everything is passed properly, including the currency, however the shipping and handling fees in Paypal are wrong (even though Virtuemart has calculated them correctly in the checkout page). Pls note that this happens with all other currencies except for the default one!

After a small investigation i found out that the shipping & handling fees are re-multiplied by the exchange rate of the default store's currency and the one the customer is using immediately after pressing the confirm button to go to paypal. The problem is actually with the order_shipping variable passed to Paypal; seems like a Virtuemart's bug.

Anybody found a workaround to the problem?

Working with Joomla 1.5.8 and Virtuemart 1.1.2

I started a new thread recently about this "other" currency problem - http://forum.virtuemart.net/index.php?topic=58532.msg191822#msg191822

atrus

  • Jr. Member
  • **
  • Posts: 127
Re: Multi-currency store : wrong currency on paypal interface
« Reply #28 on: August 02, 2009, 20:35:50 pm »
Nded, for your info, i solved my problem as follows:

Replace line 1599 in file ps_checkout.php (\administrator\components\com_virtuemart\classes) as follows:

//$d['shipping_total'] = $GLOBALS['CURRENCY']->convert( $d['shipping_total'] );

This line seems to be doing the unessecary 2nd conversion which messes everything up. That's why i removed it. Now everything works like a charm.

I hope this will be rectified in the next VM release.

cybersalt

  • Beginner
  • *
  • Posts: 1
Re: Multi-currency store : wrong currency on paypal interface
« Reply #29 on: August 03, 2009, 19:21:53 pm »
Just in case anyone is confused - as initially was - this was line 1596 for me.

Basically you need to find the line below without the "//" and add "//" to the beginning. ::)




Nded, for your info, i solved my problem as follows:

Replace line 1599 in file ps_checkout.php (\administrator\components\com_virtuemart\classes) as follows:

//$d['shipping_total'] = $GLOBALS['CURRENCY']->convert( $d['shipping_total'] );

This line seems to be doing the unessecary 2nd conversion which messes everything up. That's why i removed it. Now everything works like a charm.

I hope this will be rectified in the next VM release.