Customization
You own every pixel outside the payment element. Inside it, the card form (the only form the SDK renders) takes your locale, texts and theme; wallet buttons and Klarna's widget keep their partners' branding.
Locale, texts and theme
PurseHeadlessCheckout.init(
widgetData,
options = PluginOptions(
locale = "fr-FR",
cardFormTexts = CardFormTexts(
cardNumber = CardFormTexts.FieldTexts(label = "N° de carte", formatError = "Ce numéro est invalide."),
cvv = CardFormTexts.FieldTexts(label = "CVV", helperText = "3 chiffres au dos de la carte."),
),
theme = PurseTheme(
global = PurseTheme.Text(color = "#1A1A1A", fontFamily = "sans-serif", fontSize = "14px"),
globalInvalid = PurseTheme.Text(color = "#B3261E"),
input = PurseTheme.FieldStyle(placeholderColor = "#9AA0A6", backgroundColor = "#FFFFFF", fontSize = "16px"),
inputFocus = PurseTheme.FieldStyle(color = "#0B57D0"),
label = PurseTheme.Text(fontWeight = "600"),
helperText = PurseTheme.Text(fontSize = "12px", color = "#5F6368"),
gap = "12px",
),
),
)
options hold no state and are passed again to restore().
Theme scopes
The theme has the same scopes and fallback chain as the web SDK's theme:
| Scope | Applies to | Variants |
|---|---|---|
global | every text of the form | globalInvalid, globalValid |
input | the secure fields | inputFocus, inputInvalid, inputValid |
label | field labels | labelInvalid, labelValid |
helperText | helper and error texts | helperTextInvalid |
gap | spacing between fields |
Resolution is scope variant, then scope, then global variant, then global, over the SDK's defaults. Colors are hex strings, sizes are px or sp strings, as on the web.
Texts
CardFormTexts covers the card number, expiry, CVV and holder fields, each with label, placeholder, helperText, requiredError and formatError. Every null falls back to the SDK's localized resources (English and French today); your app's resource qualification overrides them per locale like any Android string.
Icons
checkout.iconUrl(item) returns the CDN URL of a method's or token's logo for the environment in use, and checkout.schemeAssets(cardMethod) the accepted card schemes with icon and label, so you never host partner logos yourself.