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

# fetchVaultedPaymentMethods

Get a list of `PrimerVaultedPaymentMethod` for the `customerId` attached to the [client session](https://primer.io/docs/api-reference/v2.4/api-reference/client-session-api/create-a-client-session.md).
Build your own UI to display, manage and perform payments with them.

> [!WARNING]
>
> The list of vaulted payment methods is not affected by the checkout builder's conditions.
> For example, if you configured the checkout builder to not show `Paypal` with the current client session,
> but `Paypal` was vaulted previously, `fetchVaultedPaymentMethods` will still return it.
>
> **The mentioned issue will be addressed and resolved in an upcoming release,
> improving the overall functionality of the Vault Manager.**

```kotlin KOTLIN theme={"dark"}
suspend fun fetchVaultedPaymentMethods(): Result<List<PrimerVaultedPaymentMethod>>
```

## Returns

The `fetchVaultedPaymentMethods` method fetches the vaulted payment methods for the `customerId` attached to the [client session](https://primer.io/docs/api-reference/v2.4/api-reference/client-session-api/create-a-client-session.md)
and returns a result object of type [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/).

The Result class represents the outcome of the operation, indicating `success` or `failure`.

By inspecting the returned Result object, you can determine the success or failure of the fetching of the vaulted payment methods.
This allows you to handle different scenarios based on the result.

**Results**

**success**

In case of successful operation result, SDK will return:

**Return Type**

**List\<PrimerVaultedPaymentMethod>**

**PrimerVaultedPaymentMethod**

**id** `String`

A *temporary* identifier for the vaulted payment method. You should use this id with [deleteVaultedPaymentMethod](https://primer.io/docs/sdk/android/v2.x.x/primer-headless-checkout/vault-manager/deleteVaultedPaymentMethod.md),
[validate](https://primer.io/docs/sdk/android/v2.x.x/primer-headless-checkout/vault-manager/validate.md) and [startPaymentFlow](https://primer.io/docs/sdk/android/v2.x.x/primer-headless-checkout/vault-manager/startPaymentFlow.md).

ℹ️ This id changes with each call to [fetchVaultedPaymentMethods](https://primer.io/docs/sdk/android/v2.x.x/primer-headless-checkout/vault-manager/fetchVaultedPaymentMethods.md).

**analyticsId** `String` *required*

An identifier for the vaulted payment method that doesn't change across calls to [fetchVaultedPaymentMethods](https://primer.io/docs/sdk/android/v2.x.x/primer-headless-checkout/vault-manager/fetchVaultedPaymentMethods.md).

**paymentInstrumentType** `String` *required*

The type of the payment instrument associated to the vaulted payment method.

**paymentMethodType** `String` *required*

A unique string identifier for the payment method.

**paymentInstrumentData** `PaymentInstrumentData` *required*

Data associated to the payment instrument. You can use this information to display the vaulted payment method in your UI.

**Properties**

**network** `String?`

The human readable representation of card network (e.g., Visa, Mastercard).

**cardholderName** `String?`

The name of the cardholder.

**first6Digits** `Int?`

The first 6 digits of the card number.

**firstDigits** `Int?`

The first 6 or 8 digits of the card number within PCI guidelines.

**last4Digits** `Int?`

The last 4 digits of the card number.

**accountNumberLast4Digits** `Int?`

The last 4 digits of the account number.

**expirationMonth** `Int?`

The expiration month of the card, in 2-digit format.

**expirationYear** `Int?`

The expiration year of the card, in 4-digit format.

**externalPayerInfo** `ExternalPayerInfo?`

External information about the payer associated with the transaction.

**Properties**

**email** `String`

The payer's email address.

**externalPayerId** `String?`

The payer's unique ID.

**firstName** `String?`

The payer's given name.

**lastName** `String?`

The payer's given surname.

**klarnaCustomerToken** `String?`

**sessionData** `SessionData?`

**paymentMethodType** `String?`

A unique string identifier for the payment method. (e.g. `PAYPAL`,
`GOOGLE_PAY`)

**binData** `BinData?`

Additional BIN data.

**Properties**

**network** `String?`

The card network (e.g., VISA, MASTERCARD, AMEX).

**bankName** `String?`

The name of the bank.

**threeDSecureAuthentication** `Nullable\<ThreeDSAuthenticationData\>`

**failure**

In case of unsuccessful operation result, as part of `Result` object SDK will return:

**Exceptions**

**VaultManagerFetchException**

If an error occurs while fetching vaulted payment methods.

**IOException**

if an I/O error occurs during the API request.

## Example

```kotlin KOTLIN theme={"dark"}
// 👇  initialize PrimerHeadlessUniversalCheckoutVaultManager after SDK was successfully initialized
val vaultManager = PrimerHeadlessUniversalCheckoutVaultManager.newInstance()

private fun fetchVaultedPaymentMethods() {
    // 👇 fetch vaulted payment methods by calling suspend function within the scope
    scope.launch {
        vaultManager.fetchVaultedPaymentMethods().onSuccess { vaultedPaymentMethods ->
            // display vaulted payment methods to the user
        }.onFailure { throwable ->
            // handle error
        }
    }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.