• In test mode on Stripe, the recurring payment for the subscription failed during order processing and got this error: “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.”

    Note: I’m using a test card. am using Payment Plugins for Stripe WooCommerce with latest version.
    so how can we fix this error and automatic recurring payment for subscription orders in test mode?

    • This topic was modified 9 months, 1 week ago by jainishd.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @jainishd

    That error message shows most often when the payment method has been deleted from the Stripe account. You should login to stripe.com and search for the payment method ID and confirm if it was deleted.

    You can get the payment method ID and Stripe customer ID by clicking the pencil icon by the billing details of the Subscription page within WooCommerce Subscriptions.

    Kind Regards

    Thread Starter jainishd

    (@jainishd)

    I confirm it was deleted. then I created a new order for a subscription and when automatic recurring payments of that subscription gave an error like the below-mention

    Error
    “Recurring payment for order failed. Reason: The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.”


    then I checked the stripe dashboard gave 400 error from
    POST /v1/payment_intents request.

    Request POST body
    
    {
    
    "mandate": "mandate_1OlSPKSI7QIB2Nsg5xop31kv",
    
    "description": "Order 42 from trial original",
    
    "shipping": {
    
    "address": {
    
    "line2": "",
    
    "line1": "jjjjsss",
    
    "state": "GJ",
    
    "postal_code": "395010",
    
    "city": "surat",
    
    "country": "IN"
    
    },
    
    "name": "sd jasdd"
    
    },
    
    "metadata": {
    
    "gateway_id": "stripe_cc",
    
    "user_agent": "WordPress/6.4.3; https://localhost/trial",
    
    "partner": "PaymentPlugins",
    
    "user_id": "5",
    
    "order_id": "42",
    
    "product_18": "simple sub x 1",
    
    "ip_address": "::1"
    
    },
    
    "confirm": "true",
    
    "amount": "39900",
    
    "payment_method_types": {
    
    "0": "card"
    
    },
    
    "capture_method": "automatic",
    
    "currency": "INR",
    
    "customer": "cus_PadgwgdljsKHLy",
    
    "off_session": "true",
    
    "payment_method": "pm_1OlSP3SI7QIB2NsgD88yDaO0",
    
    "confirmation_method": "manual",
    
    "expand": {
    
    "0": "payment_method",
    
    "1": "charges.data.balance_transaction"
    
    }
    
    }

    Response body

    {

    “error”: {

    “message”: “The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.”,

    “request_log_url”: “https://dashboard.stripe.com/test/logs/req_UTH9qkftrlMSum?t=1708333260”,

    “type”: “invalid_request_error”

    }

    }

    Plugin Author Payment Plugins

    (@mrclayton)

    I confirm it was deleted.?

    Then that’s the source of the issue. You can’t process a recurring payment on a payment method that’s been detached (deleted) from a customer.

    If you’re testing recurring payments, you need to make sure the customer’s payment method isn’t being deleted.

    Thread Starter jainishd

    (@jainishd)

    in this case payment method was not deleted but got below mentioned error. I created a new order for a subscription and when automatic recurring payments of that subscription gave an error like the below-mention

    Error
    “Recurring payment for order failed. Reason: The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.”


    then I checked the stripe dashboard gave 400 error from
    POST /v1/payment_intents request.

    Request POST body
    
    {
    
    "mandate": "mandate_1OlSPKSI7QIB2Nsg5xop31kv",
    
    "description": "Order 42 from trial original",
    
    "shipping": {
    
    "address": {
    
    "line2": "",
    
    "line1": "jjjjsss",
    
    "state": "GJ",
    
    "postal_code": "395010",
    
    "city": "surat",
    
    "country": "IN"
    
    },
    
    "name": "sd jasdd"
    
    },
    
    "metadata": {
    
    "gateway_id": "stripe_cc",
    
    "user_agent": "WordPress/6.4.3; https://localhost/trial",
    
    "partner": "PaymentPlugins",
    
    "user_id": "5",
    
    "order_id": "42",
    
    "product_18": "simple sub x 1",
    
    "ip_address": "::1"
    
    },
    
    "confirm": "true",
    
    "amount": "39900",
    
    "payment_method_types": {
    
    "0": "card"
    
    },
    
    "capture_method": "automatic",
    
    "currency": "INR",
    
    "customer": "cus_PadgwgdljsKHLy",
    
    "off_session": "true",
    
    "payment_method": "pm_1OlSP3SI7QIB2NsgD88yDaO0",
    
    "confirmation_method": "manual",
    
    "expand": {
    
    "0": "payment_method",
    
    "1": "charges.data.balance_transaction"
    
    }
    
    }
    
    

    Response body

    {

    “error”: {

    “message”: “The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.”,

    “request_log_url”: “https://dashboard.stripe.com/test/logs/req_UTH9qkftrlMSum?t=1708333260”,

    “type”: “invalid_request_error”

    }

    }

    Plugin Author Payment Plugins

    (@mrclayton)

    What plugin are you using to offer subscriptions?

    What is your website url?

    Thread Starter jainishd

    (@jainishd)

    What plugin are you using to offer subscriptions? – woocommerce subscription

    What is your website url? – on local env

    Plugin Author Payment Plugins

    (@mrclayton)

    Please detail step by step your testing process. Something is not adding up with the log entries you posted. Here is how the plugin’s logic works:

    1. WooCommerce tells Stripe plugin to process payment from checkout page
    2. Stripe plugin checks if a new or saved payment method is being used.
      • If new payment method – add appropriate property to the payment intent object
    3. Create the payment intent by calling the Stripe API.
    4. If successful, complete order and return control back to WooCommerce.

    Kind Regards

    Thread Starter jainishd

    (@jainishd)

    step1: simple i create one subscription product.

    step2: place subscription order (parent order) via  Payment Plugins for Stripe WooCommerce (stripe)
    Step 3: when the next payment schedule for subscription, throw that error in order notes.

    note: i checked credit card checkbox and enable automatic payment. useing test acoout of stripe

    Woo Subscriptions Version 5.6.0?

    Payment Plugins for Stripe WooCommerce Version 3.3.58

    • This reply was modified 9 months, 1 week ago by jainishd.
    Plugin Author Payment Plugins

    (@mrclayton)

    Since this is on your localhost it will be difficult to diagnose the issue. I can say, we have tens of thousands of merchants using our plugin with WooCommerce Subscriptions. We test the integration very thoroughly.

    If you can replicate this on a staging site and can share a link to that site we’re happy to run some tests.

    Thread Starter jainishd

    (@jainishd)

    @jainishd We have exactly the same problem, any updates on this case?

    In my site,the initial fee happens than the subscription fee on stripe-test dashboard doesnt happens.Is this normal

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