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.

SWIFT
public func deleteVaultedPaymentMethod(id: String, completion: @escaping (_ error: Error?) -> Void)

Parameters

Returns

The deleteVaultedPaymentMethod method performs the deletion operation and returns an error in case of failure, or nil in case of success.

Example

SWIFT

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 {
      // 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
      }
    })
  }
}