> ## 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.

# PrimerVaultedPaymentMethodsController

> Controller interface for managing saved (vaulted) payment methods

<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>

Controller interface for saved payment methods. Exposes vaulted methods as observable state and provides selection, deletion, and management.

## Creation

```kotlin theme={"dark"}
@Composable
fun rememberVaultedPaymentMethodsController(
    checkout: PrimerCheckoutController,
): PrimerVaultedPaymentMethodsController
```

| Parameter  | Type                       | Description                                                   |
| ---------- | -------------------------- | ------------------------------------------------------------- |
| `checkout` | `PrimerCheckoutController` | Checkout controller from `rememberPrimerCheckoutController()` |

<Note>
  Must be called inside `PrimerCheckoutHost` content or a `PrimerCheckoutSheet` slot.
</Note>

## Property

| Property  | Type                                          | Description                                                                                        |
| --------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `methods` | `StateFlow<List<PrimerVaultedPaymentMethod>>` | Saved payment methods for the current customer. Empty list while loading or when no methods exist. |

<Info>
  The parent `checkout.state` provides loading/ready state. Use `checkout.state` to distinguish between "loading" and "no saved methods."
</Info>

## Methods

| Method                                       | Description                                                                                   |
| -------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `select(method: PrimerVaultedPaymentMethod)` | Pay with a saved method. Automatically shows CVV recapture if required by the payment method. |
| `delete(method: PrimerVaultedPaymentMethod)` | Delete a saved method. Shows a confirmation dialog before deletion.                           |
| `showAll()`                                  | Open the full vaulted methods management screen.                                              |

## PrimerVaultedPaymentMethod

```kotlin theme={"dark"}
data class PrimerVaultedPaymentMethod(
    val id: String,
    val analyticsId: String,
    val paymentInstrumentType: String,
    val paymentMethodType: String,
    val paymentInstrumentData: PaymentInstrumentData,
    val threeDSecureAuthentication: AuthenticationDetails?,
)
```

| Property                     | Type                     | Description                               |
| ---------------------------- | ------------------------ | ----------------------------------------- |
| `id`                         | `String`                 | Unique identifier for this vaulted method |
| `analyticsId`                | `String`                 | Analytics tracking identifier             |
| `paymentInstrumentType`      | `String`                 | Instrument type (e.g., `"PAYMENT_CARD"`)  |
| `paymentMethodType`          | `String`                 | Payment method type identifier            |
| `paymentInstrumentData`      | `PaymentInstrumentData`  | Card or payment method details            |
| `threeDSecureAuthentication` | `AuthenticationDetails?` | 3DS authentication data, if available     |

### PaymentInstrumentData

| Property            | Type                 | Description                                   |
| ------------------- | -------------------- | --------------------------------------------- |
| `network`           | `String?`            | Card network (e.g., `"Visa"`, `"Mastercard"`) |
| `cardholderName`    | `String?`            | Cardholder name                               |
| `first6Digits`      | `String?`            | First 6 digits (BIN)                          |
| `last4Digits`       | `String?`            | Last 4 digits for display                     |
| `expirationMonth`   | `String?`            | Expiry month (MM)                             |
| `expirationYear`    | `String?`            | Expiry year (YYYY)                            |
| `externalPayerInfo` | `ExternalPayerInfo?` | External payer details (e.g., PayPal email)   |
| `binData`           | `BinData?`           | BIN data for card routing                     |
| `bankName`          | `String?`            | Bank name for bank-based methods              |

## Composable

```kotlin theme={"dark"}
@Composable
fun PrimerVaultedPaymentMethods(
    controller: PrimerVaultedPaymentMethodsController,
    modifier: Modifier = Modifier,
    header: @Composable (onShowAll: () -> Unit) -> Unit = { onShowAll ->
        VaultedPaymentMethodsDefaults.SectionHeader(onShowAll)
    },
    item: @Composable (method: PrimerVaultedPaymentMethod, isSelected: Boolean, onSelect: () -> Unit) -> Unit = { method, isSelected, onSelect ->
        VaultedPaymentMethodsDefaults.Method(method, isSelected, onSelect)
    },
    submitButton: @Composable (isLoading: Boolean, enabled: Boolean, onSubmit: () -> Unit) -> Unit = { isLoading, enabled, onSubmit ->
        VaultedPaymentMethodsDefaults.SubmitButton(isLoading, enabled, onSubmit)
    },
)
```

| Parameter      | Type                                                                    | Default                    | Description                                                                                    |
| -------------- | ----------------------------------------------------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------- |
| `controller`   | `PrimerVaultedPaymentMethodsController`                                 | —                          | Controller from `rememberVaultedPaymentMethodsController()`                                    |
| `modifier`     | `Modifier`                                                              | `Modifier`                 | Compose modifier                                                                               |
| `header`       | `@Composable (onShowAll: () -> Unit) -> Unit`                           | `SectionHeader(onShowAll)` | Header composable above the list. Receives callback to show all saved methods.                 |
| `item`         | `@Composable (PrimerVaultedPaymentMethod, Boolean, () -> Unit) -> Unit` | `Method(...)`              | Composable for each vaulted method row. Receives method, selection state, and select callback. |
| `submitButton` | `@Composable (Boolean, Boolean, () -> Unit) -> Unit`                    | `SubmitButton(...)`        | Submit button below the list. Receives loading state, enabled state, and submit callback.      |

### VaultedPaymentMethodsDefaults

| Function                                                                                | Description                                                             |
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| `SectionHeader(onShowAll: () -> Unit)`                                                  | Default section header ("Saved payment methods") with "Show all" action |
| `Method(method: PrimerVaultedPaymentMethod, isSelected: Boolean, onSelect: () -> Unit)` | Default method row with card details, network icon, and selection       |
| `SubmitButton(isLoading: Boolean, enabled: Boolean, onSubmit: () -> Unit)`              | Default submit button for vaulted payment                               |
