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:


How are errors displayed?

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>

All you need to do is add it to your code.

Managing errors manually

To handle errors manually, simply intercept the default error message and customize it. In the following example, the custom error message will be placed in the customerror class div:

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

            try {
              /* if client answer exists, a refused transaction has been created */
              /* it's not always the case. For example, if the form is empty,    */
              /* error is raised before transaction creation                     */

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.

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 help you integrate the JavaScript client:

CLIENT_704 you need to load Font Awesome in your <head>
CLIENT_705 viewport definition is missing ( <baseAddress> )

Error code details


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]

par exemple : 73239078:testpublickey_Zr3fXIKKx0mLY9YNBQEan42ano2QsdrLuyb2W54QWmUJQ

For more information, go to: Retrieving my keys.


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.


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.


Code CLIENT_300
Definition Invalid form data
Category Errors

When several form fields are invalid, a general CLIENT_300 error is returned. The detailed list of all detected errors will be presented 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,


Code CLIENT_301
Definition Invalid card number
Category Errors

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


Code CLIENT_302
Definition Invalid expiry date
Category Errors

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


Code CLIENT_303
Definition Invalid security code
Category Errors

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


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.


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.


| Code | CLIENT_501 | | Définition | Kr-public-key is empty or not defined | | Catégorie | Errors | La clé publique n’est pas définie dans kr-public-key.


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.


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.


Code CLIENT_705
Definition viewport definition is missing ( <baseAddress> )
Category Warnings

The “&lt;meta&gt;” tag, via the “viewport” directive, indicates to the browser how to control the dimensions and the scale of the page to display. It is recommended to use it on all pages in HTML5.


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.


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.


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, etc.)
  • Date and time of the error