Learn about customisation options for the click-once component.
val clickOnceComponentConfig = ClickOnceComponentConfig(
headerTitle = String,
submitText = String?,
submitProcessingText = String?,
selectCardText = String,
expiredText = String?,
validThruText = String?,
hideCardBrandLogo = Boolean,
disableCardSelection = Boolean,
isRenderLastPurchaseCard = Boolean,
isRenderLastPayoutCard = Boolean,
isCvcRequired = Boolean,
useTransparentCardBrandImage = Boolean,
isProcessNextStepOnCardClick = Boolean,
cvcComponentConfig = CardCvcComponentConfig?,
cardSubmitComponentConfig = CardSubmitComponentConfig?,
notificationConfig = NotificationConfig,
cardBrandImages = CardBrandImages?,
filterBy = CardTokenFilter,
orderBy = CardTokenOrder,
limitTokens = Int?,
style = ClickOnceStyle
)| Property | Description |
|---|---|
headerTitleString | Title text displayed at the top of the component. Defaults to default header title. |
submitTextString? | Text displayed on the submit button. |
submitProcessingTextString? | Text displayed during processing/loading state. Defaults to default processing text. |
selectCardTextString | Text for card selection prompt. Defaults to "Select Card". |
expiredTextString? | Text displayed for expired cards. |
validThruTextString? | Text displayed before expiry date (e.g., "Valid Thru"). Defaults to "Valid Thru". |
hideCardBrandLogoBoolean | Whether to hide the card brand logo/icon. Defaults to false. |
disableCardSelectionBoolean | Whether to disable card selection functionality. Defaults to false. |
isRenderLastPurchaseCardBoolean | Whether to render cards used for last purchase. Defaults to true. |
isRenderLastPayoutCardBoolean | Whether to render cards used for last payout. Defaults to true. |
isCvcRequiredBoolean | Whether CVC input is required for card selection. Defaults to true. |
useTransparentCardBrandImageBoolean | Whether to use transparent background for card brand images. Defaults to true. |
isProcessNextStepOnCardClickBoolean | Whether to automatically process next step when card is clicked. Defaults to true. |
cvcComponentConfigCardCvcComponentConfig? | Configuration for the CVC input component. |
cardSubmitComponentConfigCardSubmitComponentConfig? | Configuration for the card submit component. |
notificationConfigNotificationConfig | Configuration for notifications display. Defaults to default configuration. |
cardBrandImagesCardBrandImages? | Custom card brand images configuration. |
filterByCardTokenFilter | Filter criteria for card tokens. Defaults to default filter. |
orderByCardTokenOrder | Sorting/ordering criteria for card tokens. Defaults to default order. |
limitTokensInt? | Maximum number of tokens to display (null = no limit). |
styleClickOnceStyle | Visual styling configuration for the component. Defaults to default style. |
onOnceCardClick(() -> Unit)? | Callback triggered when a card is clicked. |
onPreRenderTokens((List<CardToken>) -> List<CardTokenMapping>)? | Callback for custom token processing before rendering. |
data class ClickOnceComponentConfig(
val onValidationPassed: ((List<ValidationResult>) -> Unit)? = null,
val onValidationFailed: ((List<ValidationResult>) -> Unit)? = null,
val onTriggerFieldValidation: ((ValidationResult) -> Unit)? = null,
val onOnceCardClick: (() -> Unit)? = null,
val onPreRenderTokens: ((List<CardToken>) -> List<CardTokenMapping>)? = null
)| Callback | Description |
|---|---|
onValidationPassed: ((List<ValidationResult>) -> Unit)? | Event handler for when validation passes. Inherited from ComponentConfigImpl. |
onValidationFailed: ((List<ValidationResult>) -> Unit)? | Event handler for when validation fails. Inherited from ComponentConfigImpl. |
onTriggerFieldValidation: ((ValidationResult) -> Unit)? | Event handler for when field validation is triggered individually. Inherited from ComponentConfigImpl. |
onOnceCardClick: (() -> Unit)? | Event handler triggered when a card is clicked. |
onPreRenderTokens: ((List<CardToken>) -> List<CardTokenMapping>)? | Event handler for custom token processing before rendering. |
For more information about callbacks, see Events.
When using click-once with card submit, you can leverage the onCustomValidation callback via cardSubmitComponentConfig to implement custom business rule validation before payment submission. See Card submit for details.
import com.pxp.checkout.components.clickonce.ClickOnceComponent
import com.pxp.checkout.components.clickonce.ClickOnceComponentConfig
import com.pxp.checkout.components.cardcvc.CardCvcComponentConfig
import com.pxp.checkout.components.cardsubmit.CardSubmitComponentConfig
import com.pxp.checkout.models.CardTokenFilter
import com.pxp.checkout.models.CardTokenOrder
import com.pxp.checkout.styles.ClickOnceStyle
// Optional: Create custom CVC configuration
val cvcConfig = CardCvcComponentConfig(
label = "CVC",
placeholder = "123",
showMaskToggle = true
)
// Optional: Create custom submit configuration
val submitConfig = CardSubmitComponentConfig(
buttonText = "Pay Now",
loadingText = "Processing..."
)
// Optional: Create custom filtering and ordering
val tokenFilter = CardTokenFilter(
excludeExpired = true,
includeBrands = listOf(CardBrand.VISA, CardBrand.MASTERCARD)
)
val tokenOrder = CardTokenOrder(
sortByLastUsed = true,
sortByExpiryDate = false
)
// Optional: Create custom styling
val customStyle = ClickOnceStyle(
colors = ClickOnceColors(
primaryColor = Color.Blue,
surfaceColor = Color.White,
onSurfaceColor = Color.Black
),
textStyles = ClickOnceTextStyles(
cardNumberStyle = TextStyle(
fontSize = 16.sp,
fontWeight = FontWeight.SemiBold
)
)
)
val config = ClickOnceComponentConfig(
// Display text configuration
headerTitle = "Select Payment Method",
submitText = "Pay Now",
submitProcessingText = "Processing Payment...",
selectCardText = "Choose your card",
validThruText = "Valid Thru",
// Behaviour configuration
hideCardBrandLogo = false,
disableCardSelection = false,
isRenderLastPurchaseCard = true,
isRenderLastPayoutCard = true,
isCvcRequired = true,
useTransparentCardBrandImage = true,
isProcessNextStepOnCardClick = true,
// Component integrations
cvcComponentConfig = cvcConfig,
cardSubmitComponentConfig = submitConfig,
// Data management
filterBy = tokenFilter,
orderBy = tokenOrder,
limitTokens = 5,
// Styling
style = customStyle,
// Event handlers
onOnceCardClick = {
println("Card clicked for quick payment")
},
onPreRenderTokens = { tokens ->
// Custom processing of tokens before display
tokens.map { token ->
CardTokenMapping(
token = token,
displayLabel = "•••• ${token.lastFourDigits}"
)
}
}
)
val clickOnceComponent = checkout.createComponent<ClickOnceComponent, ClickOnceComponentConfig>(
type = ComponentType.CLICK_ONCE,
config = config
)