• Resolved Mark

    (@olcoil)


    This causes big problems as WooCommerce labels the order as FAILED, even though on stripe the customer has paid!

    This is not on a subscription order, so I thought it was strange. How and why would the system try to use a old PaymentIntent?

    I’ve read a few other posts here on the same error and with this simple order I’m not sure if it’s Caching, Plugins, or a gremlin?

    About our site:

    • recently installed the WooCommerce subscription plugin
    • also installed 2 reviews plugins and updated some other plugins that shouldn’t be in scope of Payment issues
    • nothing else done to site, all core softwares updated all the way.
    • no extensive caching done, only using Kinsta

    WooCommerce Error Code on Order Details

    Error processing payment.

    Reason: The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment,

    shared with a connected account without Customer attachment,

    was detached from a Customer. It may not be used again.

    To use a PaymentMethod multiple times, you must attach it to a Customer first.

    Order status changed from Processing to Failed.

    STRIPE SHOWS PAYMENT SUCCESS, YET ERROR ON THE PAYINTENT

    Response body

    {

    "error": {

    "code": "payment_intent_unexpected_state",

    "doc_url": "https://stripe.com/docs/error-codes/payment-intent-unexpected-state",

    "message": "You cannot confirm this PaymentIntent because it has already succeeded after being previously confirmed.",

    "payment_intent": {

    "id": "pi_*************************",

    "object": "payment_intent",

    "amount": 6454,

    "amount_details": {

    "tip": {

    }

    },

    "amount_subtotal": 6454,

    "automatic_payment_methods": null,

    "canceled_at": null,

    "cancellation_reason": null,

    "capture_method": "automatic",

    "client_secret": "pi_3P**********************_******_*********************Ic38",

    "confirmation_method": "automatic",

    "created": 1716319103,

    "currency": "cad",

    "description": "Order 85014 from ***********",

    "last_payment_error": null,

    "livemode": true,

    "next_action": null,

    "payment_method": "pm_1PIyCXIiLY5nleGb58WorCfc",

    "payment_method_configuration_details": null,

    "payment_method_types": [

    "card",

    "link"

    ],

    "processing": null,

    "receipt_email": "*************",

    "secret_key_confirmation": "optional",

    "setup_future_usage": null,

    "shipping": {

    "address": {

    "city": "Brampton",

    "country": "CA",

    "line1": "***********",

    "line2": "",

    "postal_code": "L6P 3N7",

    "state": "ON"

    },

    "carrier": null,

    "name": "***********",

    "phone": null,

    "tracking_number": null

    },

    "source": null,

    "status": "succeeded",

    "total_details": {

    "amount_discount": 0,

    "amount_tax": 0

    }

    },

    "request_log_url": "https://dashboard.stripe.com/acct_1KLY5MIiLY5nleGb/logs/req_L2hbHlcnEw4F5D?t=1716319142",

    "type": "invalid_request_error"

    }

    }
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    The error message from the order notes doesn’t coincide with the payment intent error from the stripe.com > logs page that you pasted.

    Order 85014 is from 5/21/24 and that’s associated with payment intent pi_3PIyCZIiLY5nleGb0V6m8CAx. The confirmation error occurs when you have duplicate requests that WooCommerce is serving. In version 3.3.71, we released an update that handles duplicate requests better. Duplicate requests are NOT caused by the Stripe plugin.

    There are several reason you might have duplicate requests such as:

    1. Your webserver is misconfigured and generates duplicate requests from load balancing
    2. A 3rd party plugin is telling WooCommerce to re-process a request

    The error The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment is the result of a duplicate request being received by WooCommerce. The payment method ID has already been used to process a payment for the order. If the payment method ID is seen again, it means the request is a duplicate.

    In version 3.3.71, the plugin handles these duplicate requests gracefully rather than showing updating the order’s status. I would highly recommend you take a look at your webserver logs and confirm if you have duplicate requests being served and if so, tracking down the origin.

    Kind Regards

    Jumping in here, not to hijack, but just to say that I’m also seeing this error:

    Recurring payment for order failed. Reason: The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment, shared with a connected account without Customer attachment, or was detached from a Customer. It may not be used again. To use a PaymentMethod multiple times, you must attach it to a Customer first.

    I’m not sure what it means. Context: This is a customer’s WooCommerce subscription renewal that has been working for 4 years. I’m currently running Payment Plugins v3.3.71. Not all subscription renewals by customers are showing this error – only a random few. When I look in stripe I don’t even find any record of a failed transaction for this renewal.

    Also, it doesn’t matter if I manually try to process the renewal order… it returns the same error.

    • This reply was modified 1 month, 1 week ago by Norm Sash.
    Plugin Author Payment Plugins

    (@mrclayton)

    When I look in stripe I don’t even find any record of a failed transaction for this renewal.

    You should go to the stripe.com > developers > logs page and there will be an entry there. That message is telling you that the customer’s payment method associated with the subscription has been removed from their account.

    In the stripe.com log, you will see the customer property. Click that and I bet you will see a detachment request for that custom where their payment method was removed.

    You can also get the Stripe customer ID by going to WooCommerce > Subscriptions > Click the subscription ID. Click the pencil icon above the billing address and you will see the Stripe Customer ID. Copy that then go to stripe.com > customers and search using that customer ID. On the customer page, you will see logged requests. Please confirm what you see on that page.

    Thanks

    Hey, thanks for pointing me in the right direction. I was able to find the Stripe transactions and view the customer records. I do see the failed Stripe transactions and the error message stated above along with the previous successful transactions.

    In Stripe I don’t see any payment methods on the customer account. In their WC account profile I see one payment method.

    The customer is on an annual renewal, and I see a number of events from 6/6/2023. See https://share.zight.com/L1ubeBGb

    I can understand one of the card detachments, but the other doesn’t make sense to me. I am suspicious of one thing thought. I was previously using WooCommerce Stripe plugin. Then when switching to Payment Plugins Stripe, when the customer made a payment two payment method entries are entered into their WC payment methods. One with a 4-digit date mm/yy and one with a 6-digit date mm/yyyy. The 4-digit one is WC Stripe, the 6-digit one is Payment Plugins.

    So in WC dashboard, two payment methods were listed, both having the same card number. I’m suspecting that the ‘duplicate’ payment method with 4-digit date (WC Stripe) was deleted, and then that ended up detaching the payment method from the customers Stripe account, even though the 6-digit date payment method (Payment Plugins) was still on the customer’s WC dashboard.

    Plugin Author Payment Plugins

    (@mrclayton)

    In Stripe I don’t see any payment methods on the customer account.

    That makes sense because in your screenshot, I can see where at least one detachment request was made.

    but the other doesn’t make sense to me.

    It’s impossible to say what your customer was up to but based on the logs they added and removed their payment method several times. As I showed via the link to the plugin code, there is only one way the Stripe plugin can detach a payment method, and that’s via the My Account > Payment Methods page.

    So in WC dashboard, two payment methods were listed, both having the same card number. I’m suspecting that the ‘duplicate’ payment method with 4-digit date (WC Stripe) was deleted, and then that ended up detaching the payment method from the customers Stripe account, even though the 6-digit date payment method (Payment Plugins) was still on the customer’s WC dashboard..

    I think that’s a good analysis of what potentially happened. On our end, we would need to test to see if a payment method created using WooCommerce Stripe Gateway would even show up if it’s disabled and our plugin is enabled. When you activate our plugin, it imports the customer’s payment methods saved in Stripe so they can be stored in this plugin’s format.

    I’ll get back to once some testing has been performed.

    Kind Regards

    Thread Starter Mark

    (@olcoil)

    Hi Norm, thanks for jumping in actually, you’ve seem to highlight the issue here and you are using a SUBSCRIPTION.

    For us, what’s strange is that these are not subscriptions.

    And of course our host tracked back our records and did not find any server backups, migrations, etc. And no we are not caching /checkouts/

    The issue happened twice around PaymentIntent API in stripe and could be a random glitch from Stripe on their end though I don’t think they’ve been much help here.

    As of right now I am disabling a few plugins and seeing what happens.

    There is a key flawed logic from WooCommerce’s developers or whoever made the decision here:

    1. Customer legit paid
    2. So never ever mark the order as FAILED, even if there is an error in some secondary data point like Payment Intent.

    Like, let’s get real here, as a business owner, we just want to make sure $ is in the bank and non-reversible, flag it but don’t FAIL it.

    Plugin Author Payment Plugins

    (@mrclayton)

    @olcoil In version 3.3.71 of the Stripe plugin, additional checks were added to handle the case of a duplicate request coming in. You should find that in the future, if a duplicate request does occur, it will be handled gracefully by the plugin and the order’s status won’t be changed.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.