Skip to content

Module UI Customization

Yisuk Kim edited this page Jul 29, 2019 · 4 revisions

Many applications have their specific design paradigms. Therefore the SDK allows some level of customization for the provided user interface.

The following options are supported (see also PaymentMethodUIConfiguration):

  • backgroundColor
  • textColor
  • buttonColor
  • buttonDisabledColor
  • mediumEmphasisColor
  • cellBackgroundColor
  • buttonTextColor
  • snackBarBackground

To apply the UI configuration, supply the StashUiConfiguration object to the StashConfiguration

val textColor: Int = R.color.textColor
val backgroundColor: Int = R.color.backgroundColor
val buttonColor: Int = R.color.buttonColor
val buttonTextColor: Int = R.color.buttonTextColor
val cellBackgroundColor: Int = R.color.cellBackgroundColor
val mediumEmphasisColor: Int = R.color.mediumEmphasisColor
val snackBarBackground:Int = R.color.snackBarBackgroundColor

val stashUiConfiguration = StashUiConfiguration(
        textColor,
        backgroundColor,
        buttonColor,
        buttonTextColor,
        cellBackgroundColor,
        mediumEmphasisColor,
        snackBarBackground
)
val  configuration = StashConfiguration(
        publicKey = "YourApiKey",
        endpoint = "https://payment-dev.mblb.net/api/",
        integration = AdyenIntegration,
        testMode = true,
        stashUiConfiguration = stashUiConfiguration
)
Stash.initalize(this, configuration)

You can also change the UI customization after you are done with SDK initialization, by using configureUi method of Stash class, i.e.:

Stash.configureUi(stashUiConfiguration)

Let's take the following values as an example:

UI Customization sample values

If you applied customizations like in the example above, the result would be the following: Chooser Customized Screen Credit Card Customized Screen Credit Card Date Picker Credit Card Filled In