Open nirolph opened 1 year ago
Marking as high priority. This could be affecting merchants using WCPay gateway and tokenised subscriptions (WC Subscriptions extension), and would be a regression of behaviour – switching from $0 to $paid subscription plan is broken.
Note #5442 may mitigate this:
@haszari is this issue on Helix's radar? I am triaging this issue and I at first I wanted to put it in prioritization, but if team Helix is going to pick this up soon, I can move it to the different queue. Feel free to move it into "Ready for prioritization queue if this issue is not picked anytime soon by Helix team.
is this issue on Helix's radar?
It's in our project board and I'm looking for a new issue to work on, so picking this one up.
@shendy-a8c what's the status of this (do you have a draft PR/branch)? Any blockers – is it feasible for us to ship a fix in next sprint?
Just noting here that a similar issue is now merged within WooCommerce Stripe: https://github.com/woocommerce/woocommerce-gateway-stripe/pull/2561
cc @imodouglas
Describe the bug
When the customer switches subscriptions (WooCommerce Subscriptions), the subscription data used to populate the mandate is stale. WCS updates the subscription with the new details (renewal date, billing interval, price) after payment is completed. But the mandate is populated before payment completes, during the PaymentIntent creation. Due to this mismatch, the mandate will always use stale subscription data during a subscription switch.
This has two side effects:
0
will be sent as the mandate amount due to it using the stale (old/free) subscription data. Stripe responds with an error as they don't allow the amount to be below1
. This affects all customers, nut just Indian ones.To Reproduce
Initial setup
Linked products > grouped products
. This allows switching between the subscriptions.Switching from a free subscription to a paid one
Upgrade or Downgrade
button. This will take you to the grouped product page where you can select a new plan.We're not able to process this request. Please refresh the page and try again.
POST /v1/payment_intents
entry. Here's an example of a log from my test.parameter_invalid_integer - payment_method_options[card][mandate_options][amount] This value must be greater than or equal to 1.
.payment_method_options.card.mandate_options
is populated with the stale (old/free) subscription data.Switching between paid subscriptions
POST /v1/payment_intents
entry. Here's an example of a log from my test.payment_method_options.card.mandate_options
.Upgrade or Downgrade
button. This will take you to the grouped product page where you can select a new plan.POST /v1/payment_intents
entry. Here's an example of a log from my test.payment_method_options.card.mandate_options
.Renewals after a subscription switch.
I tested the following scenarios:
on-hold
renewal order was created and a subscription was placedon-hold
as well. (example Stripe log)failed
renewal order was created and the subscription was placedon-hold
. (example Stripe log) Something similar was reported in #5311Actual behavior
The mandate is populated using the stale subscription data during a subscription switch.
Screenshots
WCS switching settings
Expected behavior
The mandate uses the correct information during a subscription switch.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
3011
5311