Skip to main content
Primer Checkout Android SDK is currently in beta (v3.0.0-beta.2). The API is subject to change before the stable release.
Each CardFormDefaults field component handles its own formatting, validation, keyboard configuration, and error display. All fields accept controller: PrimerCardFormController and modifier: Modifier = Modifier.

Card detail fields

CardNumberField

AspectDetail
Auto-formattingGroups digits with spaces (e.g., 4242 4242 4242 4242)
Max length16-19 digits depending on detected network
Keyboard typeKeyboardType.Number
ValidationLuhn algorithm check, minimum length per network
Validation timingOn blur (when user taps another field)
Trailing iconDetected card network logo(s) (Visa, Mastercard, Amex, etc.)
Network detectionLocal detection begins after the 1st digit; remote detection begins after the 8th digit
Supported networks: Visa, Mastercard, Amex, Diners Club, Discover, JCB, UnionPay, Maestro, Elo, Mir, Hiper, Hipercard, Cartes Bancaires, Dankort, Eftpos, Other.

ExpiryField

AspectDetail
Auto-formattingInserts / automatically (typing 122512/25)
Max length5 characters (MM/YY)
KeyboardKeyboardType.Number
ValidationValid month (01–12), future date

CvvField

AspectDetail
Max length4 digits for Amex, 3 for other networks
KeyboardKeyboardType.Number
VisualPassword masking (dots)
DynamicMax length updates when card network is detected

CardholderField

AspectDetail
KeyboardKeyboardType.Text with KeyboardCapitalization.Words
ValidationRequired (non-empty) when session requires cardholder name
VisibilityOnly rendered when CARDHOLDER_NAME is in state.cardFields

CardNetworkField

AspectDetail
VisibilityOnly rendered when card has multiple networks (co-badged)
InteractionTapping a chip calls controller.selectCardNetwork(network)
No modifier parameterUnlike other fields

Billing address fields

All billing fields are rendered only when required by session configuration.
FieldKeyboardValidationNotes
CountryCodeFieldRequiredRead-only; opens picker via requestCountrySelection()
FirstNameFieldText + Words capitalizationRequired
LastNameFieldText + Words capitalizationRequired
AddressLine1FieldTextRequired
AddressLine2FieldTextOptional
CityFieldTextRequired
StateFieldTextRequiredLabel adapts to selected country
PostalCodeFieldTextRequired, format varies by countryLabel adapts to selected country

Validation behavior

  1. While typing — no error messages shown. isFormValid updates in real-time.
  2. On blur — field is validated and any error is added to state.fieldErrors.
  3. Error display — inline error text below the field using theme error color.
  4. Error clearing — errors clear when corrected and re-validated on next blur.