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

Importing Subscription (Stripe) payment_method_post_meta - _stripe_source id does not import #252

Open
cwright2405 opened this issue Feb 23, 2022 · 5 comments

Comments

@cwright2405
Copy link

Hi ,

When running an import of subscriptions where the payment gateway is stripe the stripe source id does not import.
The CSV column format is

payment_method_post_meta
_stripe_customer_id:cus_xxx|_stripe_source_id:pm_xxx

Subscription imports successfully but stripe source id remains blank, this means that automatic payment recurrence fails.

@adambware
Copy link

I have a similar issue I'm troubleshooting. Importing Stripe payment methods in the same format:

payment_method_post_meta
_stripe_customer_id:cus_xxx|_stripe_source_id:pm_xxx

This importer plugin's readme says that only stripe sources beginning with "card_" will be considered valid.

However, the Stripe plugin allows _stripe_source_id in the following formats:

  • card_
  • src_
  • pm_

See: validate_subscription_payment_meta() in woocommerce-gateway-stripe/includes/compat/trait-wc-stripe-subscriptions.php

When I import a Stripe payment method source beginning with "pm_", I end up with two wp_postmeta entries on each imported subscription for "_stripe_source_id":

  • The first "_stripe_source_id" meta_value is empty = ""
  • The other "_stripe_source_id" meta_value is correct

It appears if I run SQL to delete the empty source ID, my payments will process as expected.

I have not found the source of the duplicate postmeta entry..

@Maniac199
Copy link

The duplicate source_id is there no matter what. I was not supplying it and it was still showing up.

@kylercarlson
Copy link

Having the same problem today. On initial import, _stripe_source_id displays when looking at the DB, but then gets cleared out and is never visible on the subscription in the backend.

Solved the problem by using WooCommerce Import Export Suite plugin instead. Really frustrating.

@kasio99
Copy link

kasio99 commented Aug 17, 2022

I'm having the same issue too, no errors thrown though the _stripe_source_id fails to update, very frustrating.

@mtg169
Copy link

mtg169 commented Dec 7, 2022

For anyone else who runs into this issue where there is a duplicate _stripe_source_id being set with an empty value, the issue is not necessarily with this plugin, but with newer versions of the Stripe plugin and hooks it calls.

I debugged this plugin extensively and the only meta it adds is exactly what's in the spreadsheet.

I decided to then look into the Stripe plugin for anything setting the _stripe_source_id and the issue is caused by backwards compatibility code from when they renamed the meta key from _stripe_card_id to _stripe_source_id. The fix is to modify woocommerce-gateway-stripe/includes/compat/trait-wc-stripe-subscriptions.php and comment out or delete all blocks of code with a comment of For BW compat will remove in future.

This plugin will then work as intended and only add a single meta/key value for the _stripe_source_id.

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

6 participants