Magento – Magento 2 : PayPal express checkout is redirecting to cart page, without showing any success or failure error

checkoutmagento2paypal-express

I am using PayPal express checkout on my Magento 2.2.6 website.
Steps to reproduce the issue that is

  1. Add product to cart
  2. From the cart page click Paypal express checkout button
  3. Add the details on PayPal
  4. On the PayPal review page, apply the discount coupon and it will redirect to the cart page
  5. Click on the express checkout button again, add the details on PayPal again
  6. and now instead of redirecting to the PayPal review page, I am redirecting to the cart page.

Can anyone suggest to me how to debug this issue in more detail?

Contents of the payment.log file are

  'url' => 'https://api-3t.sandbox.paypal.com/nvp',
  'GetExpressCheckoutDetails' => 
  array (
    'TOKEN' => 'xxxxxxxxxxxxxxxxxxxx',
    'METHOD' => 'GetExpressCheckoutDetails',
    'VERSION' => '72.0',
    'USER' => '****',
    'PWD' => '****',
    'SIGNATURE' => '****',
    'BUTTONSOURCE' => 'Magento_Cart_Community',
  ),
  'response' => 
  array (
    'TOKEN' => 'xxxxxxxxxxxxxxxxxxxxx',
    'BILLINGAGREEMENTACCEPTEDSTATUS' => '0',
    'CHECKOUTSTATUS' => 'PaymentActionNotInitiated',
    'TIMESTAMP' => '2019-12-05T09:56:40Z',
    'CORRELATIONID' => xxxxxxxxxxx
    'ACK' => 'Success',
    'VERSION' => '72.0',
    'BUILD' => '53842365',
    'EMAIL' => 'xxxxxxxxxxxxxxxxx',
    'PAYERID' => '76QH8A6BV9GWC',
    'PAYERSTATUS' => 'unverified',
    'FIRSTNAME' => 'Naveed',
    'LASTNAME' => 'Abbas',
    'COUNTRYCODE' => 'US',
    'SHIPTONAME' => 'Naveed Abbas',
    'SHIPTOSTREET' => 'street 123',
    'SHIPTOCITY' => 'huntsville',
    'SHIPTOSTATE' => 'AL',
    'SHIPTOZIP' => '35801',
    'SHIPTOCOUNTRYCODE' => 'US',
    'SHIPTOCOUNTRYNAME' => 'United States',
    'BILLINGNAME' => 'Naveed Abbas',
    'STREET' => 'street 123',
    'CITY' => 'huntsville',
    'STATE' => 'AL',
    'ZIP' => '35801',
    'COUNTRY' => 'US',
    'COUNTRYNAME' => 'United States',
    'ADDRESSID' => 'PayPal',
    'ADDRESSSTATUS' => 'Confirmed',
    'CURRENCYCODE' => 'USD',
    'AMT' => '67.97',
    'ITEMAMT' => '67.97',
    'SHIPPINGAMT' => '0.00',
    'HANDLINGAMT' => '0.00',
    'TAXAMT' => '0.00',
    'INVNUM' => '600313',
    'INSURANCEAMT' => '0.00',
    'SHIPDISCAMT' => '0.00',
    'INSURANCEOPTIONOFFERED' => 'false',
    'L_NAME0' => 'Newspaper Holder in Met. Bronze for Gaines Mailbox',
    'L_QTY0' => '1',
    'L_TAXAMT0' => '0.00',
    'L_AMT0' => '67.97',
    'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
    'PAYMENTREQUEST_0_AMT' => '67.97',
    'PAYMENTREQUEST_0_ITEMAMT' => '67.97',
    'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
    'PAYMENTREQUEST_0_HANDLINGAMT' => '0.00',
    'PAYMENTREQUEST_0_TAXAMT' => '0.00',
    'PAYMENTREQUEST_0_INVNUM' => '600313',
    'PAYMENTREQUEST_0_INSURANCEAMT' => '0.00',
    'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
    'PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED' => 'false',
    'PAYMENTREQUEST_0_SHIPTONAME' => 'Naveed Abbas',
    'PAYMENTREQUEST_0_SHIPTOSTREET' => 'street 123',
    'PAYMENTREQUEST_0_SHIPTOCITY' => 'huntsville',
    'PAYMENTREQUEST_0_SHIPTOSTATE' => 'AL',
    'PAYMENTREQUEST_0_SHIPTOZIP' => '35801',
    'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'US',
    'PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME' => 'United States',
    'PAYMENTREQUEST_0_ADDRESSSTATUS' => 'Confirmed',
    'L_PAYMENTREQUEST_0_NAME0' => 'Newspaper Holder in Met. Bronze for Gaines Mailbox',
    'L_PAYMENTREQUEST_0_QTY0' => '1',
    'L_PAYMENTREQUEST_0_TAXAMT0' => '0.00',
    'L_PAYMENTREQUEST_0_AMT0' => '67.97',
    'PAYMENTREQUESTINFO_0_ERRORCODE' => '0',
  ),
) [] []
[2019-12-05 09:56:44] main.DEBUG: array (
  'url' => 'https://api-3t.sandbox.paypal.com/nvp',
  'getPalDetails' => 
  array (
    'METHOD' => 'getPalDetails',
    'VERSION' => '72.0',
    'USER' => '****',
    'PWD' => '****',
    'SIGNATURE' => '****',
    'BUTTONSOURCE' => 'Magento_Cart_Community',
  ),
  'response' => 
  array (
    'PAL' => 'RGZTJUM7RDV9C',
    'LOCALE' => 'en_US',
    'TIMESTAMP' => '2019-12-05T09:56:43Z',
    'CORRELATIONID' => 'd3619b72ea406',
    'ACK' => 'Success',
    'VERSION' => '72.0',
    'BUILD' => '53802284',
  ),
) [] []

in file
vendor/magento/module-paypal/Controller/Express/AbstractExpress/ReturnAction.php
there is a condition

if ($this->_checkout->canSkipOrderReviewStep()) {
    $this->_forward('placeOrder');
} else {
    $this->_redirect('*/*/review');
}
return;```
in 2nd attempt it goes into else part, but without redirecting, control shipts outside of the if, else block and the cart page remains there.

Best Answer

Please Set Yes into "Transfer Cart Line Items" from PayPal advanced settings, see the below image for your reference.

Hope it helps you !

enter image description here

Related Topic