rememberVgsCardNumberTextFieldState

fun rememberVgsCardNumberTextFieldState(collect: VGSCollect, fieldName: String, validators: List<VgsTextFieldValidator>? = null, isCardBrandValidationEnabled: Boolean = true, supportedCardBrands: List<VgsCardBrand> = VgsCardBrand.DEFAULT, tokenizationConfig: VgsCardNumberTokenizationConfig? = null): MutableState<VgsCardNumberTextFieldState>

Creates and remembers a VgsCardNumberTextFieldState for use with a VgsCardNumberTextField. This is the only way to obtain an instance — direct construction is reserved for the SDK.

Use it inside a composable like any other Compose remember* factory:

var state by rememberVgsCardNumberTextFieldState(
collect = vgsCollect,
fieldName = "data.card_number",
)

Parameters

collect

the VGSCollect instance the field is bound to. The field participates in this instance's submit and analytics pipeline.

fieldName

JSON key the value will be sent under by VGSCollect.asyncSubmit.

validators

custom validators to apply. If null, the SDK applies default brand-aware validation. Pass emptyList() to disable validation.

isCardBrandValidationEnabled

when true, the field's required length/CVC rules adapt to the detected card brand (e.g. 15 digits for Amex).

supportedCardBrands

which brands the field will accept and detect. Defaults to VgsCardBrand.DEFAULT.

tokenizationConfig

optional config; when set, the value is tokenized on submit and the token is sent in place of the raw number.