cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Rest API in place order section (Magento 2.2)

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Problem with Rest API in place order section (Magento 2.2)

Hello,

I am having a strange problem.I create a order using "payment-information" Rest API, order placed successfully but getting null response everytime (No order id resonse from this API).After calling this API I checked order creted from backend and also customer got a order mail from server.

 

I checked no error response in error log file.Please help me.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Problem with Rest API in place order section (Magento 2.2)

Hello @rajkumar_ghosh 

 

try to remove the vendor folder and do  composer install from command, it will install all files again

 

Hope it will help you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

6 REPLIES 6

Re: Problem with Rest API in place order section (Magento 2.2)

Hello @rajkumar_ghosh 

 

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

 

check line no 83 

 try {
            $orderId = $this->cartManagement->placeOrder($cartId);
        } catch (\Magento\Framework\Exception\LocalizedException $e) {
            throw new CouldNotSaveException(
                __($e->getMessage()),
                $e
            );
        } catch (\Exception $e) {
            $this->getLogger()->critical($e);
            throw new CouldNotSaveException(
                __('An error occurred on the server. Please try to place the order again.'),
                $e
            );
        }

check is that going into the catch 


if works then mark as a solution.

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Problem with Rest API in place order section (Magento 2.2)

hello sunil,

 

Thanks for reply, I check error log file there are no error found and not getting any api response no catch response also. Please check this below screenshot.

 

payment-information.png

Re: Problem with Rest API in place order section (Magento 2.2)

Hello,

I am not able to see your screenshot.

Have you did echo and exit that file

You need to do little debug there

Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Problem with Rest API in place order section (Magento 2.2)

Hi Sunil,

 

I do this ,Please check this below code.

try {
           $orderId = $this->cartManagement->placeOrder($cartId);
           echo $orderId;
           exit;
        } catch (\Magento\Framework\Exception\LocalizedException $e) {
            throw new CouldNotSaveException(
                __($e->getMessage()),
                $e
            );
        } catch (\Exception $e) {
            $this->getLogger()->critical($e);
            throw new CouldNotSaveException(
                __('An error occurred on the server. Please try to place the order again.'),
                $e
            );
        }

 

But nothing response found from payment-information API call.

Re: Problem with Rest API in place order section (Magento 2.2)

Hello sunil,

I have a old project backup.I install this backup into another server and checked order id comes into the response in payment-information API. So may I restore the vendor and app folder into the current project.This way I get the solution.
Please reply it is very important.we need solution as soon as possible.

Re: Problem with Rest API in place order section (Magento 2.2)

Hello @rajkumar_ghosh 

 

try to remove the vendor folder and do  composer install from command, it will install all files again

 

Hope it will help you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer