Orders in pending move back to checkout review and then is purged.

Created on 23 March 2020, over 5 years ago
Updated 18 August 2025, about 2 months ago

Hi,

I've been in a very strange issue for these months. Some orders were move from 'Pending' status to checkout_review if the payment has the error "Duplicated payment", but not always.. After 1 day, all checkout_review orders are purged as is not a completed|pending state. We usually have ~60k/65k orders per year and we had aproximately 30 issues like this (we was able to identify, maybe more).

The issue happens when a customer tries to pay 2 times the same order without any ACK in Paypal. The transaction is identified as Duplicated Payment and it, automatically, changes wrongly the status to checkout review.

It happens when the webpage is slow and the payment process is slow/enqueued or similar. The user refresh the paypal page, click in pay again and a second request goes to the backend. All payments are processed and the latest one changes the status to checkout_review. The second request changes the status from pending to checkout review within the next minute. So the window is

It was hard but I was able to reproduce it and here are the steps:
1. Go through a cart until checkout review.
2. Select the Paypal Express Checkout payment method.
3. Complete the payment and let the page redirects you to paypal.

Then it comes the tricky thing to be able to reproduce it as many times as needed. We need to manually "slow down the page" at a certain point.
4. Duplicate the paypal page tab.
5. Enable xdebug and add a breakpoint at commerce_paypal_ec.module:821.
Line> if (!commerce_paypal_ec_do_payment($payment_method, $order, $charge)) {
6. Proceed with the payment in tab #1 and let the page reach the breakpoint.
7. Proceed with the payment in tab #2 and let the page reach the breakpoint.
8. Release the breakpoint of request #1 and check the order is in status 'pending' (or any other completed/pending status)
9. Release the breakpoint of request #2 and check the order moves to status checkout review β†’ because the previous page was review β†’ .
10. The order goes automatically to the checkout/order-id/review page with an error β†’ .

That's obviously not the way the error appears, but that's the way I was able to identify and reproduce this strange issue.

πŸ› Bug report
Status

Closed: outdated

Version

2.0

Component

PayPal EC

Created by

πŸ‡ͺπŸ‡ΈSpain isholgueras

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024