> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Payment outcomes

> Success and failure outcomes, delivered as terminal states of PrimerCheckoutState

<Warning>
  Primer Checkout Android SDK is currently in **beta** (v3.0.0-beta.4).
  The API is subject to change before the stable release.
</Warning>

Payment outcomes are terminal states of [`PrimerCheckoutState`](/docs/sdk/android-checkout/v3.0.0-beta/api/primer-checkout-state), observed via `PrimerCheckoutController.state`. There is no separate event callback.

<Note>
  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`.
</Note>

## Outcomes

```kotlin theme={"dark"}
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.

| Property       | Type                 | Description                                       |
| -------------- | -------------------- | ------------------------------------------------- |
| `checkoutData` | `PrimerCheckoutData` | Payment result containing payment ID and order ID |

### Failure

Reached when a payment fails or an error occurs.

| Property | Type                                                                       | Description                                                         |
| -------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `error`  | [`PrimerError`](/docs/sdk/android-checkout/v3.0.0-beta/api/common/primer-error) | Error details including description, error code, and diagnostics ID |

## Reacting to outcomes

```kotlin theme={"dark"}
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`](/docs/sdk/android-checkout/v3.0.0-beta/api/primer-checkout-sheet) render the in-sheet result screens; observe `state` when you need to react programmatically (navigate, log, clear the cart).

## PrimerCheckoutData

```kotlin theme={"dark"}
data class PrimerCheckoutData(
    val payment: Payment,
)
```

### Payment

```kotlin theme={"dark"}
data class Payment(
    val id: String,
    val orderId: String,
)
```

| Property  | Type     | Description                                  |
| --------- | -------- | -------------------------------------------- |
| `id`      | `String` | Unique payment identifier assigned by Primer |
| `orderId` | `String` | Order identifier from the client session     |
