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

Stripe Subscriptions importing as manual renewal #266

Open
jayray87 opened this issue Apr 16, 2023 · 5 comments
Open

Stripe Subscriptions importing as manual renewal #266

jayray87 opened this issue Apr 16, 2023 · 5 comments

Comments

@jayray87
Copy link

Site is running in live mode and connected to Stripe. I am using the woocommerce stripe gateway plugin for stripe. I have subscriptions set to allow automatic renewal.

I have created the csv file with the user data, order data and stripe data

I do not put the billing address or shipping address. The product is set to virtual, so shipping should not be required. I don't know if this is an issues or not since the docs don't say whether or not it is required.

payment_method is set to stripe
payment_method_title is set to Credit Card (Stripe)
payment_method_post_meta is set to stripe_customerid:cus...|stripe_source_id:pm...

I got the cus and pm records directly from Stripe and copied them over.

The import runs without any error messages. However when the user is imported he is set to manual renewal. The db option requires_manual_renewal is set to true. I can manually change it to false which will show the payment method in the subscription as stripe instead of manual renewal, but when I do this, the renewal payment failed.

I don't know if there is something wrong with the csv file, or an issue with plugins. I was hoping someone could help.

Thanks.

@rmilesson
Copy link

We are experiencing the same issue. Is the system not compatible with Stripes PaymentMethods API?

@rmilesson
Copy link

Isn't this line of code the problem? This is in class-wcs-importer.php.

if ( $set_manual || $requires_manual_renewal ) {
	$subscription->set_requires_manual_renewal( true );
}

There should be an else clause or rather something like this:

$subscription->set_requires_manual_renewal( $set_manual || $requires_manual_renewal );

Since \WC_Subscription sets requires_manual_renewal to true by default. This is just after a quick debug and trying to understand. I might be completely wrong in my assumptions.

@suheth-agaetis
Copy link

I'm also facing the same issue. Is there any fix for this?

@kush1960
Copy link

Same issue here I'm afraid

@willnv
Copy link

willnv commented Aug 7, 2023

I've managed to fix the issue for me. Although I don't use this plugin because it doesn't seem to support the Stripe plugin we currently use. I'll try to give some context and hope this helps somebody out there.

- Stripe Plugins
There are 2 main stripe plugins, the official WC version (which apparently is supported by this exporter) and the Payment Plugins version - which is a third party backed by Stripe and the one we currently use. I found out that the official plugin still uses old token prefixing and they never put anything in place to fix that (src_ prefix is no longer used), while the Payment Plugins version is correctly updated (pm_) plus their support is very responsive.

--

- Issues
I've never used WC's exporter plugin, we used WebToffee's plugin but I found people here that had the exact same issues as me. I recommend giving it a go as well if you're experiencing the same problems.

- Subscriptions being set to manual renewal
In our case this was totally my fault. There is a column/meta inside the Subscription called _requires_manual_renewal. This setting was correctly set to false when I exported, but after I mapped the product IDs to our new store's IDs (which is not everybody's case) my CSV editor (Numbers, MacOS) set these values to FALSE instead o false and it took me a while to realize that. After changing to the correct lowercase value, the subscriptions were fixed.

Note that if you don't bring in the Subscription meta values:
_payment_method_token, and
_wc_stripe_customer
Your subscription WILL be set to manual, because Stripe won't sync the payment method to that subscription. Even if you migrated the 2 database tables containing the payment method data which I will talk about next.

IMPORTANT: these meta values are different if you're using the "official" WC plugin, as per their own documentation.

Just make sure the values are present within the subscription meta after you import. Check directly the database in the wp_postmeta and search for the subscription ID.

The third column/meta to look after is the payment_method. In my case, it is set to stripe_cc. Looks like the official plugin may still use just stripe. Now, I don't know for sure if this is an old naming convention or not. Wouldn't hurt to manually change and see what happens.

--

- Saved payment method data
Aside from the tokens used for auto payments, the actual card(s) on file shown to the user on the front-end does not come from the tokens inside the Subscription meta or the customer_id (cus_). There are 2 additional database tables you need to manually migrate because the exporter plugin we use doesn't do that:
wp_woocommerce_payment_tokens
wp_woocommerce_payment_tokenmeta

Note that these two tables don't need to be migrated in order for auto renewals to work because these are 2 separate issues. However, if you don't move them, it may give you problems in the future if a user tries to update their payment method, possibly creating a new customer in Stripe. I don't have much info on that though, so don't take my word for it. If you're having problems with auto-renewal please try a different export plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants