magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

Paypal Payments Pro IPN keeping payments marked as Pending Payment #18148

Closed Sharpy310 closed 5 years ago

Sharpy310 commented 6 years ago

Preconditions

  1. Magento CE 2.2.6
  2. PHP v7.1.19-1
  3. Ubuntu 17.10

Steps to reproduce

  1. Set up Paypal Payments Pro Hosted Solution on a clean install of Magento CE 2.2.6
  2. Send a payment using Credit / Debit Card through the solution checking out as guest. EDIT: Both Paypal payments and Credit / Debit card payments through express checkout and payments pro are experiencing the same issue.

Expected result

  1. Expected, when Paypal sends the IPN to Magento, for Magento to then mark the payment from "Pending Payment" to "Processing"

Actual result

  1. IPN is returning back to Magento successfully, as per screenshots below, but Magento is keeping the payment marked as "Pending Payment" 9a28fafd9acbef5ddf8f5574c61 0ef721c20a5f97b34c188fa086b

I have pasted below our debug data relating to this transaction: https://pastebin.com/Tzg39rjb

As seen in the screenshots, #1 is from Magento showing that the IPN was received and customer was notified, but payment status was not changed. And screenshot #2 is from Paypal IPN history showing that IPN was delivered successfully.

numan201 commented 5 years ago

@zipnfc I am glad I was able to help.

DS2987 commented 5 years ago

Any update on a fix for this? Surprised the issue being so important for many was allowed to be carried from version 2.2.7 to 2.3

DS2987 commented 5 years ago

Unfortunately the file update from @numan201 does not seem to work in version 2.3 as although the status has changed from 'Processing Payment' it is now 'Suspected Fraud' even though the payment has gone into PayPal with a 200 IPN response and transaction ID updated to Magento. Tried 2 x different cards same each time.

magento-engcom-team commented 5 years ago

Hi @PathToLife. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

PathToLife commented 5 years ago

I've found that orders are saved as pending_payment in the IPN function _registerPaymentCapture()

https://i.imgur.com/9oaxTUS.png

I'm not sure exactly where we should set order status for completed payments, but i found conventions in the same file (\Magento\Paypal\Model\Ipn.php) that does:

_registerPaymentReversal() {$this->_order->setStatus($orderStatus);}

Currently cross referencing with express paypal and invoicing functions to see difference..

zipnfc commented 5 years ago

@DS2987 did you definitely find the fix did not work on 2.3? Just checking as going to start testing 2.3 this week?

DS2987 commented 5 years ago

@zipnfc Yes I confirm in version 2.3 although the status has changed from 'Processing Payment' it is now 'Suspected Fraud' even though the payment has gone into PayPal with a 200 IPN response and transaction ID updated to Magento. A proper fix for this issue rather than a workaround would be great.

azambon commented 5 years ago

@PathToLife The origin of the issue is not specifically linked to Paypal, but it extends to anything using the registerCaptureNotification command. It has already been identified in two previous comments by @jasper-multisafepay and @numan201

Take a look at the highlighted line: https://github.com/magento/magento2/commit/f39138b6dc504f93dae9697ad45d11d57f1aaf1f#diff-68f9035e0545c5442dde19b0ba0fa9b4R38

I'd say that reverting that change should fix the issue. The only thing before doing it would be to understand why that modification was done in the first place...

ajheaton90 commented 5 years ago

I just wanted to update, I had this very same issue using PayPal pro hosted solution using magento 2.3 and Numan's fix worked for me, order successfully goes to Processing, I saw some users reported with 2.3 it went to suspected fraud but this was not the case for me.

zipnfc commented 5 years ago

@ajheaton90 - thank so much for confirming this - I will now give this a go. We just put the new Magento 2 shop live (zipnfc.com) at the weekend on 2.2.6 and everything is working perfectly. Really pleased with it but will test on 2.3 now!

owebia commented 5 years ago

Same issue on Magento 2.3.1 with Payplug module using $payment->registerCaptureNotification(...)

designboxcom commented 5 years ago

Has it been fixed in 2.3.2? I upgraded last week from 2.2.6 and from now on, all sales are still "Pending payment" with Paypal Express Checkout.

designboxcom commented 5 years ago

I also noticed this is not possible to manually change the Status of an order. In the drop down list, I can only see "Pending Payment" as an option ... !

Gypsy7 commented 5 years ago

Any fix released for this issue? we stuck on 2.2.8 and 2.3.2

mattyl commented 5 years ago

Its crazy this is still an issue a year on and no one is assigned to it

nadroj467 commented 5 years ago

Following these steps solved the issue for me.

Step1: Login to paypal

Step2: In the Profile menu on the top right, click Profile and Settings .

Step3: click My selling tools .

Step4: Click the Update link in the Instant payment notifications row , in the Getting paid and managing my risk section.

Step5: Click Choose IPN Settings to specify your listener's URL and activate the listener.

Step6: Specify the URL for your listener in the Notification URL field . i.e https://domainname.com/paypal/ipn/index.

Step7: Click Receive IPN messages (Enabled) to enable your listener.

Step8: Click Save .

Step9: Click Back to Profile Summary to return to the Profile after activating your listener. You also can click Edit settings to modify your notification URL or disable your listener. You can click Turn Off IPN to reset your IPN preferences.

jaeitee commented 5 years ago

For now, we have changed line 38 of vendor/magento/module-sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php from: $state = $order->getState() ?: Order::STATE_PROCESSING; to $state = Order::STATE_PROCESSING; as it was before the update.

Thank you @numan201 , working on Paypal Payments Pro Hosted Solution on Magento 2.3.x.

numan201 commented 5 years ago

For now, we have changed line 38 of vendor/magento/module-sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php from: $state = $order->getState() ?: Order::STATE_PROCESSING; to $state = Order::STATE_PROCESSING; as it was before the update.

Thank you @numan201 , working on Paypal Payments Pro Hosted Solution on Magento 2.3.x.

Good to hear. Working fine on Magento 2.3.2 with PayPal Advanced as well.

Gypsy7 commented 5 years ago

It seems like the Paypal account region is playing game aswell. I guess for some EU countries there is 3rd party module that working fine.

dbroeders commented 5 years ago

I have the same problem with Mollie no success with updating order status. Payment Status = Paid -- and the -- Order Status = Pending Payment I try to change ( $state = Order::STATE_PROCESSING; ) but untill now no success. Magento 2.3.2 - Mollie 1.5

PathToLife commented 5 years ago

This is was my fix at the start of the year: https://github.com/magento/magento2/pull/20870/commits/8c26699dcf9a659c6976fb66329a46781657d90a

In app/code/Magento/Paypal/Model/Ipn.php protected function _registerPaymentCapture($skipFraudDetection = false) add this line

$this->_order->setStatus($this->_order->getConfig()->getStateDefaultStatus(
            \Magento\Sales\Model\Order::STATE_PROCESSING));

No sure why travis failed on it.. been ok for us but we've been extra careful, please use at own risk!

dbroeders commented 5 years ago

I have had a nice talk with a expert from Mollie today - and now it works like a charm.

https://redirectdetective.com -- check if your website is redirecting good. (that is in 1 hop)

Our nginx redirected www to non www -- and afterwards redirect again to https. The webhook return from Mollie fails if there are too many redirects.

designboxcom commented 5 years ago

This issue is still no resolved. I am still unable to manually change the status of the orders... In the dropdown list, there is only 1 option available: "Pending Payment" !!!!

garyhiggins1970 commented 5 years ago

I can confirm this is still happening in 2.3.3. Going to re try @numan201 suggestion in 2.3.3.

quantumAV commented 5 years ago

I can also confirm this is happening in 2.3.3

@numan201 fix worked for me in 2.3.2 however on upgrading to 2.3.3 we now have Pending Payment status for orders received even thought he details of the payment are on the order.

It also looks like the fix that worked in 2.3.2 is already present in 2.3.3 so I am at a loss with how to proceed with this

For now, we have changed line 38 of vendor/magento/module-sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php from: $state = $order->getState() ?: Order::STATE_PROCESSING; to $state = Order::STATE_PROCESSING; as it was before the update.

VivekShingala commented 5 years ago

@joni-jones

(MAGETWO-88244: PayPal orders status display always as Processing) Could you please handle Website Payments Pro Hosted Solution with regards to your commit back in Apr 2018 here?

https://github.com/magento/magento2/commit/f39138b6dc504f93dae9697ad45d11d57f1aaf1f#diff-68f9035e0545c5442dde19b0ba0fa9b4R38

nadroj467 commented 5 years ago

Experiencing the issue again now in 2.3.3. Our orders are not exporting via API because they have Pending Payment status. Please, can someone resolve this?

quantumAV commented 5 years ago

do we need to create a new issue for this?

80Cube commented 5 years ago

Just had to redo numans fix in 2.3.2.

can anyone confirm if the fix still works in 2.3.3?

quantumAV commented 5 years ago

in my situation payments from Paypal Express are coming through correctly and have a status of Processing. Paypal Web Payments Pro are coming through as Pending Payment which is incorrect however the payment does show in the order information.

In 2.3.2 numan201's fix worked and resulted in both Paypal Express and Web Payments Pro having the corret 'Processing' Status

in 2.3.3 the fix already seems to be present in the code however Web Payments Pro orders are not showing the correct status

nomis11uk commented 5 years ago

Has anyone managed to find a fix for this? Getting 'Pending Payment' status in 2.3.3.

quantumAV commented 5 years ago

I have opened a new issue with hope that this will trigger a response https://github.com/magento/magento2/issues/25659

engcom-Echo commented 5 years ago

Closed as 25659 new one with more details information.

Vishrootways commented 4 years ago

We are getting the same issue with PayPal Pro on Magento 2.3.5-p1, any solution?

nomis11uk commented 4 years ago

@numan20 fix worked for me in 2.3.5-p1

Vishrootways commented 4 years ago

@nomis11uk can you please let us know which fix works for you? Can you please share solutions with us?

numan201 commented 4 years ago

@Vishrootways https://github.com/magento/magento2/issues/18148#issuecomment-435555218