Managing errors (JS client)

This page describes the processing of integration errors.

If you would like to customize how you handle errors that occur when a transaction is rejected, see the following article:

KR.onError()

Managing errors manually

For embedded form, errors are automatically displayed in the kr-form-error div:

    <!-- error zone -->
    <div class="kr-form-error"></div>
    <!-- error zone -->
    <div class="kr-form-error"></div>

To handle errors manually:

  <script type="text/javascript">
    $(document).ready(function() {
          KR.onError( function(event) {
            var code = event.errorCode;
            var message = event.errorMessage;
            var myMessage = code + ": " + message;

            $("#customerror").html(myMessage);
          });
    });
  </script>

JS error codes

The REST API has different error codes described here: REST API error codes.

The error codes that start with CLIENT_ correspond to errors occurring in the buyer''s browser. They occur before the payment data is sent to our servers. This concerns, for example, local form data validation errors or JavaScript client integration errors.

CODE DEFINITION
CLIENT_004 Invalid public key
CLIENT_100 Invalid formToken
CLIENT_101 Aborted
CLIENT_300 Invalid form data
CLIENT_301 Invalid card number
CLIENT_302 Invalid expiry date
CLIENT_303 Invalid security code
CLIENT_304 value is required
CLIENT_500 No form or button defined
CLIENT_501 Kr-public-key is empty or not defined
CLIENT_502 Form already submitted (browser back button not supported)
CLIENT_997 Endpoint configuration mismatch
CLIENT_998 Demo form, see the documentation
CLIENT_999 Technical error

Warning codes

The error codes comprised between CLIENT_700 and CLIENT_799 are warning messages. They are there to guide you when integrating the JavaScript client:

CODE DEFINITION
CLIENT_704 you need to load Font Awesome in your <head>

Error code details

CLIENT_004

Code CLIENT_004
Definition Invalid public key
Category Errors

The public key defined in kr-public-key is not valid, it must have the following format: [NUMBER]:[STRING]

For example: 69876357:testpublickey_DEMOPUBLICKEY95me92597fd28tGD4r5

For more information, go to: Retrieving my keys.

CLIENT_100

Code CLIENT_100
Definition Invalid formToken
Category Errors

The formToken that you have defined in kr-form-token is invalid. For more information on creating a formToken, go to: integration guide.

CLIENT_101

Code CLIENT_101
Definition Aborted
Category Errors

Transaction abandoned by the buyer. This error occurs, for example, when the buyer closes the 3D-Secure pop-in before authenticating him/herself.

If the buyer does not make another attempt, a rejected transaction is automatically created when the formToken expires.

CLIENT_300

Code CLIENT_300
Definition Invalid form data
Category Errors

When several form fields are invalid, a general error CLIENT_300 is returned. A detailed list of all detected errors will be included in the children field:

{
    "errorCode": "CLIENT_300",
    "errorMessage": "Invalid form data",
    "children": [{
        "errorCode": "CLIENT_301",
        "errorMessage": "Invalid card number",
        "field": "pan",
        (...)
    }, {
        "errorCode": "CLIENT_302",
        "errorMessage": "Invalid expiry date",
        "field": "expiryDate",
        (...)
    }, {
        "errorCode": "CLIENT_303",
        "errorMessage": "Invalid security code",
        "field": "securityCode",
        (...)
    }],
    "detailedErrorCode": null,
    "detailedErrorMessage": null,
    (...)
}

CLIENT_301

Code CLIENT_301
Definition Invalid card number
Category Errors

The kr-pan field (card number) of the payment form is invalid.

CLIENT_302

Code CLIENT_302
Definition Invalid expiry date
Category Errors

The kr-expiry field (expiry date) of the payment form is invalid.

CLIENT_303

Code CLIENT_303
Definition Invalid security code
Category Errors

The kr-security-code field (security number or CVV) of the payment form is invalid.

CLIENT_304

Code CLIENT_304
Definition value is required
Category Errors

An additional field declared as mandatory is empty. For more information, go to: Custom form fields.

CLIENT_500

Code CLIENT_500
Definition No form or button defined
Category Errors

No payment form buttons have been found in the HTML code. Check if the required tags are present, or if there are no syntax errors.

CLIENT_501

Code CLIENT_501
Definition Kr-public-key is empty or not defined
Category Errors

The public key is not defined in kr-public-key.

CLIENT_502

Code CLIENT_502
Definition Form already submitted (browser back button not supported)
Category Errors

The application has detected that the buyer returned to the payment page using the return button in their Internet browser. The payment form has been locked.

Note that this information can be detected only in some browsers.

CLIENT_704

Code CLIENT_704
Definition you need to load Font Awesome in your <head>
Category Warnings

An additional field uses icons with the Awesome font but the library has not loaded. For more information, go to: Custom form fields.

CLIENT_997

Code CLIENT_997
Definition Endpoint configuration mismatch
Category Errors

The formToken has been created via a gateway different from the one where the JavaScript client has been downloaded. The URL of the call to the RESTful Web Service must be the same as the one of the JavaScript client.

CLIENT_998

Code CLIENT_998
Definition Demo form, see the documentation
Category Errors

The payment form uses a demo formToken that does not allow to interact with the server. Use a valid formToken: Charge/CreatePayment.

CLIENT_999

Code CLIENT_999
Definition Technical error
Category Errors

Unknown error, please contact tech support and give them the following information:

  • Shop number,
  • URL of the form,
  • Name and version of the browser,
  • Type and version of the operating system,
  • Device used (iPhone 6S, PC, iPad Pro, …),
  • Date and time of the error.