validate

Validates a UPI Virtual Payment Address (VPA).

Input normalisation applied before validation (in order):

  1. Trim leading/trailing whitespace

  2. Lowercase all characters (NPCI canonical form)

Note: Internal whitespace is NOT stripped — VPAs never contain internal spaces, and a space inside a VPA is a format violation.

After normalisation, checks are applied in order — first failing check wins:

PSP allowlist not enforced. "user@anypsp" is structurally valid. NPCI adds PSPs regularly; a closed list would produce false negatives.

Return

ValidationResult.Valid if the VPA is structurally valid, ValidationResult.Invalid with an appropriate InvalidReason otherwise.

Parameters

value

Raw VPA string in any common input form.

Samples

check(VPA.validate("user@okaxis") == ValidationResult.Valid)