Allow customising the payment element features using the customer session

Created on 29 March 2025, about 2 months ago

Problem/Motivation

Stripe's payment element offers various features that are only customisable by creating a CustomerSession.

These features focus on displaying saved cards in the payment element, or gathering permission to save the card. While these features aren't relevant if using Drupal Commerce's normal mechanism for showing saved payment methods in the PaymentInformation pane, they nonetheless can be made to work fine in a Drupal Commerce checkout and actually offer a superior UX for saved payment methods compared with the PaymentInformation pane (they have bigger UX budgets!).

Let's provide optional support for these features in the StripePaymentElement gateway and StripeReview checkout pane.

Proposed resolution

1. Create a CustomerSessionAttributes event to allow developers to specify the attributes they want.

2. Create a createCustomerSession method on the StripePaymentGateway plugin. This dispatches an event to gather attributes, creates a customer if necessary, and creates a customer session if necessary.

3. Call the createCustomerSession() method from the StripeReview pane.

Remaining tasks

User interface changes

None, unless developers choose to specify payment element features.

API changes

A new createCustomerSession() method on StripePaymentElementInterface.

Data model changes

None.

Feature request
Status

Active

Version

2.0

Component

Payment Element

Created by

🇬🇧United Kingdom jonathanshaw Stroud, UK

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

Merge Requests

Comments & Activities

  • Issue created by @jonathanshaw
  • 🇬🇧United Kingdom jonathanshaw Stroud, UK
  • Pipeline finished with Success
    about 2 months ago
    Total: 296s
    #460376
  • Pipeline finished with Success
    about 2 months ago
    Total: 288s
    #460409
  • 🇬🇧United Kingdom jonathanshaw Stroud, UK

    I think this is ready now, but I've not tested it properly and I'm reluctant to put more work into it without an thumbs-up in principle from a maintainer.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 505s
    #460826
  • Pipeline finished with Failed
    about 2 months ago
    Total: 362s
    #461653
  • Pipeline finished with Failed
    about 2 months ago
    Total: 292s
    #461673
  • Pipeline finished with Failed
    about 2 months ago
    Total: 357s
    #461748
  • Pipeline finished with Success
    about 2 months ago
    Total: 313s
    #461757
  • Pipeline finished with Success
    about 2 months ago
    Total: 613s
    #461921
  • Pipeline finished with Success
    about 2 months ago
    Total: 263s
    #461944
Production build 0.71.5 2024