Closed alakhdeveloper closed 3 years ago
Hi @alakhdeveloper. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
Summary of the issue When the customer place an order through checkout, the Credit Card order is processed through paypal. The order is created successfully as expected in the Magento backend and in paypal. When the paypal hit the IPN url EX: url: https://www.example.com/paypal/ipn
Magento is throwing a 500 Error
Information on your environment We are using Magento 2.3.5
Steps to reproduce 1) Install the vanilla Magento 2) add the product in admin 3) configure the Paypal Payments Pro 4) Go to the frontend, and add the product in cart. 5) Go to the checkout page, and Place order with the Paypal Credit Card. 6) Go to the paypal IPN History and check all the IPN status showing 500 Error 7) Also, when you try to capture the funds in Magento it throws a "Field format error: ORIGID missing". You then have to capture the funds in Paypal for an IPN to feed back to Magento to complete the order.
Expected and actual results Once the order Placed with Magento by customers. Then the paypal IPN history didn't show the 500 Error. The IPN url show work properly.
Please help
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!
Preconditions (*)
Steps to reproduce (*)
Magento 2.3.5 seems to have a bug with the Paypal IPN.
When the customer place an order through checkout, the Credit Card order is processed through paypal. The order is created successfully as expected in the Magento backend and in paypal. This includes the payment record which captures the funds.
When paypal tries to update the order status on magento, PayPal will hit the IPN url: https://www.example.com/paypal/ipn
When paypal hits the IPN url, Magento is throwing a 500 Error.
On Magento, the file that is being hit by the IPN URL is "vendor/magento/module-paypal/Controller/Ipn/Index.php"
Here is the function in the Magento Ipn/Index.php:
/**
@return void */ public function execute() {
if (!$this->getRequest()->isPost()) { return; }
try { $data = $this->getRequest()->getPostValue(); $this->_ipnFactory->create(['data' => $data])->processIpnRequest(); // This is where the 500 error is being thrown. $incrementId = $this->getRequest()->getPostValue()['invoice']; $this->_eventManager->dispatch( 'paypal_checkout_success', [ 'order' => $this->orderFactory->create()->loadByIncrementId($incrementId) ] );
} catch (RemoteServiceUnavailableException $e) { $this->_logger->critical($e); $this->getResponse()->setStatusHeader(503, '1.1', 'Service Unavailable')->sendResponse(); /* @todo eliminate usage of exit statement / // phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage exit; } catch (\Exception $e) { $this->_logger->critical($e); $this->getResponse()->setHttpResponseCode(500); } }
As you can see, the line: "$this->_ipnFactory->create(['data' => $data])->processIpnRequest();" - This is where the 500 error is being thrown.
When I comment out this line that is throwing the 500 Error, the function no longer throws the 500 error.
I have checked the IPN "processIpnRequest" function and everything looks fine with the code. I am not sure why the "processIpnRequest" function is throwing the 500 error. This is the Magento core code.
When paypal first hits the IPN url, the parameters include a $0 amount and no invoice id. The second time paypal hits the IPN url, the parameters include the $amount of the order and an Invoice ID. In the system.log file, I see an error "The invoice ID is not available". So i added: $incrementId = $this->getRequest()->getPostValue()['invoice']; // add a check for the invoice id "order_increment_id" to get rid of "The invoice ID is not available" error in system.log file. if(empty($incrementId)){ return $this; } $this->_eventManager->dispatch(
Now if I try to process the invoice of the order in Magento, I get "Field format error: ORIGID missing". The only way to complete the order is to capture in Paypal and have the IPN feed back to the order in Magento.
Expected result (*)
Actual result (*)
The issue is with the PayPal IPNs. Paypal IPN is showing a 500 error. When I dig into the code, I found Paypal is hitting the IPN URL and the invoice_id (order increment id) is not found.. However in the admin interface, the order_id exists, but it's throwing a 500 error response.
Magento seems to have a bug with the Paypal IPN.
Please help me look into it.