Perform a validation process on the provided additionalData for a given vaultedPaymentMethodId.

TYPESCRIPT
    async validate(vaultedPaymentMethodId: string, additionalData: VaultedPaymentMethodAdditionalData): Promise<ValidationError[]>

Parameters

Returns

The validate method performs validation operation for the given vaultedPaymentMethodId and additionalData. Returns a Promise of ValidationError[].

In case of successful operation, this method will return:


If the returned list is empty after performing a validation process, it indicates that the data has passed the validation successfully. On the other hand, if the validation process encounters any issues or errors, the result object will contain a list of ValidationError objects. These objects represent specific validation errors or issues associated with the payment method data.

Example

The VaultManager needs to be configured before validate can be called. Refer to the following example for configuring the VaultManager.

TYPESCRIPT
async function validateAdditonalData() {
  try {
    //Ensure the Vault Manager has been configured
    const validationErrors = await vaultManager.validate(
      "yourVaultedPaymentMethodId",
      yourAdditionalData
    );
  } catch (error) {
    console.error("Error validating additonal data:", error);
  }
}