Results 1 to 7 of 7
  1. #1
    Join Date
    May 2007
    Posts
    33
    Plugin Contributions
    0

    Default Currency Help with Paypal IPN

    Hi, I'm having some difficulties kinda like the person with the Canadian dollars just a couple threads down.

    But basically my problem is this, in my shopping cart my currencies are displayed in Swedish Krona, currency code is SEK I believe. So once someone has say 129 kr worth of items, they check out, and for some reason when they enter their credit card information, they are charged 138.9 kr instead.

    So what happens is that for some reason my customers are paying different amount from what my shopping cart told them that they would pay. In my paypal account I would just receive them in USD. I'm guessing my website is sending shopping cart info in USD with the conversion rate I pre-set? To further describe my problem, here is the detailed description of error.

    Customer sees 129 kr. In my currency settings, 1 kr = 0.15 USD. So cart displays 129 kr, zen cart recognizes as 129 * 0.15 = $19.35 USD. It seems like $19.35 is the data being transmitted to paypal, which THEY convert back into SEK using a current exchange rate such as 1 USD = 7.175 SEK so it comes out to be $19.35 x 7.175 = 138.8 SEK (And this is how much the customer ends up paying)

    I called paypal and they gave me something about how I need to edit certain line in the html code to set "buttons" or change some currency code, I've read the integration guide and to be honest I'm clueless.

    So what I really want to do is just have zencart ask paypal "hey 129 kr is what we charge, and whatever the exchange rate let the seller bear the cost"

    How would I approach this? Help please! My customers are over paying!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Currency Help with Paypal IPN

    In your Zen Cart paypal settings, choose "Selected Currency" instead of "Only ZZZ" (where ZZZ is any currency)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    May 2007
    Posts
    33
    Plugin Contributions
    0

    Default Re: Currency Help with Paypal IPN

    Thanks for the fast reply. It was already under selected currencies. Yet for some reason it didn't work. I double checked my currencies too, Swedish Krona is set as default and the currency code is SEK, which I check is also correct. But for some reason it still charges people in USD. But here is a bit of update:

    I screwed around with the paypal.php file in the modules/payment folder. And I was looking at this:
    if (!in_array(strtolower($_SESSION['languages_code']), array('en', 'us', 'it', 'fr', 'es', 'de'))) {
    $lang_code = 'us';
    }
    if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
    $my_currency = $_SESSION['currency'];
    } else {
    $my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
    }
    if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
    $my_currency = 'USD';

    I took the liberty and changed it to this:

    if (!in_array(strtolower($_SESSION['languages_code']), array('en', 'us', 'it', 'fr', 'es', 'de'))) {
    $lang_code = 'us';
    }
    if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
    $my_currency = $_SESSION['currency'];
    } else {
    $my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
    }
    if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
    $my_currency = 'SEK';


    And now the payment works, they get charged the right amount cause I used a Swedish credit card to test it out, HOWEVER, I no longer get order confirmation email, and the admin panel does not even register the order and the product is not deducted...

    So it's either, pay the wrong amount, but order gets registered, or pay the right amount, but inventory not deducted and order never came through.

    I've already wasted $2 USD on paypal fees just testing this out... I'd rather donate money to the forums for helping me out than paying Paypal just so I can redo my futile attempts.
    Last edited by Eizual; 20 Jun 2007 at 06:54 PM.

  4. #4
    Join Date
    May 2007
    Posts
    33
    Plugin Contributions
    0

    Default Re: Currency Help with Paypal IPN

    Ok another quick update with some information so maybe people can help me brainstorm together...

    So I went into my currencies, deleted USD as a currency, and as I try checking out via Swedish Kronor, once it got to the paypal website, it now says $0.00 dollars (yay free items).

    So for some reason I'm guessing the problem lies in the fact that my zen cart is stubborn and communicates only in USD with paypal. I triple checked the currency code and its SEK in my settings and SEK is the correct code. Paypal also do accept SEK as a currency, my experiment in my last post also proved that...

    At this point I don't mind just accepting Swedish Kronor as my only currency if I can't get it to configure correctly in zen cart. I don't mind just hard coding it in the IPN module files (there are several) and make it just default Swedish kronor and yet keep my website functional with order confirmation e-mails and orders actually being registered.

    Any help would be appreciated!

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Currency Help with Paypal IPN

    You are using obsolete code.
    Support for PayPal's 17 currencies, including SEK was added in v1.3.7.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    May 2007
    Posts
    33
    Plugin Contributions
    0

    Default Re: Currency Help with Paypal IPN

    I thought about that too, but checking my version info I found:
    Zen Cart 1.3.7

    Database Patch Level: 1.3.7

    v1.3.7 [2007-05-17 23:20:59] (Fresh Installation)

    So my zen cart is up to date, but maybe the module isn't?

    This line just doesn't make any sense in the paypal.php
    if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
    $my_currency = 'USD';

    it's saying if $my_currency = SEK, and if it's not in that array above and it defaults back to USD? I'm not much of a web programmer but that's what it looks like to me, I could be wrong?

    But I've did that thing in my previous post, forcing it to become $my_currency = 'SEK';

    I did a transaction in debug mode, and my order did not show up in admin panel and there was no confirmation e-mail. The debug mode got to step 13 which said:

    IPN WARNING::Currency/Amount Mismatch. Details:
    PayPal email address = bettieee######################
    | mc_currency = SEK
    | submitted_currency = USD
    | order_currency = SEK
    | mc_gross = 88.00
    | converted_amount = 13.20
    | order_amount = 88

    I think thats when the whole thing just stops hence I don't get any e-mail. So I went into paypal_functions.php to see where the code ended...

    if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
    $my_currency = $_SESSION['currency'];
    } else {
    $my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
    }
    $ec_currencies = array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD', 'CHF', 'CZK', 'DKK', 'HKD', 'HUF', 'NOK', 'NZD', 'PLN', 'SEK', 'SGD', 'THB');
    $basic_currencies = array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD');
    $currency_list = ($_POST['txn_type'] == 'express-checkout') ? $ec_currencies : $basic_currencies;
    if (!in_array($my_currency, $currency_list)) {
    $my_currency = 'USD';
    }
    $transaction_amount = number_format(($amount) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
    if ( ($_POST['mc_currency'] != $my_currency) || ($_POST['mc_gross'] != $transaction_amount && $_POST['mc_gross'] != -0.01) && MODULE_PAYMENT_PAYPAL_TESTING != 'Test' ) {
    ipn_debug_email('IPN WARNING::Currency/Amount Mismatch. Details: ' . "\n" . 'PayPal email address = ' . $_POST['business'] . "\n" . ' | mc_currency = ' . $_POST['mc_currency'] . "\n" . ' | submitted_currency = ' . $my_currency . "\n" . ' | order_currency = ' . $currency . "\n" . ' | mc_gross = ' . $_POST['mc_gross'] . "\n" . ' | converted_amount = ' . $transaction_amount . "\n" . ' | order_amount = ' . $amount );
    return false;
    }
    return true;
    }


    The part in blue is basically the error I'm getting from debug mode.

    And I still think the culprit is in red

    After all $my_currency = USD according to the debug e-mail. I think I can fix this problem some where in here.. but I don't know how, and I'm not sure why the correct configuration in admin panel doesn't work automatically to begin with...


  7. #7
    Join Date
    May 2007
    Posts
    33
    Plugin Contributions
    0

    Default Re: Currency Help with Paypal IPN

    Ok last update, I post in my own thread way too much =)

    So I just made 1 line changes each in the paypal.php and paypal_function.php

    I just made it so that If blah blah blah, then else $my_currency = "sek" as highlighted red in above.

    It worked! I guess I forced it to use SEK as default, which it very well should be since that's what I set it as under admin panel! Thanks for all your help. I just hope this doesn't cripple the English side of my website.

 

 

Similar Threads

  1. PayPal IPN Currency/Amount Mismatch: converted_amount
    By beetree in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 23 Sep 2009, 01:01 AM
  2. Help with paypal IPN (urgent help needed!)
    By roy(irishtaxi) in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 10 Jun 2008, 07:06 AM
  3. Help with paypal IPN please
    By funtimesx in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 31 Oct 2007, 02:58 PM
  4. Help with Paypal IPN
    By Eizual in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 25 Oct 2007, 07:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg