trier Posted April 23, 2015 Share Posted April 23, 2015 A small problem testing the new PayPal App (PP Standard) in the PP sandbox. I’m not sure if the situation can happen live or in any the other PayPal Standard (i.e. non App) version (it probably affects all when the ‘Auto Return for Website Payments’ option is set to true in the PayPal account) - If payment completion is by ‘return to site’ and not by the IPN (either can happen first, situation can be forced by rename/delete - ext/modules/payment/paypal/standard_ipn.php) - Place an order Sign-in to PayPal account - Press ‘Pay Now’ button Press ‘Back to Site xxxx’ button After a second or two, Press button ‘Click Here’ which follows the message “If you are not redirected within 10 seconds” Under these circumstances the return to checkout process often (always?) happens twice. Depending on the exact timing there appears to be 3 possible outcomes: The second return is before the order status has been updated:- order updating will occur twice, two emails will be sent, the checkout success page will be displayed. The second return is after the order status has been updated & before the shopping cart reset:- order updating will occur once, one email will be sent, the checkout success will be displayed. The second return is after the order has been updated & the shopping cart reset:- order updating will occur once, one email will be sent, the empty shopping cart page will be displayed. Obviously this shouldn’t happen, but if it can happen it will happen. Unfortunately the situations can’t be predicted/replicated exactly because of the lack of control over the timings. It appears the checkout_process is always loaded twice. The checkout_success sometimes loads twice other times checkout_success or shopping_cart loads once. Where/how/when does the first return go walkabout or get consumed by the second? Why don’t both returns to checkout_process always cause a subsequent page load? The only solution found thus far is to add near the top of checkout_process.php (‘txn_id’ seems to be unique to every payment) - if (isset($_POST['txn_id'])) { if (!isset($_SESSION['txn_id']) || $_SESSION['txn_id'] != $_POST['txn_id']) { $_SESSION['txn_id'] = $_POST['txn_id'] } else { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS)); } } Are there any hidden side affects to this solution? Is there a more correct/better solution? What would happen if the 2nd return occurs before the first return completes all its processing in paypal_standard.php? Should a delay (2 or 3 seconds?) be added before the redirect to checkout success? Can something similar could be added in paypal_standard->verifyTransaction() to prevent the freak occurrence of paypal_standard.php and standard_ipn.php clashing and simultaneously performing post order processing? Any knowledgeable clues would be greatly appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.