Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential duplicate webhook actions #2331

Closed
Tracked by #3327
ryanr14 opened this issue Apr 2, 2022 · 77 comments · May be fixed by #2354
Closed
Tracked by #3327

Potential duplicate webhook actions #2331

ryanr14 opened this issue Apr 2, 2022 · 77 comments · May be fixed by #2354
Assignees
Labels
component: webhooks Issues related to webhooks priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue is a confirmed bug.

Comments

@ryanr14
Copy link
Member

ryanr14 commented Apr 2, 2022

Describe the bug
This issue already exists within WooCommerce Payments, could the same thing also be happening in the Stripe extension itself?

I worked on a ticket this morning( 4902272-zen ) where they have said most of their recent Stripe orders have these duplicate order notes from Stripe regarding the charge. For example they see this twice or more on their orders.

Stripe charge complete (Charge ID: ch_XXXXXX)

To Reproduce
I am not finding a specific way to replicate this as it doesn't happen on my local site in test mode, but it's happening just about every order on this customers site.

Expected behavior
No duplicate order notes. The customer thought customers were being charged twice, it doesn't seem that way since the charge IDs are the same in any duplicated or triplicated order notes.

Screenshots
https://d.pr/i/zDbDvh
Image link: https://d.pr/i/zDbDvh

@dreamtooloud
Copy link

The user from zd-4902272 mentioned that they have the same plugins set up on a different server and they don't see the duplicate notes problem. I've asked for some additional information about the configuration and if they've reached out to their server at all (on the problem site we are currently troubleshooting) to see if it's a server related issue.

@dreamtooloud
Copy link

dreamtooloud commented Apr 5, 2022

Another update from the same user. I had suggested (as a work around for their downloadable content issue) turning on the function to access download upon purchase, but they corrected what they said before about the payment statuses:

"Seems the status is not in "Processing" after the Stripe payment is finished. It is in "Waiting for payment"."

That means second status is triggering a push back to "pending payment" even though the payment has already been made.

They also mentioned this about their other server's settings: For the other server, we are using the same version of WooCommerce Plugin and Stripe gateway plugin. Seems everything work normally on the server.

They have included the System status in their ticket. Let me know if you want me to add it here.

@shaunkuschel
Copy link

I took a look at 4902272-zen and noticed that there are quite a fatal errors occurring around when this duplicate note/status change is happening:

2022-04-09T03:57:37+00:00 CRITICAL Uncaught Error: Call to a member function get_sku() on null in /wordpress/plugins/woocommerce/6.3.1/templates/single-product/meta.php:28
Stack trace:
#0 /wordpress/plugins/woocommerce/6.3.1/includes/wc-core-functions.php(345): include()
#1 /wordpress/plugins/woocommerce/6.3.1/includes/wc-template-functions.php(1646): wc_get_template('single-product/...')
#2 /wordpress/core/5.9.3/wp-includes/class-wp-hook.php(307): woocommerce_template_single_meta('')
#3 /wordpress/core/5.9.3/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#4 /wordpress/core/5.9.3/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
#5 /srv/htdocs/wp-content/themes/flatsome/woocommerce/content-single-product-lightbox.php(57): do_action('woocommerce_sin...')
#6 /wordpress/plugins/woocommerce/6.3.1/includes/wc-core-functions.php(345): include('/srv/htdocs/wp-...')
#7 /srv/htdocs/wp-content/themes/flatsome/inc/extensions/flatsome-wc-quick-view/flatsome-quick-view.php(41): wc_get_template('content-single-...')
#8 /wordpress/core/5.9.3/wp-includes/class-wp-hook.php(307): flatsome_quickview('')
#9 /wordpress/core/5.9.3/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
#10 /wordpress/core/5.9.3/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
#11 /wordpress/core/5.9.3/wp-admin/admin-ajax.php(202): do_action('wp_ajax_nopriv_...')
#12 {main}
  thrown 於 /wordpress/plugins/woocommerce/6.3.1/templates/single-product/meta.php on line 28

I suggested that they address that fatal error and see if that resolves the issue.

@thracefulton
Copy link

Another possible case in 4940814-zen.

@ryanr14
Copy link
Member Author

ryanr14 commented Apr 18, 2022

I was working again on 4940814-zen and they don't have any fatal error logs available as in @shaunkuschel's case. Just as an FYI. They enabled Stripe logging once they noticed this happening, but I don't believe it's happened again since April 8th for their site.

@joaodante
Copy link

Another case here: 4965600-zen

The merchant commented it's not happening with ALL orders (but with most of them).

@thelogicwizards
Copy link

4940814-zen reports that the issue persists, but they recently shared that:

Interesting to note that the doubling of logged ticket numbers on Order Details is no longer present on the affected orders, as far as we can tell, but the duplicate emails (obviously) and duplicate Stripe notices (but not charges) remain.

@aheckler
Copy link
Contributor

12595841-hc which led to 5083355-zen was this. Merchant solved it by disabling this in the Stripe settings:

Screenshot taken on 2022-04-25 at 19 27 07 UTC@2x

@lovo-h
Copy link
Contributor

lovo-h commented Apr 27, 2022

Just to clarify, this is not a case of duplicate webhook actions. Instead, it's the following:

  1. The webhook action payment_intent.succeeded being called.
  2. add_action( 'wp', [ $this, 'maybe_process_upe_redirect' ] ) being called when UPE is enabled.

That's why the merchant that @aheckler brought up had success in solving the issue when they disabled UPE: they removed pathway 2 (i.e. maybe_process_upe_redirect call).

1. The webhook action payment_intent.succeeded stacktrace:

abstract-wc-stripe-payment-gateway.php:539, WC_Stripe_Payment_Gateway->process_response()
class-wc-stripe-webhook-handler.php:854, WC_Stripe_Webhook_Handler->process_payment_intent_success()
class-wc-stripe-webhook-handler.php:990, WC_Stripe_Webhook_Handler->process_webhook()
class-wc-stripe-webhook-handler.php:70, WC_Stripe_Webhook_Handler->check_for_webhook()

2. add_action( 'wp', [ $this, 'maybe_process_upe_redirect' ] ) being called when UPE is enabled:

abstract-wc-stripe-payment-gateway.php:539, WC_Stripe_Payment_Gateway->process_response()
class-wc-stripe-upe-payment-gateway.php:923, WC_Stripe_UPE_Payment_Gateway->process_order_for_confirmed_intent()
class-wc-stripe-upe-payment-gateway.php:853, WC_Stripe_UPE_Payment_Gateway->process_upe_redirect_payment()
class-wc-stripe-upe-payment-gateway.php:822, WC_Stripe_UPE_Payment_Gateway->maybe_process_upe_redirect()
class-wc-stripe-intent-controller.php:680, WC_Stripe_Intent_Controller->maybe_process_upe_redirect()

These two pathways will need to be debugged and either the "Stripe charge complete" note needs to get removed from one or it may be a bit more involved and both of the pathways will need to be reevaluated.

@thisissandip
Copy link

5175398-zen

@stuartduff
Copy link
Member

5202573-zen The particular customer within this support ticket is finding that due to the duplication stock quantities are being reduced twice.

@Gabriel-Denys
Copy link

I am actually experiencing the exact same issue. It happened to me exactly after I deleted a webhook and configured a new one.

I get duplicate order notes, duplicate emails, and stock being reduced twice.

The issue does not occour when a customer pays via Apple Pay. I have the new checkout experience enabled.

I can share the logs if needed.

Are there any solutions other than switching back to the old checkout?

@cesarcosta99 cesarcosta99 added the priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. label May 17, 2022
@mouligreenlaw
Copy link

Hi there!
I'd like to update the merchant on 4940814-zen as to a possible release of this fix.
Is there anything I can tell them?

EvanDotPro added a commit that referenced this issue Jul 6, 2022
@solstudioim
Copy link

solstudioim commented Jul 8, 2022

It was reported in 5334483-zen and 5339700-zen too.

@dreamtooloud
Copy link

Have another report of this here: 36018895-hc and follow up here: 5202573-zen

Got creds to confirm relation to this bug--but I'm 99% sure it is connected base on the information the user provided.

@nicholasjeberlin
Copy link

5360179-zen

@LaurenceKay
Copy link

I am having this issue as well on 2 websites

Have just tried turning off new check out see if that resolves the issue.

@jos22
Copy link

jos22 commented Aug 9, 2022

5453836-zen. User is facing duplicate stock reduction on top of duplicate order notes just as @stuartduff mentioned.

@dreamtooloud
Copy link

Working on 5468298-zen where we have duplicate charge complete order notes plus duplicate points being awarded via WooCommerce Points and Rewards. Trying to confirm if it's related to this or not.

@mouligreenlaw
Copy link

mouligreenlaw commented Aug 11, 2022

Adding to @dreamtooloud comments relating to 5468298-zen
I looked at the orders received today, 11 Aug, and found that duplicate points were only awarded when Stripe was used and the customer had an account.
Out of 5 orders using Stripe, only one did not duplicate the Stripe note, and the two that had points applied show the duplicate points.
All orders that used PayPal awarded points once as expected.
My thinking is that this is not a bug in Points & Rewards and it is caused by this bug in Stripe.
Note: EPU features are disabled on this site.

@LaurenceKay
Copy link

I have spent some time looking into this seems 99% sure its some thing to do with the Try the new checkout experience (early access)

i have 4 websites 2 which had this activated had the issue, since turning off haven't seemed to have the problem.

@dreamtooloud
Copy link

We mentioned to the user that we didn't think there duplicate notes/inventory reduction was related to this issue because they don't have UPE enabled but after looking through all the notes here and the other tickets I do want to add this to the list, because everything else about it is similar: 5539401-zen.

Asking them to conduct a conflict test now to confirm the above.

@AbhinavSakalle
Copy link

5612750-zen
Duplicate order emails are also being sent.

@thisissandip
Copy link

Merchant from 5612750-zen deep dived into the issue and shared the below details:

I found that not all orders were affected by the problem, so I analyzed the last 50 orders to try to see if the orders that have the problem have similarities between them, and this will allow you to analyze them too.
I did not notice anything at the level of users (whether guest or registered), nor at the level of the amount of the order.
So I looked for Stripe and the nature of the payments (issuing bank, type of bank card, etc.).
The result is here: https://docs.google.com/spreadsheets/d/14pmlKeMCBfHLh5LHUcRTq6IqQwdBDa36gKJ0zvV_OlM/edit?usp=sharing

Unfortunately neither the issuing bank nor the type of card seems to affect the problem. However, I notice that the problem is less present for CB type cards.
3D secure, sometimes requested from the customer and sometimes exempted, does not seem to have any influence either.

On the other hand, I noticed that the 3D secure information did not always appear in the logs. That is to say that for certain payments, I do not have the information if the exemption or the submission took place. And in this specific case, the problem is systematically present.
The only exception is an iDEAL payment, but that's surely particular for this payment method. On the other hand, it seems important to me to note that the problem can exist for an alternative payment to the bank card (here iDEAL), contrary to what I had announced to you following the SOFORT payment which had worked.

Here is an image: https://diamant-strass-dmc.com/3dsecure_test.png

In my Drive table, the red terms in the image are listed in the "3D Secure" column.

Finally, I would like to point out that I have activated all possible Webhooks in my Stripe account.

@joashrajin
Copy link
Contributor

joashrajin commented Oct 14, 2022

+1 at 5628841-zd-woothemes

In this case, the customer also noticed the order received email was being sent twice

@roryWolf
Copy link

This merchant is also experiencing duplicate emails being sent: 4940814-zen

@wyter
Copy link

wyter commented Jul 31, 2024

Also reported on 8549523-zen

@wyter
Copy link

wyter commented Jul 31, 2024

8461577-zen matches the behavior pattern of this bug as well.

@carolframen
Copy link

8554787-zen

@lunasera41
Copy link

Also reported here - 8550782-zen
Asked user to switch back to Legacy Checkout.

@lunasera41
Copy link

Another report here - 8494205-zen

@lunasera41
Copy link

8514891-zen

@livingperson
Copy link

The issue was resolved after switching back to Legacy Checkout in 8497635-zen

This resolved my issue too

This did NOT resolve my issue. It broke the store, and we immediately had zero sales, after dozens of sales that same day. Once we lost a big number of sales, we had to switch back to turning off Legacy Checkout.

Who is working on this? Why is it not being solved?? It's been over two years!?!?

@wyter
Copy link

wyter commented Aug 5, 2024

8572882-zen

@grig-23
Copy link

grig-23 commented Aug 5, 2024

Some feedback from 8504106-zen.

There is only one webhook URL in the Stripe dashboard.

I'm not a developer, but looking through the request code on an order with duplicate triggered events I notice the following:

At the end of payment_intent.created (and similar for charge.succeeded)

"livemode": true, "pending_webhooks": 1, "request": "req_EOrkvh6EpwdQ2I", "type": "payment_intent.created"

At the end of payment_intent.succeeded

"livemode": true, "pending_webhooks": 2, "request": "req_EOrkvh6EpwdQ2I", "type": "payment_intent.succeeded"

I hope this is helpful!

@lunasera41
Copy link

Another report here 8569907-zen

@AbhinavSakalle
Copy link

Reported in 8583108-zen

@a-danae
Copy link
Contributor

a-danae commented Aug 9, 2024

Hey everyone! 👋

Update over here. Would you please give the latest version a go? It's 8.6.1.

It was released twelve hours ago and it includes a fix for this issue.

Closing this GH issue as it should have been fixed by #3331.

Please let us know if you notice anything off after the update. Thanks again for your patience and the details you provided. We'll be around.

@a-danae a-danae closed this as completed Aug 9, 2024
@TomasHurtz
Copy link

TomasHurtz commented Sep 27, 2024

Hello I am still getting duplicate order emails being generated. How can I check if this is the same bug?

EDIT I just noticed I appear to be using the Stripe legacy checkout and I have no idea why. I will disable that and see what happens.

@bdawson-ssapopka
Copy link

bdawson-ssapopka commented Oct 29, 2024

Edit: I see that this was actively being monitored in an Epic (#3327) and multiple other issues, but that was closed, too.

This issue should not be closed as I am still experiencing this problem. I previously commented in this thread here. I see there is a new issue that is addressing the same problem as well. The WooCommerce Stripe plugin is causing our customers to receive duplicate customer emails and causing WooCommerce to place duplicate order notes on order admin. We are running WooCommerce Stripe Gateway version 8.8.0, which we updated to after the changelog indicated this issue was fixed. Here are some recent screenshots of the symptoms:

Subscription Notes:
Image

Renewal Order Notes:
Image

Email Log:
Image

@diegocurbelo diegocurbelo assigned mattallan and unassigned a-danae Oct 29, 2024
@diegocurbelo diegocurbelo added the type: bug The issue is a confirmed bug. label Oct 29, 2024
@diegocurbelo diegocurbelo reopened this Oct 29, 2024
@russdx
Copy link

russdx commented Nov 6, 2024

I have the same issue as well with WooCommerce using latest stripe plugin 8.8.1

@clickstatement
Copy link

For anyone having this problem, we've had an issue with duplicate emails on and off for over a year now (Woocommerce / Woocommerce Subscriptions). What solved it, was disabling Object Cache on Cloudways. Hopefully this helps someone.

@ThyranWright
Copy link

ThyranWright commented Nov 7, 2024

Having the same issue double notes on orders creating duplicate emails. Woo Support suggested switching to legacy mode which I have but it has had no effect still experiencing the issue. Have disabled object cache as a test but that hasnt made a difference either.

Edit: Updating to 8.8.2 fixed the issue

@mattallan
Copy link
Contributor

Hi all, last week we released Stripe 8.8.2 which included a few key fixes to address the issues of duplicate order notes and emails on orders and subscription renewal orders:

For extra context, we found that stores with object caching enabled were having the webhook sent by Stripe processed concurrently with the original payment request. This resulted in us calling $order->payment_complete() twice as well as adding the "Stripe charge completed" order note multiple times.

Please update to the latest Stripe version and let me know if you're still noticing the issue.
There's multiple issues opened for this so I'm going to close this and continue any further investigation here: #3501

@russdx
Copy link

russdx commented Nov 12, 2024

Looks good since update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: webhooks Issues related to webhooks priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue is a confirmed bug.
Projects
None yet