Paypal Error - AWO + Virtuemart


  • Default avatar
    Alceste    
     11 years ago
    0

    Hello,
    I make this changes but doesn't work. For this reason I writte again the original code waitting to find a solution. Now I'm sure that the problem aren't the taxes of shipping cost, because if I don't use discount couponts the amount in PayPal is right. Certainly the amount of shipping taxes don't appears in the PayPal receipt, but the total amount is correct and include it. Really the problem beguin when they are coupons in the order. (I have the same problem if the coupons are the standar coupons of VirtueMart.)

    This is the error message that we received from PayPal:

    During a paypal transaction on your site the received amount didn't match the order total.
    Order ID: xxxx.
    Order Number: 1xx_xxxxxxxxxx.
    The amount received was: 49.92 EUR.
    It should be: 52.85 EUR.

    Thanks for your help one more time
  • Your avatar
    seyi    
     11 years ago
    0

    I am not sure what the problem could be. Are you using discount before tax? If so you should look at this:
    https://awodev.com/blog/virtuemart-coupon-error-discount-before-tax#solution4

    If that does not work, a good place to start is to reset it the code within the configuration back to the default and work from there.
  • Default avatar
    csaba6    
     11 years ago
    0

    Hi Seyi,

    After spent for a few days to figure out, why I have this strange error, I gave it up! This is make me crazy, you are the only hope for me, Seyi.

    I made a detailed description what is exactly happening and where.

    You can download from here: http://homesys.tv/download/coupon_discount_issue_VM1_1_9.pdf

    Also, I packaged every files, which may be affacted, since I have made a several changes, during my investigation. Please suggest me what I have to change and where.
    The package contains: basket.php, ps_checkout.php, ro_basket.php, coupon_calculation.xls, paypal_payment_extra_info.txt
    files package: http://homesys.tv/download/coupon_discount_issue_VM1_1_9.zip

    I'm waiting for your suggestion very much!!!

    Thanks a lot!!!
  • Your avatar
    seyi    
     11 years ago
    0

    Ok, took a look.

    I see 2 problems
    1) Tax total should be 11.080, not 11.404. Using a little math, the difference is 11.404-11.080 = 0.324 (this is also the shipping tax). So the shipping tax is getting added twice. The shipping tax is calculated in function calc_order_tax, because of your virtuemart settings, and also is being double added within ro_basket and basket.php, in both files, find the line
    <?php
    $tax_total 
    += $shipping_tax;
    ?>

    can comment it out
    <?php
    //$tax_total += $shipping_tax;
    ?>


    2) Total on the confirmation page is showing as 59.857 instead of 52.118. The difference is 59.857-52.118=7.739. This turns out to be the tax on the coupon discount, 28.662*0.27=7.73874. So when calculating the total, it subtracted the coupon discount, but not the tax effect also. So in ro_basket.php, around line 175 is this
    <?php
    if( PSHOP_COUPONS_ENABLE=='1' && @$_SESSION['coupon_redeemed']==true ) {
        
    $total -= $_SESSION['coupon_discount'];
    ?>


    add this right after
    <?php
        $total 
    -= ($_SESSION['coupon_discount'] * $my_taxrate);
    ?>


    You should now get the correct totals
  • Default avatar
    csaba6    
     11 years ago
    0

    Ah, Thank you very much Seyi!!!!! It works, everything is okay now!

    Thanks again!

    csaba

This thread is locked.