Jump to content

Paypal double taxes only with Vouchers/CartRules - (Solved)


Flakkak

Recommended Posts

Hi everyone,

 

As my shop is almost ready to open, I am facing this problem when offering a discount to customers.

 

The checkout cart is all good, but when the customer goes to the Paypal Checkout page to process to the payment, Paypal adds the taxes again.

 

This only occurs when offering a promo-code. When there is no discount, everything is fine and Paypal doesn't charge the tax twice.

 

Prestashop 1.5.4.1

Paypal Usa, Canada v.1.3.4

 

You can see the screenshots to understand what the problem is or try it yourself on my website with the promo code:

 

www.kayakdetail.com

promo code: kdouverture

 

I searched on forum to find a solution to this, but all I found was some code manipulations to problems when Paypal was always doubling taxes, which is not the case here.

 

Thanks a lot for your help !!

post-734599-0-98549000-1403190435_thumb.png

post-734599-0-86883900-1403190436_thumb.png

Edited by Flakkak (see edit history)
Link to comment
Share on other sites

looks like the module code has changed since that solution was posted

 

In v1.3.4 of paypalusa, the module does not include taxes in the product prices, so if you remove the tax line then taxes will not be sent to paypal

Below are the important code snippets.

 

1) This is from Prestashop's FrontController, which calculates the "show_taxes" variable used by the smarty template engine. 

'PS_TAX' determines if taxes are enabled in your store

'PS_TAX_DISPLAY' determines if taxes are displayed as a separate line item in the cart

 

For your store, both are configured to true so 'show_taxes' will evaluate to true.  This is used by the paypalusa module.

 

'show_taxes' => (int)(Configuration::get('PS_TAX_DISPLAY') == 1 && (int)Configuration::get('PS_TAX')),

 

 

 

2) The if statement determines what information is sent to paypal, if there are 'vouchers' or 'no vouchers'.  If there are no vouchers, then the module sends each product in the cart as an "item".  Since the module no longer uses "_wt" in the "amount" field, this means that taxes are not being included in the product price.  This is good because you have taxes to be displayed as a separate line item.

 

3) If there are discounts, then the module ignores all the products and sends a single "item" which represents the total cart amount.  This amount will include taxes because for your store "show_taxes" will be true. 

 

4) Shipping will always include taxes because they are using true when calculating the shipping cost.

{if $paypal_usa_total_discounts == 0}
    {foreach from=$cart->getProducts() item=paypal_usa_product name="paypal_usa_products"}
        <input type="hidden" name="item_name_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.name|escape:'htmlall':'UTF-8'}" />
        <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval}" />
        <input type="hidden" name="quantity_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.quantity|intval}" />
    {/foreach}
    {assign var="paypal_usa_total_shipping" value=$cart->getOrderTotal(true, Cart::ONLY_SHIPPING)}
    {if $paypal_usa_total_shipping}
        <input type="hidden" name="item_name_{$smarty.foreach.paypal_usa_products.index+2|escape:'htmlall':'UTF-8'}" value="{l s='Shipping' mod='paypalusa'}" />
        <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+2|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_total_shipping|floatval}" />
        <input type="hidden" name="quantity_{$smarty.foreach.paypal_usa_products.index+2|escape:'htmlall':'UTF-8'}" value="1">
    {/if}
{else}    
    <input type="hidden" name="item_name_1" value="{l s="Your order" mod="paypalusa"}" />
    <input type="hidden" name="amount_1" value="{$cart->getOrderTotal(!$show_taxes)|floatval}" />
{/if}

5) This is the tax line, it is always sent separately regardless of there being vouchers.

<input type="hidden" name="tax_cart" value="{$paypal_usa_total_tax|floatval}" />

So to summarize,

1) taxes are always being sent separately to paypal. 

2) taxes are no longer being sent within the product prices

3) taxes will be sent twice to paypal, only if there are vouchers and 'show_taxes' are true for you store.

4) shipping will always include taxes

 

Possible solution:

So what I might suggest you do is change the ELSE block code so that when a voucher exists, the order total ignores your 'show_taxes' variable and instead always excludes taxes.  This is because the module always sends taxes separately, why bother looking show_taxes.

 

Change !$show_taxes to false.  (this should be line 56 of standard.tpl)

<input type="hidden" name="amount_1" value="{$cart->getOrderTotal(false)|floatval}" />

 

 

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 2 weeks later...

I was having this exact same problem. However, it seemed that random PP orders were not being created in PS, although the PP transactions were coming through. The first thing I confirmed is that the PP IPNs were coming through and my access_log confirmed they were.

 

Next, hours of comparing PP payments that worked (PS order created) vs those that did not (PS order NOT created) revealed that I only had issues with PP transactions that included sales tax AND had a voucher/cart rule applied. I was also able to recreate the issue after this discovery (previously I could not).

 

Flakkak, your solution to enable "Display Taxes in shopping Cart" did the trick! I've been struggling with this issue ever since bellini13 helped me with my previous PP issue. Thanks to both of you!

 

Someone should report this as a bug, no?

Edited by abdulk (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...