Skip to content

Payment sheet user interface style#13361

Open
zainaraza43 wants to merge 3 commits into
stripe:masterfrom
zainaraza43:fix/12064-payment-sheet-user-interface-style
Open

Payment sheet user interface style#13361
zainaraza43 wants to merge 3 commits into
stripe:masterfrom
zainaraza43:fix/12064-payment-sheet-user-interface-style

Conversation

@zainaraza43

Copy link
Copy Markdown

Summary

Adds a new PaymentSheet.Appearance.UserInterfaceStyle (Automatic / AlwaysLight / AlwaysDark) that lets users force Payment Element to a fixed light or dark appearance regardless of device's system theme setting. The forced appearance is honoured by:

  • the in-sheet UI — colors, text fields / payment forms, payment-method rows, the Google Pay and
    primary buttons, and the text cursor, and
  • the PaymentOption.icon() drawable (the "Payment Method" logo the user renders in their own UI).

It also adds a "User Interface Style" control into the paymentsheet-example Playground appearance editor for testing purposes.

Motivation

Closes #12064

Testing

  • Added tests

  • Modified tests

  • Manually verified

  • Unit: Appearance.resolveIsDark(...) / nightModeOverride() truth tables; StripeThemeNightModeOverrideTest; PaymentSelectionIconLoaderTest

  • Paparazzi: ForcedLightPrimaryButtonScreenshotTest and ForcedLightPaymentMethodRowScreenshotTest

  • Manually verified in the Playground (see video): Appearance → User Interface Style → AlwaysLight / AlwaysDark / Automatic, across system light and dark, checking the Payment Method logo, the payment forms/fields, rows, and buttons.

Screenshots

Please Note:

  • The "Before" Screen recording was made on an altered version of Playground I made to reproduce the bug (this is currently in an uncommitted branch locally, NOT IN THIS PR nor is it intended to be anything but a visual
  • The "After" Screen recording uses the new control for "User Interface Style" so devs can have the option to test with the new feature in Playground (this is committed in this PR)
Before After
before after

Changelog

Adds a public `PaymentSheet.Appearance.UserInterfaceStyle`
(Automatic/AlwaysLight/AlwaysDark) so merchants can force Payment
Element to a fixed light or dark appearance regardless of the device's
system night setting, matching the iOS `configuration.style` option.

The forced appearance is resolved per-surface from the appearance the
surface holds and exposed through a new `LocalStripeIsDarkTheme`
composition local, so colors, text fields, payment-method rows, the
Google Pay and primary buttons, and the `PaymentOption.icon()` drawable
all honor it consistently rather than reading the device night setting
directly. The icon loader additionally loads drawables through a
night-overridden Resources so the qualifier-based card brand icons
resolve to the forced appearance.
Exposes the new PaymentSheet.Appearance UserInterfaceStyle in the
Playground's Appearance editor so the forced light/dark appearance can
be toggled (Automatic/AlwaysLight/AlwaysDark) at runtime for testing.
…rride

`PaymentOption.icon()` is drawn in the merchant's own UI, outside any
Stripe composition, and its light/dark variant was resolved from the
process-global `StripeTheme.nightModeOverride` at the cached moment it was
first drawn — unrelated to the configured style — so the icon followed
the device setting instead of the forced appearance.

Resolve the forced override from the configuration the FlowController
holds and bake it into the `PaymentOption` at creation: `IconLoader.load`
and `PaymentOptionFactory.create` take a `forcedDarkOverride` that takes
precedence over the global; `DefaultFlowController` passes
`config.appearance.nightModeOverride()`. Embedded/Link/CustomerSheet pass
`null` and keep their current behavior via the global fallback.
@cla-assistant

cla-assistant Bot commented Jul 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@zainaraza43 zainaraza43 marked this pull request as ready for review July 6, 2026 22:57
@zainaraza43 zainaraza43 requested review from a team as code owners July 6, 2026 22:57
@zainaraza43 zainaraza43 requested a review from cttsai-stripe July 6, 2026 22:57
@zainaraza43 zainaraza43 changed the title Fix/12064 payment sheet user interface style Payment sheet user interface style Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] PaymentOption icon is blank

1 participant