validateFields()

The validateFields() method is used to verify whether the form fields under the currently selected payment method are complete and properly formatted. This method automatically identifies and validates the required parameters based on the selected payment method, eliminating the need for developers to manually maintain the parameter list.

Even if validateFields() is not explicitly called, when executing submitPayment(), the component will automatically display the corresponding error messages if any form issues are detected. The purpose of providing the validateFields() method is to allow developers to perform custom validation processes or business logic before submission.

Method signature

When calling this method, please use the following standard method signature format.

copy
validateFields()

Parameters

This method takes no input parameters. The validateFields() method automatically validates all required parameters based on the selected payment method.

Return values

Returns a Promise object that resolves to an object containing the validation results.

ParameterData type

Description

isValidBoolean

Indicates whether all parameters pass validation. Valid values are:

  • true: Validation passed.
  • false: Errors exist.