Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Wrong order ID: XXX Exception In PayPal Module
 
barnyshergold
Member
 
Avatar
Total Posts:  53
Joined:  2011-02-05
 

Hi,

We went live with v1.4.1 on Saturday and we keep ketting this error in the exception log :

2011-02-08T07:26:55+00:00 ERR (3): 
exception Exception with message Wrong order IDYY35694in C:/websites/app/code/core/Mage/Paypal/Model/Ipn.php:174
Stack trace
:

Now this is caused in this function :

protected function _getOrder()
    
{
        
if (empty($this->_order)) {
            
// get proper order
            
$id $this->_request[`invoice`];
            
$this->_order Mage::getModel(`sales/order`)->loadByIncrementId($id);
            if (!
$this->_order->getId()) {
                
throw new Exception(sprintf(`Wrong order ID: `%s`.`, $id));
            
}
            
// re-initialize config with the method code and store id
            
$methodCode $this->_order->getPayment()->getMethod();
            
$this->_config Mage::getModel(`paypal/config`, array($methodCode$this->_order->getStoreId()));
            if (!
$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) {
                
throw new Exception(sprintf(`Method `%s` is not available.`, $methodCode));
            
}

            $this
->_verifyOrder();
        
}
        
return $this->_order;
    
}

Now before going further it is important to note that the order mentioned in the exception throw DOES get placed properly in Magento and the money IS take successfully by PayPal.

The check being made is seeing if the the next invoice number matches the the order number (ie the two series should be in sync) however in our system they are not for 2 reasons - a) we use a different number prefix for orders and invoices and b) Magento is almost impossible to keep in step as if someone is paying by PayPal express an order number is reserved - if they then abandon the sale OR their PayPal fails, the order number is discarded. Hence even if the sequences were in sync they soon wouldnt be.

I would just like to confirm if it would be safe to comment out the check between order & invoice number - I cant see it causing a problem but Id just like to be sure.

What are other peoples experiences of this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 

Been suffering from this for ages also, though person here claims they fixed it, their fix hasn’t worked for me:
http://wrightcreativelabs.com/blog/58-paypal-wrong-order-id.html

It doesnt seem to prevent orders though for us either, so I guess not such a huge problem, just not ideal, especially since it makes tracking down all of Magento’s real bugs even harder…

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 

Niko,

Been having this problem for ages, Im amazed more people dont. In our case it really is a problem though as I think it prevents users from making it to the confirmation page / getting an email and as a result they re-place orders, assuming the first hasnt gone through. I havent found any workable solution to this and its really a problem.

Your suggestion about commenting out the check is interesting, but it seems to me this is more than just a \’check\’ but rather it is actually retreiving the order getId() seems more like it\’s making sure it successfully retrieved the order from the database, since the \’check\’ is just to see if any order id is returned.

What really bakes my noodle is that the ID we get is actually in the database by the time I can check things out, so I dont understand how it fails to retrieve the order.

Magento, why do you hate me so?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 

Niko,

Been having this problem for ages, Im amazed more people dont. In our case it really is a problem though as I think it prevents users from making it to the confirmation page / getting an email and as a result they re-place orders, assuming the first hasnt gone through. I havent found any workable solution to this and its really a problem.

Your suggestion about commenting out the check is interesting, but it seems to me this is more than just a ‘check’ but rather it is actually retreiving the order getId() seems more like it’s making sure it successfully retrieved the order from the database, since the ‘check’ is just to see if any order id is returned.

What really bakes my noodle is that the ID we get is actually in the database by the time I can check things out, so I dont understand how it fails to retrieve the order.

Magento, why do you hate me so?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 
NikolaiDante - 08 February 2011 02:38 AM

What are other peoples experiences of this?

Niko,

Been having this problem for ages, Im amazed more people dont. In our case it really is a problem though as I think it prevents users from making it to the confirmation page / getting an email and as a result they re-place orders, assuming the first hasnt gone through. I havent found any workable solution to this and its really a problem.

Your suggestion about commenting out the check is interesting, but it seems to me this is more than just a ‘check’ but rather it is actually retreiving the order getId() seems more like it’s making sure it successfully retrieved the order from the database, since the ‘check’ is just to see if any order id is returned.

What really bakes my noodle is that the ID we get is actually in the database by the time I can check things out, so I dont understand how it fails to retrieve the order.

Magento, why do you hate me so?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 
NikolaiDante - 08 February 2011 02:38 AM

What are other peoples experiences of this?

Niko,

Been having this problem for ages, Im amazed more people dont. In our case it really is a problem though as I think it prevents users from making it to the confirmation page / getting an email and as a result they re-place orders, assuming the first hasnt gone through. I havent found any workable solution to this and its really a problem.

Your suggestion about commenting out the check is interesting, but it seems to me this is more than just a ‘check’ but rather it is actually retreiving the order getId() seems more like it’s making sure it successfully retrieved the order from the database, since the ‘check’ is just to see if any order id is returned.

What really bakes my noodle is that the ID we get is actually in the database by the time I can check things out, so I dont understand how it fails to retrieve the order.

Magento, why do you hate me so?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 

Niko,

Been having this problem for ages, Im amazed more people dont. In our case it really is a problem though as I think it prevents users from making it to the confirmation page / getting an email and as a result they re-place orders, assuming the first hasnt gone through. I havent found any workable solution to this and its really a problem.

Your suggestion about commenting out the check is interesting, but it seems to me this is more than just a ‘check’ but rather it is actually retreiving the order getId() seems more like it’s making sure it successfully retrieved the order from the database, since the ‘check’ is just to see if any order id is returned.

What really bakes my noodle is that the ID we get is actually in the database by the time I can check things out, so I dont understand how it fails to retrieve the order.

Magento, why do you hate me so?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 

(sorry for the multiple posts, forums were borked yesterday. Another win Magento! hmmm )

 
Magento Community Magento Community
Magento Community
Magento Community
 
BF
Jr. Member
 
Total Posts:  3
Joined:  2010-12-17
 

I had the same problem with magento 1.4.1.1, PayPal Standard.
The invoice has not been automatically created for paid orders returned with status Completed from PayPal.

Fixed it by making changes to ‘Payment.php’ inside ‘\app\code\core\Mage\Sales\Model\Order\’ folder.

Updated function _isCaptureFinal($amountToCapture) around line 1202

// $orderGrandTotal - 4 decimal places e.g. 122.1222 (value kept in sales_flat_order)
//amountToCapture - 2 decimal places e.g. 122.00 (value returned from PayPal)

From:

$orderGrandTotal = sprintf(’%.4F’, $this->getOrder()->getBaseGrandTotal());

if ($orderGrandTotal == sprintf(’%.4F’, ($this->getBaseAmountPaidOnline() + $amountToCapture))) {

To:

$orderGrandTotal = sprintf(’%.2F’, $this->getOrder()->getBaseGrandTotal());

if ($orderGrandTotal == sprintf(’%.2F’, ($this->getBaseAmountPaidOnline() + $amountToCapture))) {

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 

For anyone keeping track, in v1.5.0.1 this is lines 1289-1290

This seems like a great possibility BF—have you filed it as a bug or anything? How on earth did you track it down? Anyway, I have implemented it on my own install and will see if it works for me (and report back). Thanks so much!

 
Magento Community Magento Community
Magento Community
Magento Community
 
BF
Jr. Member
 
Total Posts:  3
Joined:  2010-12-17
 

I have filed it as a bug today.  I implemented this on the website a couple of days ago since then all invoices created and no wrong order ids reported.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 

Any chance you got a link to the bug? I’m curious to see if Magento actually take care of this (also so I can know if it gets re-broken next time I update).

At the risk of jinxing it, so far so good for me too. Thanks again amigo, nice to know there are still some people out there who believe in the name ‘Community’ Edition =)

 
Magento Community Magento Community
Magento Community
Magento Community
 
BF
Jr. Member
 
Total Posts:  3
Joined:  2010-12-17
 

Bug ID #25559, current status is ‘assigned’.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben Marks
Guru
 
Avatar
Total Posts:  452
Joined:  2008-10-09
Isle of Palms, SC
 

Bug report noted above is here: http://www.magentocommerce.com/bug-tracking/issue?issue=11254

 
Magento Community Magento Community
Magento Community
Magento Community
 
RCPower
Jr. Member
 
Total Posts:  4
Joined:  2009-10-08
 
blueben - 02 May 2011 11:40 AM

Bug report noted above is here: http://www.magentocommerce.com/bug-tracking/issue?issue=11254

oh my dear god
We faced this problem a lot!
I can’t fixed it
My boss is going to kill me !!!!!!!!!!!!!!!!!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
tinotriste
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-09-09
Bolton, UK
 

I was also getting this error in my paypal_unknown_ipn.log file.

However I’ve noticed that it was appearing only for eBay orders.
I’m not sure why, I presume that Paypal is communicating with Magento everytime a payment is received and because those are ebay orders magento can’t find order ID.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2