Form Validation
Hosted Payments Page form validation errors are propagated to the parent frame (merchant website) via fz.form_validation.error event.
Event | Description | Applicable Methods |
---|---|---|
fz.form_validation.error | Hosted Payments Form validation errors | renderPaymentsPage |
fz.form_validation.error Data Payload
Example
{
"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 * 50 characters | hpp_10102 |
payment_request_card_holder | pattern * alphanumeric only | hpp_10103 |
payment_request_card_number | required | hpp_10201 |
payment_request_card_number | min length * 13 characters | hpp_10202 |
payment_request_card_number | max length * 19 characters | hpp_10203 |
payment_request_card_number | pattern * valid credit card number pattern | hpp_10204 |
payment_request_card_number | supported card types * applicable only when options.cards is provided.See HppSetupParams for details | hpp_10205 |
payment_request_security_code | required | hpp_10301 |
payment_request_security_code | min length * 3 characters | hpp_10302 |
payment_request_security_code | max length 4 characters for AMEX & JCB 3 characters for everything else. | hpp_10303 |
payment_request_security_code | pattern * numeric only | hpp_10304 |
payment_request_expiry_date | required | hpp_10401 |
payment_request_expiry_date | valid expiry date * greater than today | hpp_10402 |
payment_request_email | required * applicable only when options.showEmail is provided.See HppSetupParams for details | hpp_10501 |
payment_request_email | pattern * valid email format | hpp_10502 |
payment_request_email | max length * 100 characters | hpp_10503 |
Updated over 3 years ago