-
Notifications
You must be signed in to change notification settings - Fork 703
Description
Summary
In our app we want to always display the icon of the Payment Option and the entire payment sheet in light mode. That is a design choice. What happens is that because our background is white, when the user selects dark mode, then the actual icon is not visible.
Context
The payment sheet configuration allows clients to provide colors for both light and dark mode. And it seems the SDK is then deciding which one to use based on the device settings (ie. https://support.google.com/android/answer/9730472?hl=en).
The screenshot on the left was taken when the user is using light mode.
The screenshot on the right was taken when the user is using dark mode.
As you can see, the actual icon is different, depending on whether the user chooses light or dark mode for the entire device. If you try to put the icon on the right, on a white background, it will appear as an empty space.
The solution implemented by the iOS sdk is great because it allows clients to override the style of the Payment Sheet. I understand that on Android, we could call AppCompatDelegate.setDefaultNightMode, but that requires clients to declare a fixed theme for the entire app which will most likely have unintended consequences in other parts of the app -- which are not related to the payment sheet. Note that, most of our app has a dark layout (except some UI elements) and therefore, having our app "request" the Android system to use light mode everywhere has a high risk of conflicts.
As an alternative, I have tried to call AppCompatDelegate.setDefaultNightMode right before flowController.presentPaymentOptions(), but that causes the underlying activity to be recreated, which is not a good user experience.
Even when setting AppCompatDelegate.setDefaultNightMode as a global setting (at Application#onCreate), the icon that is included in the PaymentOption received through the PaymentOptionCallback, does not seem to "respect" the AppCompaDelegate setting, in the sense that, it's still a different icon depending on the user's setting of light and dark mode. In the video below there is a VISA icon, but it's full white on a white background -- ie. invisible to the user.
The best solution for us would be to align the Android SDK with the iOS one and provide a "style" setting when configuring the payment sheet appearance. And making sure that the icons returned in the PaymentOptionCallback respect that option:
var configuration = PaymentSheet.Configuration()
configuration.style = .alwaysLight
If you could look into this, we would very much appreciate it.
Android version
Android 16. But it's not specific to the android version.
Impacted devices
All devices.
Installation method
Gradle dependency.
Dependency Versions
kotlin: 2.2.20
stripe-android: 21.19.0
Android Gradle Plugin: 8.13.0
Gradle: 8.14.3
SDK classes
PaymentOption
PaymentSheet.Appearance
Video
Screen_recording_20251127_163744.mp4
