Get a list of PrimerVaultedPaymentMethod
for the customerId
attached to the client session.
Build your own UI to display, manage and perform payments with them.
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.
1
suspend fun fetchVaultedPaymentMethods(): Result<List<PrimerVaultedPaymentMethod>>
Returns
The fetchVaultedPaymentMethods
method fetches the vaulted payment methods for the customerId
attached to the client session
and returns a result object of type 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.
In case of successful operation result, SDK will return:
PrimerVaultedPaymentMethod
A temporary identifier for the vaulted payment method. You should use this id with deleteVaultedPaymentMethod, validate and startPaymentFlow.
ℹ️ This id changes with each call to fetchVaultedPaymentMethods.
An identifier for the vaulted payment method that doesn't change across calls to fetchVaultedPaymentMethods.
The type of the payment instrument associated to the vaulted payment method.
Data associated to the payment instrument. You can use this information to display the vaulted payment method in your UI.
Properties
Properties
Properties
In case of unsuccessful operation result, as part of Result
object SDK will return:
If an error occurs while fetching vaulted payment methods.
if an I/O error occurs during the API request.
Example
12345678910111213
// 👇 initialize PrimerHeadlessUniversalCheckoutVaultManager after SDK was successfully initializedval 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 } }}