Customization Theme
The main class describing theme is called CheckoutTheme
.
It uses additional component classes like:
ButtonComponent
LabelComponent
TextFieldComponent
The CheckoutTheme
class consists of objects that define various UI components. While the names of these components largely correspond to those listed here, they also include platform-specific fields for further customization.
All properties in the CheckoutTheme
class are optional, allowing users to customize any of them as needed.
If a property is not specified, the default value (as defined in the Figma design here) will be automatically applied.
General
Fees
Data
Other
selectPaymentMethodTitleLabel
The text of "Select Payment Method" in the bottom sheet header
inputTextField
Font and color of text in any input field (including disabled state)
backgroundColor
The main background of the SDK view component
UIColor
backgroundColorModal
The background of any modal window
UIColor
iconColor
The color of the icon of the payment
UIColor
paymentItemBackgroundColor
The background of an item in payment options list
UIColor
selectPaymentMethodTitleBackgroundColor
The background of the "Select Payment Method" bottom sheet header
UIColor
switchOnTintColor
The color of switch (toggle) control
UIColor
showPaymentDetails
Boolean variable determining whether the “Payment Details” section should be displayed or hidden.
Boolean
color
UIColor
font
UIFont
fontFamily
String
enabledTitleColor
UIColor
disabledTitleColor
UIColor
font
UIFont
enabledBackgroundColor
UIColor
disabledBackgroundColor
UIColor
fontFamily
String
left
Int
top
Int
right
Int
bottom
Int
To configure the theme
, similar steps must be followed as described in the test app file.
Code Snippet:
func createTheme() - > CheckoutTheme {
var theme = CheckoutTheme()
theme.backgroundColor = .systemBackground
theme.backgroundColorModal = .secondarySystemBackground
theme.margins = UIEdgeInsets(top: 8, left: 2, bottom: 8, right: 2)
theme.mainTitle.color = .label
theme.mainTitle.fontFamily = "Arial"
theme.button.enabledTitleColor = .payButtonTitle
theme.button.disabledTitleColor = .payButtonDisabledTitle
theme.button.fontFamily = "Arial"
theme.button.enabledBackgroundColor = .payButtonBackground
theme.button.disabledBackgroundColor = .payButtonDisabledBackground
return theme
}
The theme object is passed to the SDK initialization as shown below:
Code Snippet:
self.checkout = Checkout(
theme: theme,
sessionId: sessionId,
merchantId: merchantId,
apiKey: apiKey,
delegate: self
)
Last updated