Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2005
    Location
    Austria
    Posts
    104
    Plugin Contributions
    6

    bug [Done v1.5.0] PayPal Express: Item details are shown as Tax included in prices: 0 (0)

    Zen-Cart 1.3.9h
    Fresh installation
    No addons

    Issue:
    Some Products (depending on price and tax rate) are shown in PayPal Express as:
    Tax included in prices: 0 (0)

    How to recreate this issue:

    Set Configuration > My Store > Display Prices with Tax > true
    Set your tax rate to 19%
    Set your currency to EUR
    This is the configuration for almost all German shops as the German VAT is 19% (or for some products 7%)
    Create a product with the following price:
    Products Price (Gross): 0.90
    Tax Class: 20%
    The net price will be: 0.7563

    Add this product to your cart and checkout with PayPal Express

    The PayPal website will show the content of your cart as:
    Tax included in prices: 0 (0)

    In the PayPal log you will find:
    Code:
    getLineItemDetails 5
    Line-item subtotals do not add up properly. Line-item-details skipped.
    0.9 0Array
    (
        [AMT] => 0.9
        [ITEMAMT] => 0.9
        [TAXAMT] => 0
        [SHIPPINGAMT] => 0
        [SHIPDISCAMT] => 0
        [HANDLINGAMT] => 0
        [INSURANCEAMT] => 0
        [L_NUMBER0] => 1234567
        [L_NAME0] => Testproduct 
        [L_AMT0] => 0.899997
        [L_QTY0] => 1
    )
    Notice the difference between AMT and L_AMT0

    Create a product with the following price:
    Products Price (Gross): 1.19
    Tax Class: 20%
    The net price will be: 1.0000

    Add this product to your cart and checkout with PayPal Express

    The PayPal website will show the content of your cart as it should be

    In the log you will see:
    [CODE]
    [AMT] => 1.19
    [ITEMAMT] => 1.19
    [TAXAMT] => 0
    [SHIPPINGAMT] => 0
    [SHIPDISCAMT] => 0
    [HANDLINGAMT] => 0
    [INSURANCEAMT] => 0
    [L_NUMBER0] => KABHD40PIN
    [L_NAME0] => Testproduct
    [L_AMT0] => 1.19
    [L_QTY0] => 1
    [CODE]

    According to the PayPal Express API documentation:
    Regardless of the specified currency, the format must have decimal point with exactly two digits to the right

    This is not the case in the current code, so we suggest the following change in includes/modules/payment/paypalwpp.php

    change around line 1192

    from
    Code:
    $optionsLI["L_AMT$k"] = $order->products[$i]['final_price'];
    $optionsLI["L_QTY$k"] = $order->products[$i]['qty'];
    $optionsLI["L_TAXAMT$k"] = zen_calculate_tax(1 * $order->products[$i]['final_price'], $order->products[$i]['tax']);
    to
    Code:
    $optionsLI["L_AMT$k"] = round($order->products[$i]['final_price'], 2);
    $optionsLI["L_QTY$k"] = $order->products[$i]['qty'];
    $optionsLI["L_TAXAMT$k"] = round(zen_calculate_tax(1 * $order->products[$i]['final_price'], $order->products[$i]['tax']), 2);
    After this change checkout again the 0.90 Euro product and now the product is shown in PayPal correctly as there is no difference between AMT and L_AMT0 anymore

    hugo13 and webchills

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: PayPal Express: Item details are shown as Tax included in prices: 0 (0)

    That's a good fix. I saw this happen in some testing I was doing a couple days ago but didn't have time to tackle it yet. Thanks.

    I would suggest two variations on your proposed fix though:
    - use zen_round() instead of round()
    - use the number of decimal places defined by the selected currency, instead of hard-coding it to 2. The system changes it to 2 later where needed.
    .

    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
    Sep 2005
    Location
    Austria
    Posts
    104
    Plugin Contributions
    6

    bug Re: [Done v1.5.0] PayPal Express: Item details are shown as Tax included in prices: 0

    Unfortunately our fix did not fix the issue in all cases.
    Try the 0.90 Euro example above, but put 3 units of it in your cart and see what happens at PayPal...


    Here is a better fix which works fine for the 3 x 0.90 Euro example above and for other amounts as well:

    Change from
    Code:
    // PayPal can't handle partial-quantity values, so fudge it here
          if ($flag_treat_as_partial || $order->products[$i]['qty'] != (int)$order->products[$i]['qty']) {
            $optionsLI["L_NAME$k"] = '('.$order->products[$i]['qty'].' x ) ' . $optionsLI["L_NAME$k"];
            $optionsLI["L_AMT$k"] = zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
            $optionsLI["L_TAXAMT$k"] = zen_calculate_tax(zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), $order->products[$i]['tax']);
            $optionsLI["L_QTY$k"] = 1;
          } else {
            $optionsLI["L_AMT$k"] = $order->products[$i]['final_price'];
            $optionsLI["L_QTY$k"] = $order->products[$i]['qty'];
            $optionsLI["L_TAXAMT$k"] = zen_calculate_tax(1 * $order->products[$i]['final_price'], $order->products[$i]['tax']);
          }
    to
    Code:
    // PayPal can't handle partial-quantity values, so fudge it here
          if ($flag_treat_as_partial || $order->products[$i]['qty'] != (int)$order->products[$i]['qty']) {
            $optionsLI["L_NAME$k"] = '('.$order->products[$i]['qty'].' x ) ' . $optionsLI["L_NAME$k"];
             // r.l.3
            $optionsLI["L_AMT$k"] = round(zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), 2);
            $optionsLI["L_TAXAMT$k"] = round(zen_calculate_tax(zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), $order->products[$i]['tax']), 2);
            $optionsLI["L_QTY$k"] = 1;
          } else {
            // !!! r.l.2
            $optionsLI["L_AMT$k"] = round($order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
            $optionsLI["L_QTY$k"] = $order->products[$i]['qty'];
            // !!! r.l.1
            $optionsLI["L_TAXAMT$k"] = round(zen_calculate_tax(1 * $order->products[$i]['final_price'], $order->products[$i]['tax']), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
          }
          #die('decplaces: ' . $currencies->currencies[$_SESSION['currency']]['decimal_places']);

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Done v1.5.0] PayPal Express: Item details are shown as Tax included in prices: 0

    Rounding and then re-rounding over again?
    .

    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.

  5. #5
    Join Date
    Sep 2005
    Location
    Austria
    Posts
    104
    Plugin Contributions
    6

    Default Re: [Done v1.5.0] PayPal Express: Item details are shown as Tax included in prices: 0

    Try it with the 3 x 0.90 product. First fix does not work, second works

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Done v1.5.0] PayPal Express: Item details are shown as Tax included in prices: 0

    Quote Originally Posted by webchills View Post
    Set your tax rate to 19%
    Set your currency to EUR
    This is the configuration for almost all German shops as the German VAT is 19% (or for some products 7%)
    Create a product with the following price:
    Products Price (Gross): 0.90
    Tax Class: 20%
    You're talking about 3 different tax rates while setting up a single product.
    Which is the *real* one in your example? Is it 19%? 7%? 20%?
    .

    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.

  7. #7
    Join Date
    Sep 2005
    Location
    Austria
    Posts
    104
    Plugin Contributions
    6

    Default Re: [Done v1.5.0] PayPal Express: Item details are shown as Tax included in prices: 0

    sorry 20% was a typo

    Corrected version:
    Set Configuration > My Store > Display Prices with Tax > true
    Set your tax rate/tax class to 19%
    Set your currency to EUR (with decimal places = 2)
    This is the configuration for almost all German shops as the German VAT is 19% (or for some products 7%)
    Create a product with the following price:
    Products Price (Gross): 0.90
    Tax Class: 19%
    The net price will be: 0.7563

  8. #8
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Done v1.5.0] PayPal Express: Item details are shown as Tax included in prices: 0

    Quote Originally Posted by webchills View Post
    Try the 0.90 Euro example above, but put 3 units of it in your cart and see what happens at PayPal...
    Can't replicate a problem. It comes through as 2.70 every time.
    .

    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.

  9. #9
    Join Date
    Sep 2005
    Location
    Austria
    Posts
    104
    Plugin Contributions
    6

    Default Re: [Done v1.5.0] PayPal Express: Item details are shown as Tax included in prices: 0

    How to recreate the issue

    1)
    Set Configuration > My Store > Display Prices with Tax > true
    Set your tax rate/tax class to 19%
    Set your currency to EUR (with decimal places = 2)
    Change the price of Matrox G200 MMS from the demo data to:
    Products Price (Gross): 0.90
    Tax Class: 19%
    The net price will be: 0.7563


    2)
    Add 1 unit of the Matrox to your cart:

    Checkout with PayPal Express

    3)
    The cart on the left on the PayPal website will not show the item description, but will show it as Tax included in prices: 0 (0) instead:


    4)
    Now change the quantity to 3 units:

    Checkout with PayPal Express
    You will get the same wrong result

    We have a problem, right?

    5)
    Apply the following change to includes/modules/payment/paypalwpp.php an change around line 1183 from:
    Code:
    // PayPal can't handle partial-quantity values, so fudge it here
          if ($flag_treat_as_partial || $order->products[$i]['qty'] != (int)$order->products[$i]['qty']) {
            $optionsLI["L_NAME$k"] = '('.$order->products[$i]['qty'].' x ) ' . $optionsLI["L_NAME$k"];
            $optionsLI["L_AMT$k"] = zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
            $optionsLI["L_TAXAMT$k"] = zen_calculate_tax(zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), $order->products[$i]['tax']);
            $optionsLI["L_QTY$k"] = 1;
          } else {
            $optionsLI["L_AMT$k"] = $order->products[$i]['final_price'];
            $optionsLI["L_QTY$k"] = $order->products[$i]['qty'];
            $optionsLI["L_TAXAMT$k"] = zen_calculate_tax(1 * $order->products[$i]['final_price'], $order->products[$i]['tax']);
          }
    to
    Code:
    // PayPal can't handle partial-quantity values, so fudge it here
          if ($flag_treat_as_partial || $order->products[$i]['qty'] != (int)$order->products[$i]['qty']) {
            $optionsLI["L_NAME$k"] = '('.$order->products[$i]['qty'].' x ) ' . $optionsLI["L_NAME$k"];
            // r.l.3
            $optionsLI["L_AMT$k"] = round(zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), 2);
            $optionsLI["L_TAXAMT$k"] = round(zen_calculate_tax(zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), $order->products[$i]['tax']), 2);
            $optionsLI["L_QTY$k"] = 1;
          } else {
            // !!! r.l.2
            $optionsLI["L_AMT$k"] = round($order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
            $optionsLI["L_QTY$k"] = $order->products[$i]['qty'];
             // !!! r.l.1
            $optionsLI["L_TAXAMT$k"] = round(zen_calculate_tax(1 * $order->products[$i]['final_price'], $order->products[$i]['tax']), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
          }
          #die('decplaces: ' . $currencies->currencies[$_SESSION['currency']]['decimal_places']);
    6) Now checkout the 1 unit of the Matrox again and the result on the PayPal website will be as it should be:


    7) Now checkout the 3 units of the Matrox again and the result on the PayPal website will be fine too:

 

 

Similar Threads

  1. v154 PayPal Express Checkout: Interaction with My Store->Display Prices w/ Tax
    By lat9 in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 3 Oct 2015, 07:31 PM
  2. Replies: 16
    Last Post: 8 Jul 2010, 08:51 PM
  3. reopen thread [Done v1.3.9] Discount groups and tax calc problem with tax-included pr
    By antonios in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 1 Jul 2010, 06:12 PM
  4. Replies: 26
    Last Post: 19 Mar 2010, 04:45 PM
  5. Replies: 7
    Last Post: 8 Feb 2010, 08:26 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR