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.
Represents a country in the billing address form. Used by PrimerCardFormController for country selection.

Definition

data class PrimerCountry(
    val name: String,
    val code: CountryCode,
)

Properties

PropertyTypeDescription
nameStringHuman-readable country name (e.g., "United States", "Germany")
codeCountryCodeISO 3166-1 alpha-2 country code enum (249 values)

CountryCode

ISO 3166-1 alpha-2 enum with 249 country codes. Examples:
ValueCountry
CountryCode.USUnited States
CountryCode.GBUnited Kingdom
CountryCode.DEGermany
CountryCode.FRFrance
CountryCode.JPJapan
CountryCode.AUAustralia

Country selection controller

The card form provides a dedicated controller for country selection with search:
@Composable
fun rememberCountrySelectionController(): PrimerCountrySelectionController

PrimerCountrySelectionController

Property / MethodTypeDescription
stateStateFlow<State>Current state of the country picker
onCountrySelected(countryCode, countryName)(String, String) -> UnitSelect a country by ISO code and name
onSearch(query)(String) -> UnitFilter the country list by search query

State

PropertyTypeDescription
countriesList<PrimerCountry>All available countries
filteredCountriesList<PrimerCountry>Countries matching the current search query
searchQueryStringCurrent search query
isLoadingBooleantrue while the country list is loading

Card form integration

Country selection is part of the card form billing address flow:
val cardFormController = rememberCardFormController(checkout)
val state by cardFormController.state.collectAsStateWithLifecycle()

val selectedCountry: PrimerCountry? = state.selectedCountry

cardFormController.requestCountrySelection()
Calling requestCountrySelection() opens the country picker. The selected country appears in state.selectedCountry. See PrimerCardFormController for full card form API.