Forums / Built-in Shipping and Payment Modules / Understanding checkout flow regarding paypal, checkout_process.php and before_process

Understanding checkout flow regarding paypal, checkout_process.php and before_process

Locked
Results 1 to 2 of 2
This thread is locked. New replies are disabled.
01 Sep 2009, 10:54
#1
s_p_ike avatar

s_p_ike

Zen Follower

Join Date:
Feb 2005
Posts:
178
Plugin Contributions:
0

Understanding checkout flow regarding paypal, checkout_process.php and before_process

Hello,

v 1.3.8 heavily modified (but the files concerning this question are untouched)

The problem: The notifier NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES at the end of checkout_process.php is not executed when paypal is the payment method selected (Paypal IPN). That notifier is correctly executed when another payment method is selected, even when is selected a payment method (developed by myself) which rely on an external gateway to process credit cards payment.

So I scanned the paypal.php file (includes/modules/payment/) to understand what was going on and focues my attention on the before_process function, because I saw that if MODULE_PAYMENT_PAYPAL_PDTTOKEN is empty (which is my case), then the cart is resetted and usual session variables related to the order are unset and then there's a redirect to checkout_success.

I understand that this could be the point: whenever there's a paypal payment the checkout flow is not the regular one because when before_process is executed it stops the flow (due to MODULE_PAYMENT_PAYPAL_PDTTOKEN == '') and redirect directly to checkout_success, without executing the code that comes after the call to before_process in checkout_process.php

Is it right?

If so, how are sent the order confirmation mails?

And ... would be right to place the call of the notifier just before the redirection to checkout_success in before_process function of paypal.php?

Thank you for your opinion.
01 Sep 2009, 11:50
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Understanding checkout flow regarding paypal, checkout_process.php and before_process

s_p_ike:

whenever there's a paypal payment the checkout flow is not the regular one

Correct. That's because the PayPal IPN (Website Payments Standard) module does not record the payment as part of the customer's session.
Instead, PayPal initiates that by sending the IPN to the store's ipn_main_handler.php file ... which then validates the payment notice, does some security checks, and then saves the order and sends the emails. It does not trigger the usual checkout_process notifiers as part of that process.

You can avoid all the limitations of storing orders with the IPN technology by turning OFF the Website Payments Standard(IPN) module, and using Express Checkout instead -- Express Checkout will fire all the usual notifiers and is way more reliable in the way it saves order data because it doesn't have to rely on a separate background notification process to generate orders.