Stripe connect implementation

Created on 3 June 2025, about 2 months ago

Problem/Motivation

Currently, the authentication is done via a Publishable key and a secret key. The new recommended authentication method is via OAuth / Stripe Connect.

We need to deprecate the old authentication method and perform the authentication via Stripe connect. This should simplify setting up a new Stripe payment gateway.

The only challenge is we need the payment gateway to be saved so we can save the credentials after successfully connecting to Drupal Commerce via the OAuth authorize route.

There is some UX work to be done to make it clear that connecting to Stripe is done AFTER saving the payment gateway.

๐Ÿ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ฑIsrael jsacksick

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

Merge Requests

Comments & Activities

  • Issue created by @jsacksick
  • ๐Ÿ‡ฎ๐Ÿ‡ฑIsrael jsacksick

    jsacksick โ†’ changed the visibility of the branch 3528108-stripe-connect-implementation to hidden.

  • Merge request !177Resolve #3528108 "Stripe connect" โ†’ (Merged) created by jsacksick
  • ๐Ÿ‡ณ๐Ÿ‡ดNorway zaporylie

    I tested the functionality of the patch and here are my findings:

    1. Connecting the gateway to a merchantโ€™s Stripe account works correctly, including disconnecting. This was tested using the Stripe Sandbox.
    2. If the gateway is first saved as "Stripe Connect" and later switched to "API Keys," it will silently revert back to "Stripe Connect" if the secret key is left empty. I believe additional validation should be added to prevent this.
    3. Additionally, if the merchant's account is already connected via "Connect with Stripe," switching the mode to "API Keys" invalidates the connection, but the "Stripe Connect" option remains selected. This could be confusing and may need better handling in the UI or logic.
    4. When the account is connected, the option to switch between "API Keys" and "Stripe Connect" should be disabled to prevent accidental misconfiguration.
    5. Placing the Connect/Disconnect button next to the "Mode" setting on the payment gateways page feels visually inconsistent. Consider replacing it with operation links for "Connect" and "Disconnect," and showing a styled button on the confirmation screen instead.
    6. The confirmation page shown during the "Connect with Stripe" flow could also serve as the landing page after submitting a new or existing payment gateway with "Stripe Connect" selectedโ€”if the merchant's account hasnโ€™t been connected yet.
    7. Disconnecting a Stripe gateway causes a WSOD on the checkout page if the user selects a payment method that was previously created with Stripe. This should be handled more gracefully.
    8. On a positive note, connecting, disconnecting, and reconnecting with Stripe Connect preserves access to previously created payment methods, which works well.
  • ๐Ÿ‡ฎ๐Ÿ‡ฑIsrael jsacksick

    If the gateway is first saved as "Stripe Connect" and later switched to "API Keys," it will silently revert back to "Stripe Connect" if the secret key is left empty. I believe additional validation should be added to prevent this.

    That is because it is the default. We don't really save the authentication method as it felt unnecessary.

    Placing the Connect/Disconnect button next to the "Mode" setting on the payment gateways page feels visually inconsistent. Consider replacing it with operation links for "Connect" and "Disconnect," and showing a styled button on the confirmation screen instead.

    The operation can be easily missed, which is why the connect button was added from the list.

    Disconnecting a Stripe gateway causes a WSOD on the checkout page if the user selects a payment method that was previously created with Stripe. This should be handled more gracefully.

    This is probably out of scope, but can look into handling this more gracefully. In theory, the best would be to not present those methods anymore.

  • ๐Ÿ‡ฎ๐Ÿ‡ฑIsrael jsacksick

    Additionally, if the merchant's account is already connected via "Connect with Stripe," switching the mode to "API Keys" invalidates the connection, but the "Stripe Connect" option remains selected. This could be confusing and may need better handling in the UI or logic.

    So if we prevent switching to API keys, this wouldn't happen right? Maybe this is what we should be doing and people should go through the disconnect link to disconnect properly.

  • ๐Ÿ‡ฎ๐Ÿ‡ฑIsrael jsacksick

    I think the feedbacks were addressed. Connection is now done from an Operation link, we just need to fix the styling on the Stripe connect confirmation form.

  • First commit to issue fork.
  • Pipeline finished with Running
    15 days ago
    #547761
  • ๐Ÿ‡ท๐Ÿ‡ธSerbia majmunbog

    The button is now consistently styled across all admin themes.

  • Pipeline finished with Skipped
    15 days ago
    #548707
  • Pipeline finished with Skipped
    15 days ago
    #548725
  • ๐Ÿ‡ฎ๐Ÿ‡ฑIsrael jsacksick
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024