This async method allows you to delete a vaulted payment method by providing its ID as an argument for the customerId
attached to the client session.
1
public func deleteVaultedPaymentMethod(id: String, completion: @escaping (_ error: Error?) -> Void)
swift
copy
Parameters
Properties
vaultedPaymentMethodId
StringRequiredThe id
of a PrimerHeadlessUniversalCheckout.VaultedPaymentMethod
previously retrieved with fetchVaultedPaymentMethods.
Returns
The deleteVaultedPaymentMethod
method performs the deletion operation and returns an error in case of failure, or nil in case of success.
Completion will be called when the deletion has been completed.
error
ErrorinvalidVaultedPaymentMethodId
PrimerErrorExample
1234567891011121314151617181920212223242526272829303132
import UIKitimport 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 { // Handle the error } } func deleteVaultedPaymentMethod(with id: String) { // 👇 Call deleteVaultedPaymentMethod and pass one of the vaulted payment methods' // id (retrieved with fetchVaultedPaymentMethods) self.vaultManager.deleteVaultedPaymentMethod(id: id, completion: { error in if let error = error { // Handle the error } else { // Vaulted payment method was deleted successfully } }) }}
swift
copy