Perform a validation process on the provided additional payment method data for a given vaultedPaymentMethodId.

12345
func validate(    vaultedPaymentMethodId: String,    vaultedPaymentMethodAdditionalData: PrimerVaultedPaymentMethodAdditionalData,    completion: @escaping (_ errors: [Error]?) -> Void)
swift
copy

Parameters

The id of a PrimerHeadlessUniversalCheckout.VaultedPaymentMethod previously retrieved with fetchVaultedPaymentMethods.

vaultedPaymentMethodAdditionalData
PrimerVaultedPaymentMethodAdditionalDataRequired
direct subclasses
Properties
cvv
StringRequired
CVV value associated with the vaulted card.

Returns

The validate method performs validation operation for the given vaultedPaymentMethodId and vaultedPaymentMethodAdditionalData. The completion handler will either return an array of errors, or nil if validation is successful.

The errors returned can be cast to PrimerError or PrimerValidationError.

Completion will be called when the validation has been completed and the result is available.
errors
Array<Error>
An error that will be thrown in case the you provide a vaulted payment method that doesn't exist.
invalidCvv
PrimerValidationError
An error that will be thrown in case the CVV/CVC is not valid.

Example

123456789101112131415161718192021222324252627282930
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 {      // Handler the error    }  }
  func validateCVV(_ cvv: String, forVaultedPaymentMethodWithId id: String) {    let vaultedCardAdditionalData = PrimerVaultedCardAdditionalData(cvv: cvv)    // 👇 Call validate    self.vaultManager.validate(vaultedPaymentMethodId: id, vaultedPaymentMethodAdditionalData: vaultedCardAdditionalData, completion: { errors in      if let errors = errors {        // Handle validation errors      }    })  }}
swift
copy