craftcms / commerce-stripe

Stripe payment gateway for Craft Commerce
https://plugins.craftcms.com/commerce-stripe
MIT License
31 stars 48 forks source link

"No Such Customer" on new installation in existing / active Commerce sites #302

Open cherrykoda opened 6 months ago

cherrykoda commented 6 months ago

Description

When adding Stripe to an existing Craft Commerce v4 site, existing users who have an order history cannot checkout due to a stripe error regarding their customer ID not existing in Stripe. The Stripe Customers table is understandably empty following installation, but the payment element returns an error about the customer not being found in Stripe.

image

This screenshot is using the Craft example templates, unmodified. Sidebar omitted for user data privacy.

For new users / guests / those without any orders, they correctly get the Stripe payment element

image

Stripe support pointed to the Commerce Plugin as being the issue. The expectation here would be for the Commerce Plugin to handle the payment gateway of a user that doesn't exist in Stripe as a new Stripe customer, without removing the Craft Order history that's already in the system.

Also - I have confirmed this same issue with another Craft developer who encountered the same. Discord link here to brief discussion: https://discord.com/channels/456442477667418113/666747438794670140/1241324249474404442

Steps to reproduce

  1. Take a v4 Commerce Site that has successful transactions on a non-Stripe gateway (Braintree in our case)
  2. Add the Stripe Commerce plugin using standard setups
  3. Hardcode the gateway at checkout to be the Stripe gateway
  4. Login as a Customer that has already ordered before
  5. Attempt to checkout, error appears on payment element

Additional info

image

linear[bot] commented 6 months ago

PT-1742 "Customer Does Not Exist" on new installation in existing / active Commerce sites

hassanmah commented 6 months ago

Hey, I also encountered the same issue but I saw the issue when switching from Stripe test environment to live

I also noticed the accounts we were using when Stripe test keys were being used, would come back as "customer doesn't exist" in Stripe when using live keys.

I managed to fix this by removing everything from the stripe_customers table.

But like @cherrykoda when I registered a new account in Craft, it worked ok

bliswebagency commented 5 months ago

We are also seeing the same problem here after upgrading to Commerce 4 using test credit details.

Screenshot 2024-06-03 at 5 24 28 PM