Skip to main content
Primer Checkout Android SDK is currently in beta (v3.0.0-beta.3). The API is subject to change before the stable release.
Payment outcomes are terminal states of PrimerCheckoutState, observed via PrimerCheckoutController.state. There is no separate event callback.
Earlier previews delivered outcomes through a PrimerCheckoutEvent type and an onEvent lambda on PrimerCheckoutSheet / PrimerCheckoutHost. Both were removed — Success and Failure are now cases of PrimerCheckoutState.

Outcomes

sealed interface PrimerCheckoutState {
    // ...
    data class Success(val checkoutData: PrimerCheckoutData) : PrimerCheckoutState
    data class Failure(val error: PrimerError) : PrimerCheckoutState
}

Success

Reached when payment completes successfully. Only emitted in AUTO payment handling mode.
PropertyTypeDescription
checkoutDataPrimerCheckoutDataPayment result containing payment ID and order ID

Failure

Reached when a payment fails or an error occurs.
PropertyTypeDescription
errorPrimerErrorError details including description, error code, and diagnostics ID

Reacting to outcomes

val checkout = rememberPrimerCheckoutController(clientToken, settings)
val state by checkout.state.collectAsStateWithLifecycle()

LaunchedEffect(state) {
    when (val s = state) {
        is PrimerCheckoutState.Success -> navigateToConfirmation(s.checkoutData)
        is PrimerCheckoutState.Failure -> logError(s.error)
        else -> Unit
    }
}

PrimerCheckoutSheet(checkout = checkout)
The built-in success / error slots on PrimerCheckoutSheet render the in-sheet result screens; observe state when you need to react programmatically (navigate, log, clear the cart).

PrimerCheckoutData

data class PrimerCheckoutData(
    val payment: Payment,
)

Payment

data class Payment(
    val id: String,
    val orderId: String,
)
PropertyTypeDescription
idStringUnique payment identifier assigned by Primer
orderIdStringOrder identifier from the client session