-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paypal some orders fail with main.CRITICAL: Wrong order ID: #15427
Comments
Hi @BezV8 i cannot reproduce by your scenario, i have order registered in magento. |
Noticed the same issue on a CE 2.2.5 system... |
@engcom-backlog-nazar Apologies for the delay in responding to this. I have not noticed a recurrence of this issue for some time now, so it ay have sorted itself out. It looks like others (gewaechshaus) may also be experiencing a similar problem. |
Yes, actually we got 3-5 orders where it did happen . Currently we can't log the issue, |
Hi @gewaechshaus Can you provide steps to reproduce ? or can you reproduce on vanilla instance ? |
@BezV8 , we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue. |
We are seeing a similar issue but no order id in the logs. This is on 2.2.3 |
I'm also seeing this in 2.2.3 open source; [] main.CRITICAL: Wrong order ID: "000004793". {"exception":"[object] (Exception(code: 0): Wrong order ID: "000004793". at /home/panel/htdocs/somesite/vendor/magento/module-paypal/Model/Ipn.php:140)"} [] |
HI @karlsminton Can You describe how you get this error? to help us reproduce this issue? |
Same here. |
I've seen this today. 2.1.7. |
Hi @engcom-backlog-nazar - I've literally just inherited this so I've not got many ideas about how to reproduce it. I can confirm though, that it's taking orders correctly +99% of the time, but we've had some reports of customers orders failing inexplicably. According to our client, the paypal payment failed - but the order confirmation was sent. |
Hi @BezV8 Hi @karlsminton I'm reopen this as many people have this issue. |
I've been debugging this all day, using both the apache logs of an affected user and xdebug locally to understand the request flow. I believe I have the beginnings of a theory as to whats happening, although I haven't worked it all out yet. I believe the When I viewed the apache access logs that corresponded to the broken order I found requests like the following.
We should never be hitting review, but that's what we're seeing. I read through the code and replicated similar behaviour locally by hacking in a bad response from paypal. It seems there is some error handling in the module that will redirect to the review page in the event of an error. This code is placed within PlaceOrder as a successful call to the return action will call # https://github.com/magento/magento2/blob/2.1.15/app/code/Magento/Paypal/Controller/Express/AbstractExpress/PlaceOrder.php#L93
try {
+ throw new ApiProcessableException(
+ new \Magento\Framework\Phrase('mock api failure'),
+ new \Exception(),
+ 10736
+ );
$this->_initCheckout();
$this->_checkout->place($this->_initToken());
// prepare session to success or cancellation page
$this->_getCheckoutSession()->clearHelperData(); This exception gets picked up by this line of code Which is processed by Which simply outputs the error but doesn't log it before redirecting to the review page (which we skip in usual flow) By placing a paypal order with the above exception in place I am left with
When the customer retried to We did not intend the paypal review page to be viewable on our site so it was not fully styled and the customer may miss the session messaging. Problems with this theory
Anyway it's been a long day debugging, but here's my notes anyway. |
Confirmed, issue on Magento 2.2.5
|
@convenient Thank you for the detailed logging! Have you managed to get any further debugging the issue since your previous comment? |
I have confirmed that this is happening on Magento 2.2.6. A small number of orders have captured funds, but the order has not been created. I get the following in exception.log:
|
Same issue here. As I imported old command with home made script from magento1 instance is there any possibility that this is related to a bad increment id sequence ? Because orders from magento1 don't have the same store id and the increment_id pattern does not correspond to the new magento2 website. But for other payment method I do not have any issues. Also can it be related to guest order ? So question or all of those that have this issue : does this happen only for guest orders ? Could it be related to sequence number / tables ? As @dewayneholden said, paypal capture the paiement but does not create the associated order / invoice. |
Hi, same on 2.1.15. Bunch of "Wrong order ID" errors in exception.log |
After my comment above I have gathered some additional log data which explains how (in my case) we end up with a valid paypal transaction with no order existing in Magento.
Explanation of how I found this, and my mitigation. Finding the errorStep 1 - Capture errors and log themI added some additional logging to the core paypal controller by using --- Controller/Express/AbstractExpress/PlaceOrder.php 2018-11-23 15:32:32.000000000 +0000
+++ Controller/Express/AbstractExpress/PlaceOrder.php 2018-11-23 15:31:53.000000000 +0000
@@ -27,6 +27,17 @@
private $paymentFailures;
/**
+ * Logger added to debug JIRA-TICKET-123
+ *
+ * Paypal order auth and captured with no corresponding order in magento.
+ *
+ * @var \Psr\Log\LoggerInterface
+ *
+ * @author Luke Rodgers
+ */
+ protected $logger;
+
+ /**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Customer\Model\Session $customerSession
* @param \Magento\Checkout\Model\Session $checkoutSession
@@ -49,9 +60,11 @@
\Magento\Framework\Url\Helper\Data $urlHelper,
\Magento\Customer\Model\Url $customerUrl,
\Magento\Checkout\Api\AgreementsValidatorInterface $agreementValidator,
+ \Psr\Log\LoggerInterface $logger,
PaymentFailuresInterface $paymentFailures = null
) {
$this->agreementsValidator = $agreementValidator;
+ $this->logger = $logger;
$this->paymentFailures = $paymentFailures ? : ObjectManager::getInstance()
->get(PaymentFailuresInterface::class);
@@ -126,8 +139,12 @@
$this->_redirect('checkout/onepage/success');
return;
} catch (ApiProcessableException $e) {
+ $this->logger->critical("Logging for JIRA-TICKET-123");
+ $this->logger->critical($e);
$this->_processPaypalApiError($e);
} catch (\Exception $e) {
+ $this->logger->critical("Logging for JIRA-TICKET-123");
+ $this->logger->critical($e);
$this->messageManager->addExceptionMessage(
$e,
__('We can\'t place the order.') Step 2 - Wait until an orphaned order is identifiedI would like to try and find a way of doing this programmatically, but as the data doesn't exist in Magento it is difficult. Paypal will have a record of the intended order Step 3 - Find the associated quoteselect entity_id, created_at, updated_at, remote_ip, reserved_order_id from quote
where reserved_order_id='XX123456789'; This will give you the Step 4 - Get the error logThe log can be found in Step 5 - What we sawSQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: INSERT INTO `sales_invoice
Emulating the issue locallyI was able to spoof similar behaviour (lock wait timeout, not a deadlock) locally using the following methodology, this should never be done on any environment other than your local!
BEGIN;
insert into sales_order(entity_id, store_id) values (10, 2);
insert into sales_invoice(order_id, increment_id, store_id) values (10, '2000006607', 2);
Mitigating the issueTo mitigate this error and turn our handling of it from being reactive to proactive I have written an observer.
The above conditions should allow us to remove all false alerts and ensure this only fires during this scenario. https://gist.github.com/convenient/ea1411d650e8765278338adc36deba93 Next stepsCan anyone from Magento advise on what could be causing the deadlock on the |
Hi, i have the same problem in magento 2.4.5-p1 in case the customer is logged in magento and make paypal payment. An error will appear main.CRITICAL: Exception: The "40030822" order ID is incorrect. Verify the ID and try again. in /bitnami/magento/vendor/magento/module-paypal/Model/Ipn.php:147 At the same time, which is a problem, if I create an invoice for such an order, this invoice will be created twice, e.g. 10000201, 10000202. If the customer is not logged in and makes the payment via paypal, there is no problem. |
Same issue over here on version 2.4.6 |
Experiencing this issue with a 2.4.6-p3 installation. #29 {main} {"exception":"[object] (Exception(code: 0): The "000207577" order ID is incorrect. Verify the ID and try again. at /data/web/magento2/vendor/magento/module-paypal/Model/Ipn.php:147)"} [] |
I am facing the same issue on Magento 2.4.4. The payment is successful on the PayPal side, but there is no corresponding order shown in the admin sales order grid. |
Has anyone found a solution or workaround for this issue? Facing similar challenges and would appreciate any guidance. Thanks in advance! |
Hi @BezV8 , Thanks for your reporting and collaboration. Steps to reproduce
Please let us know if any other steps are needed to be performed. |
Hi @engcom-Delta. Thank you for working on this issue.
|
Hi @BezV8 , We have noticed that this issue has not been updated since long time. Thanks. |
When using paypal express integration as the payment method on Magento 2.2.2 a small number of orders fail after the payment has been taken by paypal. No order is registered in Magento, but paypal takes payment and sends a confirmation to both customer and store owner.
Looking in the logs the error which seems to be associated with these orders failing is:
main.CRITICAL: Wrong order ID: "000000222". {"exception":"[object] (Exception(code: 0): Wrong order ID: \"000000222\". at .../vendor/magento/module-paypal/Model/Ipn.php:140)"}
Preconditions
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: