• Hi There,

    My client recently migrated their site from one host to another. Since the migration was completed, some of their clients have been unable to make payments on the website, whilst other clients are able to make payments as normal.

    When viewing the debug logs for a failed order, we note the following:

    [error] => stdClass Object
            (
                [message] => The provided source has already been used to make another payment. You cannot reuse sources without attaching them to a Customer object first.
                [type] => invalid_request_error
            )

    Thus far, the only workaround we have been able to find is to have the client login to their profile on our site, remove their saved payment information (i.e. stored card details) and then re-add their payment method.

    This is happening to dozens of orders per week, so this solution isn’t ideal. I am looking for a resolution, perhaps a function or some other code that can be used to rectify this issue across the board for any affected customers.

    Is there any solution like this available?

    Thanks
    Zach Nicodemous / Codeable.io

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter thewebdeveloperllc

    (@zach21uk)

    Following up, after some investigation I have figured out what has caused this, but not a solution.

    It appears that the default usernames in use on the WordPress side have changed in some cases. Stripe customers are created based on a few variables including username so if the username changes, Stripe doesn’t recognize that there is an existing customer in place with other details that match and then creates a new customer.

    When WooCommerce sends the stored card information to Stripe to process a transaction, Stripe correctly returns an error stating that the card information was already used for another customer.

    I think that the plugin creators need to add in a function/action that detects if any customer details are updated and then informs the Stripe API to update the customer details in the customer profile that exists there.

    There are a few different ways this could be done such as when a user makes changes to their profile and hits save, this triggers an action that could be tied into. There are a lot of other situations that cause details to change though, so perhaps a conditional if/else type query that detects if an email already exists in the Stripe Customer list, or a matching name or address, et cetera.

    Plugin Support B C. a11n

    (@battouly)

    Hi @zach21uk,

    It looks like this is happening to a subscription payment, if yes, can you please confirm if you are using WooCommerce Subscriptions ?

    In case you are indeed using our Subscriptions plugin, please contact us at WooCommerce.com > My Account > Support. You may need to create an account before you can access that page.

    Please include a link to this forum thread, so that we can keep track of what’s already been done.

    Thread Starter thewebdeveloperllc

    (@zach21uk)

    No, not a subscription. Just a standard payment. Many of the client’s customers are repeat buyers.

    This directly relates to the Stripe Gateway plugin, hence why I included it here 🙂

    Plugin Support Saravanan S, a11n

    (@simplysaru)

    Hey there @zach21uk,

    Could you confirm on how the migration was carried out?
    We haven’t seen such issues often during migrations.

    Thread Starter thewebdeveloperllc

    (@zach21uk)

    Hi There,

    The client carried out the migration using Flywheels migration tool. However, I do not feel this issue is unique to the situation.

    I’ve tested on a clean installation of WordPress/WoocCommerce with Stripe in Test Mode, and have found that anytime a username is changed in WordPress with a stored payment method, it triggers the creation of a second customer in Stripe which leads to the “The provided source has already been used to make another payment.” error.

    Hope this helps.
    Zach Nicodemous
    Codeable.io

    Plugin Support stephjacq a11n

    (@stephjacq)

    Automattic Happiness Engineer

    Hi @zach21uk,

    I tried to reproduce this on my test site, however usernames cannot be changed in WordPress, so I was unable to follow the steps provided (https://d.pr/i/QJf4gc).

    Could you confirm where you’re changing the username please?

    We asked about the migration because it sounds like the customers’ payment tokens may not have been migrated correctly from the table wp_woocommerce_payment_tokens, preserving the link to the correct user_id.

    One way to fix this would be to correct the tokens in that table in the database, matching them to the tokens in Stripe. Otherwise, it should be resolved when the customer makes a new purchase and re-enters their card number.

    Nico

    (@nicolamustone)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘The provided source has already been used to make another payment. You cannot re’ is closed to new replies.