0

After migration from Magento 1 to 2 default Payment Methods Paypal, Braintree and Authorize.net are not working. They are displayed in the checkout but when we place order through those methods

POST ../rest/default/V1/carts/mine/payment-information 400 (Bad Request)

The above error is thrown in the console.

{"message":"An error occurred on the server. Please try to place the order again.","trace":"#0 /var/www/html/maget226/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Checkout\Model\PaymentInformationManagement->savePaymentInformationAndPlaceOrder(1085, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address))\n#1 /var/www/html/maget226/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callParent('savePaymentInfo...', Array)\n#2 /var/www/html/maget226/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->Magento\Framework\Interception\{closure}(1085, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address))\n#3 /var/www/html/maget226/generated/code/Magento/Checkout/Model/PaymentInformationManagement/Interceptor.php(26): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callPlugins('savePaymentInfo...', Array, Array)\n#4 [internal function]: Magento\Checkout\Model\PaymentInformationManagement\Interceptor->savePaymentInformationAndPlaceOrder(1085, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address))\n#5 /var/www/html/maget226/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)\n#6 /var/www/html/maget226/vendor/magento/module-webapi/Controller/Rest.php(244): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy))\n#7 /var/www/html/maget226/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#8 /var/www/html/maget226/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)\n#9 /var/www/html/maget226/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#10 /var/www/html/maget226/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)\n#11 /var/www/html/maget226/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#12 /var/www/html/maget226/vendor/magento/framework/App/Bootstrap.php(257): Magento\Framework\App\Http->launch()\n#13 /var/www/html/maget226/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#14 {main}"}

The above response is found when inspecting.

When I traced the code to find the exact error I found the error was thrown from vendor/magento/module-quote/Model/QuoteManagement.php file.

public function submit(QuoteEntity $quote, $orderData = [])
    {               
        if (!$quote->getAllVisibleItems()) {
            $quote->setIsActive(false);
            return null;
        }
        return $this->submitQuote($quote, $orderData);
    }

So the submitQuote method call was throwing the exception

Sorry, but something went wrong

I found out that no trace was evident in submitQuote method once the call was made. I only found the exception.

protected function submitQuote(QuoteEntity $quote, $orderData = [])

How to debug the actual error from this step?

Secondly, I tried replacing the database with a fresh one and then the payment methods were working fine.

So I tried to replace only core_config_data from same Magento 2.2.6 instance assuming that error would be in configurations, although the payment methods were not working fine now.

What would be the exact cause of such errors?

How to debug such issues efficiently?

Thanks, any help or suggestion is appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.