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.
Central interface for managing a checkout session. Create with rememberPrimerCheckoutController().

Creation

@Composable
fun rememberPrimerCheckoutController(
    clientToken: String,
    settings: PrimerSettings = PrimerSettings(),
): PrimerCheckoutController
ParameterTypeDefaultDescription
clientTokenStringRequiredShort-lived token from the Client Session API
settingsPrimerSettingsPrimerSettings()SDK configuration including payment handling mode

Interface

@Stable
interface PrimerCheckoutController {
    val state: StateFlow<PrimerCheckoutState>
    fun refresh()
    fun dismiss()
}

Property

PropertyTypeDescription
stateStateFlow<PrimerCheckoutState>Current checkout lifecycle state. Collect with collectAsStateWithLifecycle(). See PrimerCheckoutState.

Methods

MethodDescription
refresh()Reinitializes the checkout session. State transitions back to Loading while refetching configuration.
dismiss()Programmatically dismisses the checkout UI. Closes the bottom sheet or triggers cleanup for inline host.

Extension function

formatAmount

fun PrimerCheckoutController.formatAmount(amountInCents: Int): String
Formats an amount in minor units (cents) into a locale-aware currency string based on the current session (e.g., "$10.00", "10,00 EUR").
ParameterTypeDescription
amountInCentsIntAmount in minor currency units (e.g., 1000 for $10.00 USD)