Form Validation

🚧

Hosted Payments Page form validation errors are propagated to the parent frame (merchant website) via fz.form_validation.error event.

EventDescriptionApplicable Methods
fz.form_validation.errorHosted Payments Form validation errorsrenderPaymentsPage

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

FieldRuleError Code
payment_request_card_holderrequiredhpp_10101
payment_request_card_holdermax length
* 50 characters
hpp_10102
payment_request_card_holderpattern
* alphanumeric only
hpp_10103
payment_request_card_numberrequiredhpp_10201
payment_request_card_numbermin length
* 13 characters
hpp_10202
payment_request_card_numbermax length
* 19 characters
hpp_10203
payment_request_card_numberpattern
* valid credit card number pattern
hpp_10204
payment_request_card_numbersupported card types
* applicable only when options.cards is provided.

See HppSetupParams for details
hpp_10205
payment_request_security_coderequiredhpp_10301
payment_request_security_codemin length
* 3 characters
hpp_10302
payment_request_security_codemax length
4 characters for AMEX & JCB
3 characters for everything else.
hpp_10303
payment_request_security_codepattern
* numeric only
hpp_10304
payment_request_expiry_daterequiredhpp_10401
payment_request_expiry_datevalid expiry date
* greater than today
hpp_10402
payment_request_emailrequired
* applicable only when options.showEmail is provided.

See HppSetupParams for details
hpp_10501
payment_request_emailpattern
* valid email format
hpp_10502
payment_request_emailmax length
* 100 characters
hpp_10503