• France
lyra.com
Search
Categories
Tags
docs.
France
Spain
Europe (English)
India
Home
Implementation
Embedded form (cards)
REST payment API
REST PCI-DSS payment API
REST SEPA API
Hosted payment
Data collection form
File exchange
Mobile payment
Snippets
Plugins
Marketplace
Back Office
Merchant Back Office
Expert Back Office
Guides
Help
FAQ
Video tutorials
Support

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()

How are errors displayed?

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

https://github.com/lyra/rest-php-examples/blob/master/www/minimalEmbeddedForm.php#L81-L82
    <!-- 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:

https://github.com/lyra/rest-php-examples/blob/master/www/js_examples/jquery/minimalEmbeddedForm.onError.php#L70-L80
          <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

REST API has many error codes described here :

  • ACQ
  • AUTH
  • INT
  • PSP

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_305 No formToken defined
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 The used FormToken is for demo purposes only, payment is disabled. Check the documentation to get a real formToken.
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:

CODE DEFINITION
CLIENT_704 you need to load Font Awesome in your
CLIENT_705 viewport definition is missing ( )

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 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,
    (...)
}

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_305

Code CLIENT_305
Definition No formToken defined
Category Errors

Le formToken n'existe pas ou n'est pas conforme. Pour plus de détails, rendez-vous ici : Créer un formToken.

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
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_705

Code CLIENT_705
Definition viewport definition is missing ( )
Category Warnings

eb045d78d273107348b0300c01d29b7552d622abbc6faf81b3ec55359aa9950c.

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 The used FormToken is for demo purposes only, payment is disabled. Check the documentation to get a real formToken.
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, etc.)
  • Date and time of the error.
Recruitment

Head Office :

LYRA NETWORK
109, rue de l’innovation
31670 Labège
FRANCE

2.16.0-doc-1.8