woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
237 stars 207 forks source link

Changing subscription from credit card to SEPA should also update the subscription's payment method field #1133

Open gerdneuman opened 4 years ago

gerdneuman commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. A customer has an subscriptions with payment credit card
  2. Using the WooCommerce interface she adds/changes the payment method of this subscription to Stripe's SEPA
  3. The new payment SEPA src_ is successfully registered at stripe.com for the existing cus_ (number 1 in screenshot)
  4. And also the subscription's billing field Stripe Source ID at WooCommerce's Edit subscription page is correctly updated (number 2 in screenshot)
  5. However, on the same page the subscriptions billing dropdown/select Payment method above the Stripe Source ID remains still to be set to Credit Card (number 3 in screenshot)

Expected behavior The subscriptions billing dropdown/select Payment method above the Stripe Source ID needs also to be updated to SEPA (number 3 in screenshot)

Screenshot Auswahl_039

Environment (please complete the following information):

Additional context This happens from time to time in our shop, not sure if always or only in edge cases. If you need any infos from certain logs, either from WooCommerce's shop logs or from the stripe.com account logs, then let me know. I would try to dig into the logs and see if I could find what you need.

gerdneuman commented 4 years ago

I've seen something very similar again as part of #1145, but this time it is not a credit card => sepa, but sepa => sepa change:

  1. User with active subscription that has stripe cus_OLD and sepa src_OLD adds or changes to a new sepa src_NEW which hereby also creates a new cus_NEW (not sure why a new cus_NEW is created and not the old cus_OLD reused)
  2. The subscription stripe source ID is correctly change to the new src_NEW sepa. But the stripe customer ID remains as cus_OLD.

With the next renewal payment this results in the error message being The source src_NEW is attached to a different customer than cus_OLD. Please charge the source using that attached customer. as outlined in #1145:

Error: stdClass Object
(
    [error] => stdClass Object
        (
            [message] => The source src_NEW is attached to a different customer than cus_OLD. Please charge the source using that attached customer.
            [param] => source
            [type] => invalid_request_error
        )

)

After editing the subscription and changing the stripe customer ID to cus_NEW, and then creating new renewal order manually and processing the renewal payment of it, then the payment works.

Altogether it seems that adding or switching SEPA sources seems not very robust.

reykjalin commented 4 years ago

I'm tagging this issue with Priority: Low, since so far it seems this issue has only been reported once.