PrimerHeadlessUniversalCheckout.VaultedPaymentMethod 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.The mentioned issue will be addressed and resolved in an upcoming release,
improving the overall functionality of the Vault Manager.SWIFT
Copy
Ask AI
func fetchVaultedPaymentMethods(
completion: @escaping (_ vaultedPaymentMethods: [PrimerHeadlessUniversalCheckout.VaultedPaymentMethod]?, _ error: Error?) -> Void
)
Returns
ThefetchVaultedPaymentMethods method fetches the vaulted payment methods for the customerId attached to the client session
and returns an array of PrimerHeadlessUniversalCheckout.VaultedPaymentMethod in case of success, or an error in case of failure.
Hide Return Values
Hide Return Values
completion
Completion will be called when the operation has been completed and the result is available.
Hide Parameters
Hide Parameters
Hide PrimerHeadlessUniversalCheckout.VaultedPaymentMethod
Hide PrimerHeadlessUniversalCheckout.VaultedPaymentMethod
A temporary identifier for the
PrimerHeadlessUniversalCheckout.VaultedPaymentMethod previously retrieved
with fetchVaultedPaymentMethods.You can use id to deleteVaultedPaymentMethod,
validate its additional data, or start a payment flow.ℹ️ 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.
A unique string identifier for the vaulted payment method.
Data associated to the payment instrument. You can use this information to display the vaulted payment method in your UI.
Hide Parameters
Hide Parameters
Example
SWIFT
Copy
Ask AI
import UIKit
import PrimerSDK
class MerchantHeadlesVaultManagerViewController: UIViewController {
var vaultManager = PrimerHeadlessUniversalCheckout.VaultManager()
override func viewDidLoad() {
super.viewDidLoad()
do {
// Before you configure your vault manager you must have started
// PrimerHeadlessUniversalCheckout with a client token.
try self.vaultManager.configure()
} catch {
// Handler the error
}
}
func fetchVaultedPaymentMethods() {
// 👇 Call fetchVaultedPaymentMethods
self.vaultManager.fetchVaultedPaymentMethods { vaultedPaymentMethods, err in
if let err = err {
// Handle the error
} else if let vaultedPaymentMethods = vaultedPaymentMethods {
// Populate your UI with the vaulted payment methods
}
}
}
}