Jump to content

order getting added with validateOrder - Total paid amount does not match cart total error


Recommended Posts

When I was trying to add order using validateOrder method 


                            (int) $cartId,


                            (float) $this->context->cart->getOrderTotal(true, Cart::BOTH),




                            (int) $this->context->currency->id,




as mentioned above but most of the time wrong status was getting added in PrestaShop.

when validating in the ValidateOrder method of PrestaShop it goes breaks at the below condition



amount_paid will be 3rd parameter which we passing to method    (float) $this->context->cart->getOrderTotal(true, Cart::BOTH)

 $cart_total_paid = (float) Tools::ps_round(

            (float) $this->context->cart->getOrderTotal(true, Cart::BOTH),



 $comp_precision = Context::getContext()->getComputingPrecision();

        if ($order_status->logable && (number_format($cart_total_paid, $comp_precision) !== number_format($amount_paid, $comp_precision))) {

            PrestaShopLogger::addLog('PaymentModule::validateOrder - Total paid amount does not match cart total', 3, null, 'Cart', (int) $id_cart, true);

            $id_order_state = Configuration::get('PS_OS_ERROR');



as mentioned above both values were fetched dynamically by Prestashop itself it goes failed and the order got added with "Payment with error" status.

Thanks in advanced

Share this post

Link to post
Share on other sites

  • 4 weeks later...

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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More