Handling Payment Page Errors

This page describes the possible errors you may receive after submitting the HostedForm.createSession( )/HostedForm.updateSession( ) request. The 'status' field will contain an overall indication of success or failure of the request. It is strongly recommended that this field is checked first as this indicates whether individual fields contain errors or if a more general error has occurred.

If the overall response field indicates there are field errors, then you should check each response field for errors.

Overall Form Response

The overall form response will be returned in the 'status' field.

It will contain one of the following values:

Value Description Responsive Action
ok Indicates the form is valid — returned when no form errors are found indicating that the card details have been collected successfully and are available for use in a transaction. No error handling required — proceed to performing a transaction.
fields_in_error Indicates one or more fields are in error — returned if any form field fails validation. The fields in error will contain the specific error code. See Field Errors section below for details. Parse individual fields for specific errors. See below for more details.
system_error Indicates system error — returned if a payment gateway error or other irrecoverable failure occurs. Irrecoverable — contact Commonwealth Bank of Australia to have issue rectified.
request_timeout Indicates that time out occured when creating the session. Redisplay the payment page to the payer to supply card details and create a new session.

Field Errors

Field errors will only be present if the 'status' field contains the value 'fields_in_error'.

The value returned for an erroneous field will have the following format:

{"field_name":"error_code", ...},

for example,

{cardNumber:"invalid", cardExpiryYear:"missing"}

Where error_code will be one of the following values:

Value Description Responsive action
invalid Indicates field value invalid — returned when the field value is considered invalid as per Hosted Payment Session field validation rules. Redisplay the payment page with an error against the erroneous field to allow the payer to rectify and resubmit.
missing Indicates mandatory field not present — returned when the field value is blank/empty. Applies only to cardExpiryMonth and cardExpiryYear fields. Redisplay the payment page with an error against the erroneous field to allow the payer to rectify and resubmit.

Copyright © 2023 Commonwealth Bank of Australia