Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
173 stars 69 forks source link

Paying for a failed renewal order should force the save payment method option on checkout #6209

Open mattallan opened 1 year ago

mattallan commented 1 year ago

Describe the bug

When a subscription renewal fails (limited funds or expired card, etc) and the customer goes to pay for the renewal order, by default, the checkbox for "Saving the new Payment Method" on the checkout is not selected.

image

When successfully paying for the renewal order, the subscription is reactivated, but the payment method wasn't updated. This results in the next subscription renewal failing again.

To Reproduce

  1. Purchase a new subscription product using the default Stripe test card 4242424242424242
  2. Simulate a failed renewal:
    1. First, go to My Account > Payment Methods
    2. You will see your saved payment method from the subscription purchase earlier.
    3. You’ll want to update the payment method with a card that can help you simulate a failed renewal. Use this specific test card: 4000000000000341.
    4. Go to the active subscription in WP admin and update the payment method to this new card and then process a renewal using the Subscription actions.
  3. Confirm you have a subscription that is "On hold" and is in "pending payment"
  4. Go to My Account > Subscriptions and view the on-hold subscription, see the "On hold"
  5. Scroll down to the related orders table and click "Pay" next to the pending order.
  6. Use a new payment method and don't check "Save payment information to my account for future purchases."
  7. Click "Renew Subscription"
  8. Confirm the subscription is active, but still has the old payment method that triggered the previous decline.
  9. Try to process another renewal and confirm the subscription renewal fails and the subscription is on-hold

Expected behavior

When paying for a subscription product via the checkout, we hide the "Save payment method" checkbox and force it to be enabled. We should do the same when paying for a subscription renewal manually via the checkout.

Subscription Purchase Renewal Order
image image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

EjayhanFernandes commented 1 year ago

Reported here: 6256721-zd-woothemes

kaushikasomaiya commented 1 year ago

Just adding some thoughts here:

When a subscription renewal fails (limited funds or expired card, etc) and the customer goes to pay for the renewal order, by default, the checkbox for "Saving the new Payment Method" on the checkout is not selected.

Since users are not changing the payment method and could be renewing a failed order or early renewal - it is okay to have a checkbox since at least one Card is already attached to the subscription.

It could be a temporary failure with the original card - so I am wondering if paying for a renewal order should really force the new credit card to be saved and attached to the subscription?

But during testing @EjayhanFernandes found out that the old card is detached from the subscription while paying via WCPay which appears to be a bug to me. (https://d.pr/i/ETW8Jx)

With Stripe, the old card still stays attached despite renewing from a new card.

jessy-p commented 1 year ago

According to Pc2DNy-3z-p2, this falls in Helix @haszari. Tagging as a part of Gamma Porter duties PcreKM-yM-p2.