Hi @marlonsabala
There’s something off in your screenshot. The _wc_stripe_customer value is set to a payment method ID which is not correct. Did that happens because you manually changed it to that value on accident?
Kind Regards
Sorry about the delay. Been traveling for the last couple of weeks.
So, yeah, that was probably me changing it manually.
But I just spotted this happening again with another user on the live site. Something here is def not right.
So, that user X.
He’s been paying with a given card for the last few months with your plugin, no issues. This month the renewal attempt comes up with the error:
Recurring payment for order failed. Reason: A source must be attached to a customer to be used as a payment_method.
Why would that happen now?
Half an hour later the user goes in and manually pays for the renewal. This should update the Payment Method Token, but it does not. It’s still the old src_blahblah
I then have to go in and manually change it to the new style pm_blahblah which is correctly found both in the user page and on stripe.
No idea why, but I’m catching this more and more.
Any ideas?
Just caught another @mrclayton
Slightly different this one.
User a few days ago goes into the payments section of WC and updates his card. Your plugin shows the correct token on the user page, but sub fails to renew because the token was not updated there.
Why would that happen now?
Login to your stripe.com account and lookup that customer and see if their payment method was detached at any point in time.
Any ideas?
This plugin hook into the action woocommerce_subscription_failing_payment_method_updated_{$payment_method} which is triggered by WooCommerce Subscriptions when a failed renewal order is paid for. It seems like WCS is not triggering that action for some reason and so subscription’s payment method token isn’t updated.
When testing this scenario using a subscription that was created using this plugin, it works every time as expected.
Try checking your WordPress postmeta table and search using the subscription ID. What is the _payment_method meta_value? Does it say stripe_cc or something else like stripe?
User a few days ago goes into the payments section of WC and updates his card.
Adding a card via the My Account > Add Payment Method page is not related to WCS and that doesn’t automatically mean the customer’s subscriptions get updated with that payment method. Your customer would need to use the Change Payment method page that’s part of the WCS functionality.
Kind Regards
Hi @mrclayton
Thanks for your reply.
So, for that user that paid for the renewal manually after the initial failed payment, the _payment_method value was  stripe. I checked a brand-new sub, and it was stripe_cc.
Does that help?
Does that help?
Yes, that is helpful. What appears to be happening is since the failing subscription’s _payment_method value is stripe WCS sets the subscription to manual mode and the action woocommerce_subscription_failing_payment_method_updated_{$payment_method} doesn’t get triggered because WCS only calls that action if the subscription is not manual.
Our Stripe plugin doesn’t manipulate the _payment_method value to prevent any issues if you switch back to the other Stripe plugin. In your case, you could run a database query that updates all _payment_method values that equal stripe to stripe_cc. That should prevent this from happening to any other users.
Kind Regards
Got it.
I guess I could always revert that back if we ever decide to go back to the other plugin, correct?
I’m not tech savvy enough to do this I don’t think. 😬
Does this look right to you (https://ibb.co/0YHQYRr), or should I be more specific and filter by meta_key = Â _payment_method too? (not sure how I would do that)
However, the sub was not set to manual I don’t think. When I looked at the sub before changing the token, the payment method was still credit card.
However, the sub was not set to manual I don’t think. When I looked at the sub before changing the token, the payment method was still credit card.
That’s because of when you’re viewing it. The technical explanation is beyond the scope of this request but it has to do with when you’re observing it vs when the failed renewal order is being paid for on the frontend.
or should I be more specific and filter by meta_key =  _payment_method too? (not sure how I would do that)
You’re better off running a SQL query. Here is an example:
UPDATE wp_postmeta SET meta_value='stripe_cc' WHERE meta_value='stripe' AND meta_key='_payment_method'
Using phpmyadmin you can then simulate the query to see how many entries are affected. You can also rollback the query if there are any issues.
Got it. Ok, I’ll test this out.
Thanks again for your help