We've been receiving several duplicate orders recently on our production server, not on every order, but the frequency of duplicate orders seems to be increasing. I've turned on PayPal logging and have compared the logs with duplicate orders with the logs for normal orders. There are no myDEBUG errors logged. The duplicate orders all have 11 PayPal logs recorded: 5 sets of paypalwpp_Paypal_Action_ and Paypal_CURL_ logs, followed by 1 ipn_ log. The CURL logs are (from first to last) SetExpressCheckout, GetExpressCheckoutDetails, DoExpressCheckoutPayment, GetExpressCheckoutDetails, and DoExpressCheckoutPayment. The CURL logs all indicate "Success". No errors are apparent from the logs. Only one payment is received by PayPal.
Logs from a normal order have 7 logs recorded, 3 sets of paypalwpp_Paypal_Action_ and Paypal_CURL_ logs, followed by 1 ipn_ log. The CURL logs are (from first to last) SetExpressCheckout, GetExpressCheckoutDetails, and DoExpressCheckoutPayment. Again, success is indicated on each.
The first paypalwpp_Paypal_Action log after the first 3 sets of paypalwpp_Paypal_Action_ and Paypal_CURL_ logs starts with ec_step2 Re-instantiating $order object. The second paypalwpp_Paypal_Action log after the first 3 sets of paypalwpp_Paypal_Action_ and Paypal_CURL_ logs starts with getLineItemDetails 7 - subtotal comparisons BEFORE line-item calcs. Another duplicate order case shows the same behavior except the order of the last 2 sets of paypalwpp_Paypal_Action_ and Paypal_CURL_ logs is different, being 2 PayPal_Action logs followed by 2 CURL logs. So I'm not sure I can trust the order of the logs as recorded.
Something must be triggering the last two sets of paypalwpp_Paypal_Action_ and Paypal_CURL_ logs when the duplicate orders occur. But why? And how to eliminate duplicate orders? I can not duplicate this behavior on a development system with the same code. Please help!
Dave
zc157c, php 8.2, mysql 8.0, SBA, edit orders, etc. PayPal button only on checkout_payment page. Classic template (not responsive).


Reply With Quote

