Developer Docs
Form Validation (V2)
Hosted Payments Page form validation errors are propagated to the parent frame (merchant website) via fz.form_validation.error event. This is distinct from the
fz.validation.error, which is used to indicate errors to do with calls to functions such asrenderPaymentsPage
| Event | Description | Applicable Methods |
|---|---|---|
fz.form_validation.error |
Hosted Payments Form validation errors | renderPaymentsPage |
fz.form_validation.error Data Payload
Example
json
{
"message": "Form was not valid",
"errors": [
"Expiry Date is required",
"Security Code (CVV) is required"
],
"data": {
"payment_request_expiry_date": [
{
"errorCode": "hpp_10401",
"message": "Expiry Date is required"
}
],
"payment_request_security_code": [
{
"errorCode": "hpp_10301",
"message": "Security Code (CVV) is required"
}
]
}
}- errors contains an array of messages associated with the form validation errors.
- data provides details around the affected fields and the associated errors, along with error codes. Developers can take advantage of the error code in order to customise the user experience.
Validation Rules
| Field | Rule | Error Code |
|---|---|---|
| payment_request_card_holder | required | hpp_10101 |
| payment_request_card_holder |
max length
|
hpp_10102 |
| payment_request_card_holder |
pattern
|
hpp_10103 |
| payment_request_card_number | required | hpp_10201 |
| payment_request_card_number |
min length
|
hpp_10202 |
| payment_request_card_number |
max length
|
hpp_10203 |
| payment_request_card_number |
pattern
|
hpp_10204 |
| payment_request_card_number |
supported card types
|
hpp_10205 |
| payment_request_security_code | required | hpp_10301 |
| payment_request_security_code |
min length
|
hpp_10302 |
| payment_request_security_code |
max length
|
hpp_10303 |
| payment_request_security_code |
pattern
|
hpp_10304 |
| payment_request_expiry_date | required | hpp_10401 |
| payment_request_expiry_date |
valid expiry date
|
hpp_10402 |
| payment_request_email |
required
|
hpp_10501 |
| payment_request_email |
pattern
|
hpp_10502 |
| payment_request_email |
max length
|
hpp_10503 |