3

I have configure Authorize.Net Payment method in magento 2, But i am getting "An error occurred on the server. Please try to place the order again" after click on place order.

Also sometimes its work's perfectly. So i need to know is ti magento issue or payment gateway issue. Thanks in advance. Let me know if you need more information.

  • now check debug.log and exception log which erorr – Ravindrasinh Zala Jan 12 '18 at 5:40
  • Getting requested parameters log in debug.log and no any exception log – Ravi Oza Jan 12 '18 at 5:47
  • @RaviOza have you found any solution – Pawankumar Jul 17 '19 at 17:24
-1

To know the exact reason why it is happen so, please open below file:

vendor/magento/module-checkout/Model/PaymentInformationManagement.php

than comment out the try, catch and put code to place order directly as below:

Replace below function

public function savePaymentInformationAndPlaceOrder(
    $cartId,
    \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
    \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
    $this->savePaymentInformation($cartId, $paymentMethod, $billingAddress);
    try {
        $orderId = $this->cartManagement->placeOrder($cartId);
    } catch (\Exception $e) {
        //var_dump($e);
        throw new CouldNotSaveException(
            __('An error occurred on the server. Please try to place the order again.'),
            $e
        );
    }
    return $orderId;
}

To

public function savePaymentInformationAndPlaceOrder(
    $cartId,
    \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
    \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
    $this->savePaymentInformation($cartId, $paymentMethod, $billingAddress);
    //try {
        $orderId = $this->cartManagement->placeOrder($cartId);
    /*} catch (\Exception $e) {
        //var_dump($e);
        throw new CouldNotSaveException(
            __('An error occurred on the server. Please try to place the order again.'),
            $e
        );
    }*/
    return $orderId;
}

Now, try to place order again. You will be able to see the detailed error in log file or may be in console.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.