Zen Cart Logo
Forums / Bug Reports / [Resolved v1.3.9d/e] Paypal IPN double orders

[Resolved v1.3.9d/e] Paypal IPN double orders

Locked

Views: 11,095

Results 1 to 20 of 35
This thread is locked. New replies are disabled.
16 Feb 2009, 9:16 PM
#1
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

[Resolved v1.3.9d/e] Paypal IPN double orders

I recently had my host upgrade to PHP 5.2, so had to implement Dr Byte's fix for a speedy resolution. A couple of days later I noticed I started getting double orders, and worse still, my customers were getting double order emails. Each email has a consecutive order ID.

So best thing to do was to upgrade the 1.3.6 to 1.3.8. I was not sure whether the double orders were related to the sessions.php fix or something unrelated, but hoped an upgrade would solve both. I have just got my copied DB working on a "zen new" sub directory, and having just tested an end to end user order, I am still getting the double order.

Is this a known issue on the Paypal side (I read a thread where this happened before, ages ago) or something I can solve myself.

Because I was testing the install in a sub directory, I had to change the URLs on Paypal.com before the test. I wonder if I did not leave it long enough between changing them and testing?

Thanks for any help.

17 Feb 2009, 3:30 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

There have been some reports of getting duplicate notifications if you have PDT support enabled, and disabling that has been known to minimize that problem in some cases.
But, PDT support was only added in 1.3.7.1

17 Feb 2009, 9:25 AM
#3
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

Thanks Dr.

I did notice that the PDT option is enabled on Paypal.com, presumably by default when they added the feature. I wonder if switching that off might help.

I just don't see how the sessions.php fix could have done anything.

Either way, I will properly upgrade and see if it's still occurring.

17 Feb 2009, 10:13 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

The sessions.php "fix" has nothing to do with PayPal orders.

17 Feb 2009, 4:12 PM
#5
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

Upgrading seemed to do the trick.

17 Feb 2009, 4:51 PM
#6
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

Scratch that - my test orders worked, but a real one has just come through and again the double order. :oops:

Given that this seems to just affect me, and I am not using PDT, I am at a loss :(

17 Feb 2009, 7:54 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

Might be worth enabling paypal debug logging, and checking your logs folder for the IPN logs and see whether you're actually getting duplicate transactions from PayPal. Zen Cart should be detecting duplicates if they have same originating transaction ID from PayPal. But if PayPal is sending duplicates with different transaction IDs, I can see problems happening ... beyond control of ZC.

18 Feb 2009, 9:49 AM
#8
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

Thanks Dr and sorry in advance for the mammoth post.

I enabled logs to file, and a couple of orders greeted me this morning.

Looking at the logs, there are two separate files that reference the same chap:

Feb 17 2009 17:26 -- Keys for submission: Array
(
    [charset] => iso-8859-1
 //
STUFF
//
    [tax_cart] => 0.00
)

The second seems more comprehensive:

Feb 17 2009 17:28 -- IPN PROCESSING INITIATED. 
*** Originating IP: *.*.*.*  notify.paypal.com

Feb 17 2009 17:28 -- IPN INFO - POST VARS received (sorted):
Array
(
STUFF
)


Feb 17 2009 17:28 -- IPN INFO - POST VARS to be sent back for validation: 
To: www.paypal.com:80
POST /uk/cgi-bin/webscr HTTP/1.1
Host: www.paypal.com
Content-type: application/x-www-form-urlencoded
Content-length: 821
Connection: close

Array
(
STUFF
)


Feb 17 2009 17:28 -- IPN INFO - Confirmation/Validation response 
SUCCESS

Feb 17 2009 17:28 -- Breakpoint: 1 - Collected data from PayPal notification

Feb 17 2009 17:28 -- IPN INFO :: Transaction email details.
From IPN = * | *
From CONFIG = *

Feb 17 2009 17:28 -- Breakpoint: 2 - Validated transaction components

Feb 17 2009 17:28 -- Breakpoint: 3 - Communication method verified

Feb 17 2009 17:28 -- IPN NOTICE :: Could not find matched txn_id record in DB. Therefore is new to us. 

Feb 17 2009 17:28 -- Breakpoint: 4 - Details:  txn_type=unique    ordersID = 0  IPN_id=0

   Relevant data from POST:
     txn_type = unique
     parent_txn_id = None
     txn_id = *

Feb 17 2009 17:28 -- Breakpoint: 5 - Transaction type (txn_type) = unique

Feb 17 2009 17:28 -- IPN INFO :: Currency/Amount Details: 
PayPal email address = ***
 | mc_currency = GBP
 | submitted_currency = GBP
 | order_currency = GBP
 | mc_gross = 4.99
 | converted_amount = 4.99
 | order_amount = 4.99

Feb 17 2009 17:28 -- Breakpoint: 6 - Completed IPN order add.    ordersID = 6715  IPN_id =1202

So it does seem like Paypal are doing this. T tried switching the web service URL to the UK one layt night to see if it made any difference - evidently not.

Something possibly trivial - the Paypal account here is also used as the payment source for an eBay shop. I had 3 orders on the site since my last post so expected 3 (or in our case, 6) logs. I had 20 odd, and looking at them, they all seem to be referencing eBay auctions. I am a bit concerned as aside from this site, I am not using any other cart and there are things in the logs like auction titles so I know it's coming from eBay.

How on earth is Paypal getting logs to appear in my ZC install?

Feb 17 2009 17:16 -- IPN PROCESSING INITIATED. 
*** Originating IP: *.*.*.*  notify.paypal.com

Feb 17 2009 17:16 -- IPN FATAL ERROR :: Could not find stored session in DB, cannot re-create session as PayPal IPN transaction.

Feb 17 2009 17:16 -- IPN FATAL ERROR :: No saved IPN session data available. Must be an Express Checkout or Direct Pay transaction.

Feb 17 2009 17:16 -- IPN INFO - POST VARS received (sorted):
Array
(
STUFF
)


Feb 17 2009 17:16 -- IPN INFO - POST VARS to be sent back for validation: 
To: www.paypal.com:80
POST /uk/cgi-bin/webscr HTTP/1.1

Host: www.paypal.com

Content-type: application/x-www-form-urlencoded

Content-length: 1312

Connection: close

Array
(
STUFF
)


Feb 17 2009 17:16 -- IPN INFO - Confirmation/Validation response 
SUCCESS

Feb 17 2009 17:16 -- Breakpoint: 1 - Collected data from PayPal notification

Feb 17 2009 17:16 -- IPN INFO :: Transaction email details.
From IPN = * | *
From CONFIG = *

Feb 17 2009 17:16 -- Breakpoint: 2 - Validated transaction components

Feb 17 2009 17:16 -- Breakpoint: 3 - Communication method verified

Feb 17 2009 17:16 -- IPN NOTICE :: Could not find matched txn_id record in DB. Therefore is new to us. 

Feb 17 2009 17:16 -- Breakpoint: 4 - Details:  txn_type=unique    ordersID = 0  IPN_id=0

   Relevant data from POST:
     txn_type = unique
     parent_txn_id = None
     txn_id = *

Feb 17 2009 17:16 -- Breakpoint: 5 - Transaction type (txn_type) = unique

Feb 17 2009 17:16 -- IPN WARNING :: Currency/Amount Mismatch.  Details: 
PayPal email address = *
 | mc_currency = GBP
 | submitted_currency = GBP
 | order_currency = GBP
 | mc_gross = 14.30
 | converted_amount = 0.00
 | order_amount = 0
18 Feb 2009, 9:56 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

The IPN handler should be able to decipher between PayPal transactions originating by your cart vs anything that it receives from eBay transactions (it normally just ignores those).

18 Feb 2009, 11:31 AM
#10
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

DrByte:

The IPN handler should be able to decipher between PayPal transactions originating by your cart vs anything that it receives from eBay transactions (it normally just ignores those).

Thanks again.

The IPN handler in ZC? But why is Paypal even invoking it in the first place if the users are paying via the eBay/ Paypal website?

In the case of the double orders, is what is contained within those code snippets enough to trigger two orders? The first one seem like it's just an array, whereas the second one has various success statements and references a ZC order ID.

18 Feb 2009, 8:29 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

DMUK:

The IPN handler in ZC? But why is Paypal even invoking it in the first place if the users are paying via the eBay/ Paypal website?Because you gave your Zen Cart address as the Instant Payment Notification URL in your PayPal account profile settings. But, since you need the IPN feature enabled if you're going to use the IPN module, you've got to point it to "something".
You could point it to someplace else if you like, as long as that "other place" will acknowledge the IPNs it receives. Zen Cart will still tell PayPal to notify your Zen Cart store when the IPN relates to your Zen Cart transactions.

Granted, you could always turn off the IPN module in your store, and use Express Checkout instead.

DMUK:

In the case of the double orders, is what is contained within those code snippets enough to trigger two orders? The first one seem like it's just an array, whereas the second one has various success statements and references a ZC order ID.
Well, since you stripped out all the actual transaction data, I can't verify anything about them.
The first of the 3 you shared is just a display of the info being submitted to PayPal. It's not really needed for anything unless you believe PayPal is changing the data once they receive it ... that's very rare.
But, looking at the 2nd two files you shared, and strictly looking at the transaction amounts, I don't see how you think they're duplicates. One is for 4.99 and says it was successful, and the other for 14.30 and was not successful because it didn't find an existing matching order waiting for IPN validation ... which suggests it didn't even come from Zen Cart in the first place.

If you've shared all the log data you have, then there's nothing obvious indicating the cause for duplicates. Maybe you have an addon that's clashing somewhere?

19 Feb 2009, 9:49 AM
#12
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

DrByte:

Because you gave your Zen Cart address as the Instant Payment Notification URL in your PayPal account profile settings. But, since you need the IPN feature enabled if you're going to use the IPN module, you've got to point it to "something".
You could point it to someplace else if you like, as long as that "other place" will acknowledge the IPNs it receives. Zen Cart will still tell PayPal to notify your Zen Cart store when the IPN relates to your Zen Cart transactions.

Granted, you could always turn off the IPN module in your store, and use Express Checkout instead.

Understood - thank you. I think I will look into Express Checkout if it doesn't remove any functionality, like paying with debit card without being forced to open a Paypal account.

DrByte:

Well, since you stripped out all the actual transaction data, I can't verify anything about them.
The first of the 3 you shared is just a display of the info being submitted to PayPal. It's not really needed for anything unless you believe PayPal is changing the data once they receive it ... that's very rare.
But, looking at the 2nd two files you shared, and strictly looking at the transaction amounts, I don't see how you think they're duplicates. One is for 4.99 and says it was successful, and the other for 14.30 and was not successful because it didn't find an existing matching order waiting for IPN validation ... which suggests it didn't even come from Zen Cart in the first place.

Sorry, I should have been clearer, the first two snippets of code in my post are the ones that are identical, or at least are from the same person. The third snippet is one of the eBay notices.

In the first two, all the transaction data is the same, with the exception the second seems to be the one actually carrying out the order and transaction, whereas the first just seems to place an order.

19 Feb 2009, 9:51 AM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

DMUK:

In the first two, all the transaction data is the same, with the exception the second seems to be the one actually carrying out the order and transaction, whereas the first just seems to place an order.
Then they contain what I would expect them to contain when working normally.
They're not giving any reason for duplications occurring.

19 Feb 2009, 11:00 AM
#14
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

DrByte:

Then they contain what I would expect them to contain when working normally.
They're not giving any reason for duplications occurring.

Drat! :) So it is perfectly normal to expect two separate *.log files per Paypal IPN transaction.

Regarding Paypal Express, I am finding contradicting statements on this site regarding whether users can pay without a Paypal account.

I am also alarmed to read that standard website payments/IPN method does not report payments to the cart if theu user doesn't setup a Paypal account. If this bug on Paypal's side is still present, it seems awfully convenient leverage to a cart exclusively requiring a Paypal account or upgrading to Pro.

21 Feb 2009, 11:30 AM
#15
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

If the two logs show a single transaction and that's normal - is there anything else I can do to investigate why ZC is showing two orders?

27 Feb 2009, 10:19 AM
#16
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

Now it has started to send some orders through once and some in double. The plot thickens.

3 Mar 2009, 4:39 PM
#17
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

As much as I hate posting the fourth successive post to my own thread, I am really at a loss here.

According to Dr Byte, the IPN logs indicate normal activity (just to clarify, that's two separate log files per transaction, right?) which means this is not a problem with Paypal, which leaves, Zen Cart, environment, user error or customer action. I am 99.9% sure it's not user error simply based on how long I spent trying to rectify it, and I can rule customer action out as it's happening to nearly everyone.

That leaves ZC and environment issues - are there any further things I can do to try and isolate this issue?

Thanks

DMUK :smile:

17 Mar 2009, 12:38 AM
#18
sam_m avatar

sam_m

New Zenner

Join Date:
Nov 2007
Posts:
71
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

DMUK:

As much as I hate posting the fourth successive post to my own thread, I am really at a loss here.

According to Dr Byte, the IPN logs indicate normal activity (just to clarify, that's two separate log files per transaction, right?) which means this is not a problem with Paypal, which leaves, Zen Cart, environment, user error or customer action. I am 99.9% sure it's not user error simply based on how long I spent trying to rectify it, and I can rule customer action out as it's happening to nearly everyone.

That leaves ZC and environment issues - are there any further things I can do to try and isolate this issue?

Thanks

DMUK :smile:

Not thats its of any help but just for reference, but ive had something similar happen when using Protx Form (dont use paypal on this particular zen cart site), one order came through twice on the shop with different order numbers, but just one payment was taken, then recently 3 orders came through with just one payment. Perhaps it is a Zen Cart glitch?

17 Mar 2009, 9:35 AM
#19
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

It's certainly weird, but in the absence of tonnes of ZC users reporting the same issues en masse, it seems fairly localised to me (and you).

it was all triggered by a PHP upgrade, and the normal fix did not seem to work, nor a new update.

Right now, my customers are still getting two emails per order, creating much confusion and I am clueless to fix it :(

1 Apr 2009, 10:32 AM
#20
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: [Resolved v1.3.9d/e] Paypal IPN double orders

Okay, so I am officially at the end of my tether with this and about to throw the screen out the window. I have searched, and searched, and pored over everything here but nothing I do stops the duplicate orders occurring. I am now at the point where I start to consider porting from Zencart to something else because the customer experience is being affected with no light at the end of the tunnel. I don't want to do that (not least because I have not confirmed it's an issue with ZC so it's hardly a guaranteed solution).

Can anybody offer me a new path to try? A setting to check, a server value to investigate?