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

With UPE enabled, customers are being charged multiple times for renewal order #5615

Closed
james-allan opened this issue Feb 27, 2023 · 16 comments · Fixed by #5625
Closed

With UPE enabled, customers are being charged multiple times for renewal order #5615

james-allan opened this issue Feb 27, 2023 · 16 comments · Fixed by #5625
Labels
priority: critical The issue is critical—e.g. a fatal error, security problem affecting many customers. type: bug The issue is a confirmed bug.

Comments

@james-allan
Copy link
Contributor

james-allan commented Feb 27, 2023

Describe the bug

On the latest version of WC Payments (5.5 - released last week), subscription customers are being charged multiple times for renewal orders.

The cause of this was introduced in this PR:

As part of that PR, multiple instances of the payment method classes (eg CC_Payment_Gateway) are instantiated in each request. Those payment method classes extend WC_Payment_Gateway_WCPay and call that base class constructor. That class hierarchy leads to multiple calls of $this->maybe_init_subscriptions() which hooks onto the 'woocommerce_scheduled_subscription_payment_' . $this->id hook each time (code ref).

For as many 'woocommerce_scheduled_subscription_payment_' . $this->id functions that are hooked on, there are that many charge requests for renewal orders. For example, with legacy UPE this was 2 (CC + UPE). But with UPE SPlit enabled there were like 8 renewal order charges (CC + all the UPE ones).

To Reproduce

  1. Enable WC Payments 5.5.0
    2.Enable UPE.
  2. Enable the WC Subscriptions extension.
    3. Optional. Create a subscription product if you don't have one.
  3. Purchase the subscription.
  4. Go to the edit subscription screen and from the actions drop down, process a renewal order. (see screenshot below).
  5. Go to your Stripe dashboard and the transaction list.
  6. Note there are 2 or more charges for the same renewal order ID.

Screenshot 2023-02-27 at 1 27 38 pm

Admin Process renewal action.

Actual behavior

For every payment method class that extends the WC_Payment_Gateway_WCPay class, there's a $this->maybe_init_subscriptions() call and that leads to multiple instances WC Payments hooking onto woocommerce_scheduled_subscription_payment_.

For each one of those functions hooked onto that hook, there's a renewal charge being processed.

Screenshots

Screenshot 2023-02-27 at 1 25 25 pm

Duplicate charges.

Expected behavior

A customer should only be charged once for each renewal order.

@james-allan james-allan added type: bug The issue is a confirmed bug. priority: critical The issue is critical—e.g. a fatal error, security problem affecting many customers. labels Feb 27, 2023
@csmcneill
Copy link
Contributor

Affected merchants so far:

  • 5997330-zen
  • 5993042-zen
  • 5995326-zen
  • 5988005-zen

@ryanr14
Copy link

ryanr14 commented Feb 27, 2023

5996496-zen

@rashedripon
Copy link

41069772-hc

@shevene
Copy link

shevene commented Feb 27, 2023

5992705-zen

@Mxchael
Copy link

Mxchael commented Feb 27, 2023

5996940-zen

@thisissandip
Copy link

41098166-hc

@thisissandip
Copy link

36540221-hc
41098883-hc

@thisissandip
Copy link

6000842-zen

@francoishvz
Copy link

40957388-hc

@seanbelly
Copy link

5999165-zd-woothemes

@csmcneill
Copy link
Contributor

37442085-hc

@sarbouw
Copy link

sarbouw commented Feb 28, 2023

6003016-zen

@shaunkuschel
Copy link

6003901-zen
40296706-hc

@francoishvz
Copy link

40471767-hc

@francoishvz
Copy link

41142097-hc

@c-shultz
Copy link
Collaborator

c-shultz commented Mar 2, 2023

This has been addressed by #5625 which released in the 5.5.1 patch.

@c-shultz c-shultz closed this as completed Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: critical The issue is critical—e.g. a fatal error, security problem affecting many customers. type: bug The issue is a confirmed bug.
Projects
None yet