Error: PayPal returned: Order total is invalid.


  • Default avatar
    daniel7    
     3 years ago
    0

    Hi,

    I am using PayPal as my payment gateway on:
    Virtuemart 1.1.5
    Joomla 1.5
    AwoCoupon Pro 1.3.1

    I am trying to set up some gift certificates and all is working well unless the total amount at checkout is $0.
    I receive a "Error: PayPal returned: Order total is invalid." message and I am not forwarded to paypal and I cannot finish the order.

    If I click next after this error appears then I receive more errors.
    I have tested it on products where the product cost is greater than the certificate amount and it works fine.

    Any ideas on how to fix this?

    Cheers,
    Daniel
  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    I just tested Virtuemart 1.1.5. If the order total is 0, the payment method step is skipped. And once you click confirm on the front end, the order is automatically confirmed. You should not be sent to paypal or any payment method if the order total is 0.

    Are you using a one page checkout or something similar? That may be where the problem lies.
  • Default avatar
    daniel7    
     3 years ago
    0

    Hi Seyi,

    Thanks for your help.
    I am not using one page checkout.
    I will send you an email so you can test it out and see if you can spot anything strange.

    Cheers,
    Daniel
  • Your avatar
    seyi    
     3 years ago
    0

    Hi Daniel,

    Took a look, and believe I know the problem, from the confirmation page url. In www/administrator/components/com_virtuemart/class/ps_checkout.php inside function list_payment_methods is this logic:
    <?php
            
    if( $VM_CHECKOUT_MODULES['CHECK_OUT_GET_PAYMENT_METHOD']['order'] != $VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'] ) {
                if (
    $count url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&payment_method_id=$first_payment_method_id&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'], falsefalse ),"");
                }
                elseif( isset(
    $order_total) && $order_total 
    ?>


    If you can read that, it says, if there is only 1 payment method, then choose it and move to the confirmation page, otherwise if the total is <= 0, then dont choose any payment method and move to the confirmation page. I think the total <= 0 should be checked before checking to see if there is just one payment method, so try switching it around like this
    <?php
            
    if( $VM_CHECKOUT_MODULES['CHECK_OUT_GET_PAYMENT_METHOD']['order'] != $VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'] ) {
                if( isset(
    $order_total) && $order_total 
    ?>


    I believe that should fix the problem.
  • Default avatar
    daniel7    
     3 years ago
    0

    Hi Seyi,

    That worked perfectly.

    Thank You.