- Issue created by @nicolas bouteille
- π«π·France nicolas bouteille
Ok I contacted Stripe Developers on Discord and asked them if it was required to separate Customer accounts between Card Element and Payment Element and they confirmed me that it isn't. We can totally reuse the same Customer object no matter if we use Card Element or Payment Element.
So I think perhaps this deserves a higher priority so switching to major and that even the Payment Element gateway should keep using 'stripe' in commerce_remote_id_provider instead of 'stripe_payment_element' - Status changed to Closed: duplicate
over 1 year ago 11:04am 4 December 2023 - π«π·France nicolas bouteille
I am closing this as a duplicate of π¬ Why a new payment gateway for Payment Element? How to switch from Card Element to Payment Element without losing stored credit cards and end up with two Stripe accounts per user? Active
- Status changed to Active
17 days ago 7:07pm 19 March 2025 - π¬π§United Kingdom jonathanshaw Stroud, UK
I think this may be an achievable and desirable feature. The multiple customer ids are a consequence of commerce's default assumption of one remote id per gateway, but there are valid circumstances for having differntly configured gateways on the same provider that share the same remote customer id.
PaymentGatewayBase assumes that the remote id is gateway specific:
$provider = $this->parentEntity->id() . '|' . $this->getMode();
I think our payment gateway plugin could just override get/setRemoteCustomerId:
$provider = 'commerce_stripe_shared|' . $this->getMode();Backwards compatability here is not trivial as there may be custom code making expectations about the provider id. Unfortunately there is no getProvider() method on the PaymentGatewayInterface to help with this.
We could adopt a permissive approach where if getRemoteCustomerId finds no customer id, it identifies all of the other stripe payment gateway plugins and gets the remote customer id from any of them that have one.
- πΊπΈUnited States torgosPizza Portland, OR
I agree that Stripe Customer IDs should be decoupled from payment gateways and considered as a property or field of a Drupal User. For our own integrations in Drupal 7, we wrote custom code that stored the Stripe Customer ID as a field value on the User Entity so that we could correctly process webhooks from Stripe for payment processing (recurring transactions for Subscriptions).
I think if a Drupal User is storing a payment method as a card on file for the Commerce store, it should be stored on the user so that they may reuse the same customer ID for any future purchases; this will help keep Stripe records consolidated and will avoid having multiple Customers listed for Users which could lead to data loss and would require reconciling them later, which can be very challenging and time consuming. So +1 to decoupling Stripe Customer IDs and making them a shared value for Drupal Users.