Forums / PayPal Website Payments Pro support / My Website Payments Pro Creates 2 Orders

My Website Payments Pro Creates 2 Orders

Locked

Views: 1,868

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
18 Mar 2009, 9:38 PM
#1
jaypee avatar

jaypee

New Zenner

Join Date:
Jun 2008
Posts:
11
Plugin Contributions:
0

My Website Payments Pro Creates 2 Orders

Hello all! We have been having problems with Website Payments Pro module since a long time ago, not sure how it started. Basically, when a person orders using Credit Card, I found out that zen cart tries to create 2 orders, 1 from the checkout_process.php file, and one from the ipn_main_handler.php file (data passed from Paypal). The one passed by Paypal will result in an error, because it won't be able to read the customer's session, and will create a fake one. The data being posted by Paypal doesn't include the customer's session ID, so it randomly takes a session from other people. :-/

So my question is... which of the 2 SHOULD create the order? checkout_process.php or ipn_main_handler.php? I checked my Paypal (normal Paypal/express checkout) module, and it's working fine because a) it passes the customer's session ID to Paypal and Paypal passes it back, and the ipn handler can read the session again, b) the Paypal module's before_process() function has a catch/condition, that is if it detects it came from Paypal, it doesn't create the order and lets the IPN main handler create the order. paypalpd only has this condition if there is an error. If there isn't an error, it continues the checkout_process.php script, hence an order is created.

I hope you can help me! I just need suggestions on where in paypaldp module to look, or if I should be passing the session ID to paypal.

Thanks!

18 Mar 2009, 11:39 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: My Website Payments Pro Creates 2 Orders

The paypaldp module uses the before_process() function to complete the payment, and moves on to the checkout_process module to store the order correctly.

If you're also getting records from the ipn_main_handler.php for transactions completed with Website Payments Pro, then you've got something damaged in your ipn code.
It has nothing to do with passing session ID to PayPal.
The ipn_main_handler should only "create" an order when the transaction was initiated via the Website Payments Standard/IPN module. Otherwise it should only be updating existing transactions if needed.

Maybe yours is using old code mixed with newer code?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Mar 2009, 7:40 PM
#3
jaypee avatar

jaypee

New Zenner

Join Date:
Jun 2008
Posts:
11
Plugin Contributions:
0

Re: My Website Payments Pro Creates 2 Orders

DrByte:

Maybe yours is using old code mixed with newer code?

Thanks DrByte! That makes sense. I imagine the site I manage to be a Frankenstein lol. I got the paypaldp and ipn_main_handler.php from 1.3.8, but my paypal_functions.php file is I think 1.3.5. (not really sure because I got it from somebody else). I got paypaldp to work by copying functions needed from the 1.3.8 version of paypal_functions.php to the paypal_functions.php that we have right now.

I checked the before_process of paypaldp, traced the cURL and noticed this line:

  $values['NOTIFYURL'] = urlencode(zen_href_link('ipn_main_handler.php', '', 'SSL',false,false,true));

(under the DoDirectPayment function in paypal_curl.php)

I think this is the one that tells Paypal to postback the info to our handler. Is this line needed? Also, I'm guessing the catching/order-creation-prevention for paypaldp happens in ipn_main_handler.php?

20 Mar 2009, 7:43 PM
#4
jaypee avatar

jaypee

New Zenner

Join Date:
Jun 2008
Posts:
11
Plugin Contributions:
0

Re: My Website Payments Pro Creates 2 Orders

The fix I did, which only works in sandbox environment, was to add a checking in the zen_paypal table if that transaction has already been entered, and if it's status is complete. If it is, it gets skipped. When I tested it in the live/real environment, it doesn't work. I think the live server posts back the info to the handler faster than the sandbox.

20 Mar 2009, 8:00 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: My Website Payments Pro Creates 2 Orders

jaypee:

I got the paypaldp and ipn_main_handler.php from 1.3.8, but my paypal_functions.php file is I think 1.3.5. (not really sure because I got it from somebody else). I got paypaldp to work by copying functions needed from the 1.3.8 version of paypal_functions.php to the paypal_functions.php that we have right now.Why the bleep would you do that? Sheesh!
I'm sorry, hybrid combining of functions/features between versions is not a supported configuration.
It's hard enough supporting "the last 2 versions" and working on writing a new one, and then people go mixing-and-matching on a whim ... AND you don't even disclose that fact until nothing else makes sense and you're exposed.

Good luck.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.