Zen Cart Logo
Forums / Addon Payment Modules / currency incorrectly converted at paypal via payflow pro

currency incorrectly converted at paypal via payflow pro

Locked

Views: 8,981

Results 1 to 20 of 21
This thread is locked. New replies are disabled.
13 Apr 2008, 7:20 PM
#1
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

currency incorrectly converted at paypal via payflow pro

I've got a problem with currency conversion. I offer payment in US dollars, euros and canadian dollars.

Customers can select the currency they like and checkout. All the while they see properly converted currency amounts. They get an email from the store stating the amount paid in the currency they choose.

Here is what my store shows a customer paid: 821.01EUR

Here is what paypal said the cutomer paid: 1298.92

What it appears to be occurring is that the 821.01 is seen as us dollars and converted to EU at the current exchange rate.

I use payflow pro and have included a copy of the debug email.

When people use EU currency and pay via paypal express the amount is correct.

I'm not able to do a test run in EU currency since I am the store owner. if someone could make a test purchase to the point of getting to paypal but not actually submitting payment-- perhaps you could see whats up.

I'd appreciate any help

Tom

payflow.verisign.com 443 "TRXTYPE=S
&TENDER=C
&USER=*****
&PWD=*****
&VENDOR=*****
&PARTNER=*****
&VERBOSITY=MEDIUM
&ACCT=4539XXXXXXXXxxxx
&EXPDATE=xxx
&CVV2=xxx
&AMT=1298.92
&CURRENCY=EUR
&COMMENT1[7]=( 93 )
&COMMENT2[137]= (FedEx International Priority
®)272.96 ZenSessName:zenid ZenSessID:e9a17364511d940e8fe60442ddf5e256
&INVNUM=Order:15914Cust:15995
&CUSTREF=Order:15914_Cust:15995_Time:0.88498200 1208105164
&NAME[14]=xxx xxx
&LASTNAME=xxx
&STREET=via xxx 31
&CITY=capriolo
&STATE=
&ZIP=25031
&COUNTRY=Italy
&SHIPTOFIRSTNAME=xxx
&SHIPTOLASTNAME=xxx
&SHIPTOSTREET=via xxx 31
&SHIPTOCITY=capriolo
&SHIPTOSTATE=
&SHIPTOZIP=25031
&SHIPTOCOUNTRY=Italy" 30 payflow.verisign.com
0

13 Apr 2008, 8:51 PM
#2
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

I made an error in requesting the following:

"I'm not able to do a test run in EU currency since I am the store owner. if someone could make a test purchase to the point of getting to paypal but not actually submitting payment-- perhaps you could see whats up."

The problem only occurs when selecting the credit card payment option-- which is payflowpro.

Tom

13 Apr 2008, 9:07 PM
#3
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

Is the problem this bit of code (below) in payflowpro.php?

It seems like its saying if the currency is 'CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD' then change it to USD

Tom

// TRANSACTION INFO
$state_name_billing = $db->Execute("select zone_code from " . TABLE_ZONES . " where zone_name = '" . $order->billing['state'] . "'");
$state_name_shipping = $db->Execute("select zone_code from " . TABLE_ZONES . " where zone_name = '" . $order->delivery['state'] . "'");
$my_currency = $order->info['currency'];
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
$my_currency = 'USD';
}

  $transaction = array(
                      'TRXTYPE' => ((MODULE_PAYMENT_PAYFLOWPRO_TYPE == 'Authorization') ? 'A' : 'S'),
                      'TENDER'  => "C",
                      'USER'    => MODULE_PAYMENT_PAYFLOWPRO_USER,
                      'PWD'     => MODULE_PAYMENT_PAYFLOWPRO_PWD,
                      'VENDOR'  => MODULE_PAYMENT_PAYFLOWPRO_VENDOR,
                      'PARTNER' => MODULE_PAYMENT_PAYFLOWPRO_PARTNER,
                      'VERBOSITY' => ($this->debug=='ON' ? 'MEDIUM' : 'LOW'),

                      // ORDER INFO
                      'ACCT'    => $order->info['cc_number'],
                      'EXPDATE' => $order->info['cc_expires'],
                      'CVV2'    => $order->info['cc_cvv'],
                      'AMT'     => number_format($order->info['total'], 2,'.',''), 
                      'CURRENCY'=> $my_currency,
                      'COMMENT1'=> "( ".$_SESSION['cart']->count_contents(). " ) ". str_replace('&','',$order->info['comments']) ,
                      'COMMENT2'=> $order->info['shipping_method']. $order->info['shipping_cost']. '  ZenSessName:' . zen_session_name(). ' ZenSessID:' . zen_session_id(),
                      'INVNUM'  => 'Cust:' . $_SESSION['customer_id'] . ' Order:' . $new_order_id ,
                      'CUSTREF' => 'Order:' . $new_order_id .'_Cust:' . $_SESSION['customer_id'] . '_Time:' . microtime(),
13 Apr 2008, 9:49 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: currency incorrectly converted at paypal via payflow pro

tomarriola:

Is the problem this bit of code (below) in payflowpro.php?

It seems like its saying if the currency is 'CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD' then change it to USD

Tom

...

  $my_currency = $order->info['currency'];
  if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
    $my_currency = 'USD';
  }

No, that code is saying if it's not one of those currencies, then use USD.

13 Apr 2008, 11:16 PM
#5
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

I know you're a busy man Dr, but would you have to to look thru the payflowpro file to see why submitted a converted currency amount is again converted?

Admittedly it makes me money some extra cash -- but thats not the way I roll :)

Tom

14 Apr 2008, 6:05 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: currency incorrectly converted at paypal via payflow pro

I will look into it. But first must get some sleep.

19 Apr 2008, 2:56 PM
#7
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

I'm still getting too much cash when people pay me with EUR. The amt is converted correctly on the store but is presented to paypal in a manner that gets it converted again.

Tom

23 Apr 2008, 3:17 AM
#8
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

With EUR I get more money than I should. With Canadian cash I get less.

A customer just had an order for 46.99 Canadian. This is the total from the shopping cart and from the email the store sent them.

However, payment via payflow pro tells me they paid $46.00 Canadian.

The 46.99 Canadian was again treated like dollars and converted to Canadian dollars-- ignoring the fact that it had already been converted.

I'm bummed and hoping for help

Tom

29 Apr 2008, 1:13 AM
#9
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

I'm not able to remedy this problem without help from the usual zenmasters.

Please

Tom

PS, There has been no reply anywhere else I've posted about this. Am I an idiot for being bothered about zencart/payflowpro overcharging? Is the silence telling me to shut and accept the extra cash?

5 May 2008, 8:01 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: currency incorrectly converted at paypal via payflow pro

Apologies for the delay in responding.

Interestingly the Express Checkout module uses the very same logic for currency selection and conversion/exchange, yet works fine.

I must ask some questions:

  1. In your Payflow Pro module, what have you selected for Currency preferences?
  2. Which currencies are enabled in your store?
  3. Which currency is set as default?
  4. Which currency are you seeing these transactions "settled" in on the Payflow end? Are they showing up as EUR and CAD etc? or all in USD?
7 May 2008, 5:10 PM
#11
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

Thanks DR!

  1. In your Payflow Pro module, what have you selected for Currency preferences?

I don't have this option in the payflowpro module

I tried removing and reinstalling to see if this appears without luck.

Here are my settings:
Enable PayFlow Pro Module
True

Merchant Login for Payflow Pro
xxxx

User Login for Payflow Pro
xxxx

Password for PayFlow Pro
xxxx

Partner ID for Payflow Pro
xxxx

Activation Mode for PayFlow Pro
Live

Transaction Method
Sale

Sort order of display
85

Payment Zone
--none--

Set Order Status
Processing [2]

Set Pre-Auth Order Status
Pending [1]

PayFlow Pro Certificate Path
/var/xxx/www.xxx.com/xxx/xxx/includes/modules/payment/certs/

Debug Mode
Email

  1. Which currencies are enabled in your store?

CAD
EUR
USD

  1. Which currency is set as default?

USD

  1. Which currency are you seeing these transactions "settled" in on the Payflow end? Are they showing up as EUR and CAD etc? or all in USD?

They show up as settled in EUR or CAD but not USD.

I have attached 2 images of the invoice details from the store vrs the paypal transaction details page.

It appears the store invoice that was already 821.01 EUR was converted as if it was in dollars and charged as 1298.92 EUR. I then received 1938.53 USD for a purchase of 821.01 EUR. That doesn't add up

Thanks
Tom

8 May 2008, 8:54 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: currency incorrectly converted at paypal via payflow pro

Are you using the new version of the module for v1.3.8? http://www.zen-cart.com/forum/showthread.php?p=481988#post481988

If you're using the old one, I'm sorry I think I'm going to draw the line there, as it's known to be quirky.

8 May 2008, 11:03 AM
#13
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

I'm using version 1.3.7

My response is:

-I'm using very recent version of the cart, not some old creaky version 1.2.x

-Receiving the correct payment is an essential element of a shopping cart. I did not make a trivial request for cosmetic fixes or my own convenience.

-I've donated regularly to this cart, I don't freeload. But I do depend on the help of those that develop these modules, like you.

-If this is a matter of money and time I'll pay you. After all, some days I make hundreds extra in credit card charges.

Thanks

Tom

8 May 2008, 10:37 PM
#14
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

Let me add one more thing.

Please.

Thanks
Tom

9 May 2008, 2:17 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: currency incorrectly converted at paypal via payflow pro

The newer version has been largely rewritten to work smarter and handle more scenarios more consistently ... hence the move forward. The old version has been coddled for a couple years and badly in need of an update.

Nevertheless, you can try making the code additions and changes, as shown:
/includes/modules/payment/payflowpro.php
approx line

change from this:```
$my_currency = $order->info['currency'];
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
$my_currency = 'USD';
}

  $transaction = array(
                      'TRXTYPE' => ((MODULE_PAYMENT_PAYFLOWPRO_TYPE == 'Authorization') ? 'A' : 'S'),
                      'TENDER'  => "C",
                      'USER'    => MODULE_PAYMENT_PAYFLOWPRO_USER,
                      'PWD'     => MODULE_PAYMENT_PAYFLOWPRO_PWD,
                      'VENDOR'  => MODULE_PAYMENT_PAYFLOWPRO_VENDOR,
                      'PARTNER' => MODULE_PAYMENT_PAYFLOWPRO_PARTNER,
                      'VERBOSITY' => ($this->debug=='ON' ? 'MEDIUM' : 'LOW'),

                      // ORDER INFO
                      'ACCT'    => $order->info['cc_number'],
                      'EXPDATE' => $order->info['cc_expires'],
                      'CVV2'    => $order->info['cc_cvv'],
                      'AMT'     => number_format([B]$order->info['total'][/B], 2,'.',''),
                      'CURRENCY'=> $my_currency,

to this:
  $my_currency = $order->info['currency'];
  if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
    $my_currency = 'USD';
  }

[B] global $currencies;
$my_amount = $order->info['total'] * $currencies->get_value($my_currency);
[/B]

  $transaction = array(
                      'TRXTYPE' => ((MODULE_PAYMENT_PAYFLOWPRO_TYPE == 'Authorization') ? 'A' : 'S'),
                      'TENDER'  => "C",
                      'USER'    => MODULE_PAYMENT_PAYFLOWPRO_USER,
                      'PWD'     => MODULE_PAYMENT_PAYFLOWPRO_PWD,
                      'VENDOR'  => MODULE_PAYMENT_PAYFLOWPRO_VENDOR,
                      'PARTNER' => MODULE_PAYMENT_PAYFLOWPRO_PARTNER,
                      'VERBOSITY' => ($this->debug=='ON' ? 'MEDIUM' : 'LOW'),

                      // ORDER INFO
                      'ACCT'    => $order->info['cc_number'],
                      'EXPDATE' => $order->info['cc_expires'],
                      'CVV2'    => $order->info['cc_cvv'],
                      'AMT'     => number_format([B]$my_amount[/B], 2,'.',''),
                      'CURRENCY'=> $my_currency,
9 May 2008, 5:23 PM
#16
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

Thanks I really appreciate the help.

When I upgraded to 1.3.7 in the fall my girlfriend nearly broke up with me. If I upgrade to 1.3.8 so soon after the last lengthy upgrade she will leave for good. I'll upgrade to the latest zencart when she goes on vacation this summer. :)

I made the change and got this error after submitting a card:

Fatal error: Call to a member function on a non-object in /var/www/html/www.crimescene.com/web/store/includes/modules/payment/payflowpro.php on line 296

Line 296 is this line:
$my_amount = $order->info['total'] * $currencies->get_value($my_currency);

Is there anything further that can be done?

Thanks again

Tom

10 May 2008, 5:31 AM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: currency incorrectly converted at paypal via payflow pro

insert the following on a new line at 296:

global $currencies;

I've updated the previous post with this, too.

10 May 2008, 5:32 AM
#18
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: currency incorrectly converted at paypal via payflow pro

Keep in mind that you're going to have to manually make sure your currency exchange rates are kept up-to-date.

10 May 2008, 6:05 AM
#19
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

It worked. Thanks so much for fixing this problem. If there is payment or anything I can do for you personally for the effort please let me know via PM. In the meantime, I'll gladly make a donation to the zencart team immediately.

As for the currency update, I've got a cron job that runs daily to update the currency values. About 1/3 of my business comes from overseas and so the currency conversion has been a big issue.

Again, thank you, I am in your debt.

For anyone looking to solve this issue:
I have attached the fixed file. It also contains a fix I'd made earlier to a problem that prevented a repeat sale from a returning customer (It was using the customer number in place of the order number. This caused it to be declined since it appeared to be a duplicate order.)

Tom

1 Jul 2008, 11:08 PM
#20
sageplan avatar

sageplan

New Zenner

Join Date:
Oct 2005
Posts:
8
Plugin Contributions:
0

Re: currency incorrectly converted at paypal via payflow pro

I have a similar problem. My Store is set to use MXN (Mexican Pesos) by default, but Paypal is receiving or interpreting the amount as USD. I went about setting up MXN as Default currency on my PayPal account as well.

Thanks for your help!

EM