PaymentIntent id rejected because already used

Created on 14 June 2024, about 1 year ago

Problem/Motivation

A customer reported that he is no longer able to make payments.
On the Stripe dashboard I found that for that customer, after the last successful payment, the same PaymentIntent id is reused and therefore Strtipe is unable to confirm the PaymentIntent request.
Events and logs ACTIVITIES

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

Steps to reproduce

not able to reproduce.

Proposed resolution

fix or workaround configuration

Remaining tasks

All

User interface changes

tbd

API changes

tbd

Data model changes

tbd

💬 Support request
Status

Active

Version

1.1

Component

Stripe Checkout

Created by

🇮🇹Italy AleDDR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @AleDDR
  • 🇨🇦Canada sagesolutions

    Unfortunately I am also running into this issue for one customer. He has purchased items before, and now when he tries to go through the checkout, he has the same payment intent ID, preventing him to checkout.

    "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": 144,
          "amount_details": {
            "tip": {
            }
          },
          "automatic_payment_methods": null,
          "canceled_at": null,
          "cancellation_reason": null,
          "capture_method": "automatic",
          "client_secret": "******************",
          "confirmation_method": "automatic",
          "created": 1739086429,
          "currency": "cad",
          "description": null,
          "last_payment_error": null,
          "livemode": true,
          "next_action": null,
          "payment_method": "pm_***************",
          "payment_method_configuration_details": null,
          "payment_method_types": [
            "card"
          ],
          "processing": null,
          "receipt_email": null,
          "setup_future_usage": null,
          "shipping": null,
          "source": null,
          "status": "succeeded"
        },
        "request_log_url": "https://dashboard.stripe.com/logs/req_***********",
        "type": "invalid_request_error"
      }
    

    I tried to remove the stripe data from the commerce_order table in the database, hoping it would create a new payment intent, but I think there is caching or something else working because the 'data' column was updated/reverted with the same payment intent ID after I ran

     update commerce_order set data = '' where order_id = 127419;
    
  • 🇬🇧United Kingdom newaytech

    Seeing this issue too - a previous customer logged into their account - then attempted to pay. Drupal perceived payment to fail - the order no longer exists - but the transaction succeeded in stripe.

    The payment intent was created - the card charged - then we saw this later in the Stripe dashboard:

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

    Have opened a ticket with Stripe to try and recreate on test - but adding here for others benefit too...

  • 🇨🇦Canada seanmacgillivray

    I'm experiencing this as well; we're building some automated testing and part of the flow is to create a test credit card. We're finding that we get this same error while trying to create it through the checkout flow, and although the payment method does get created, we're not able to delete it with /user/{uid}/payment-methods/{payment_method_id}/delete and we get a Stripe auth failure when we try.

  • 🇨🇦Canada seanmacgillivray

    I was able to get around the auth failure on the delete by using drush entity:delete and then re-add the payment method. I even tried upgrading stripe/stripe-php to 16 but the auth failure persisted.

Production build 0.71.5 2024