Documentation Index Fetch the complete documentation index at: https://primer.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
Perform a validation process on the provided additional payment method data for a given vaultedPaymentMethodId.
func validate (
vaultedPaymentMethodId : String ,
vaultedPaymentMethodAdditionalData : PrimerVaultedPaymentMethodAdditionalData,
completion : @escaping (_ errors: [ Error ]?) -> Void
)
Parameters
vaultedPaymentMethodAdditionalData
PrimerVaultedPaymentMethodAdditionalData
required
PrimerVaultedCardAdditionalData
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.
invalidVaultedPaymentMethodId
An error that will be thrown in case the you provide a vaulted payment method that doesn’t exist.
An error that will be thrown in case the CVV/CVC is not valid.
Example
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 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
}
})
}
}