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 JavaScript 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 many error codes described here:
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_505 | SmartForm not supported with the current theme |
CLIENT_508 | Card payment is not available |
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]
par exemple : 73239078:testpublickey_Zr3fXIKKx0mLY9YNBQEan42ano2QsdrLuyb2W54QWmUJQ
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 : undefined.
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_505
Code | CLIENT_505 |
DEFINITION | SmartForm not supported with the current theme |
Category | Errors |
Le thèmematerial
n'est pas supporté par le formulairesmartForm.
Il fautimpérativementchanger et choisir entre le thèmenéon
ou le thèmeclassic
. Voir :"Themes".
CLIENT_508
Code | CLIENT_508 |
DEFINITION | Card payment is not available |
Category | Errors |
Make sure you have an active card payment contract that is associated with your shop.
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 |
The <meta>
tag, via the "viewport" directive tells the browser how to control the dimensions and scale of the page to be displayed. It is recommended to use it on all HTML5 pages.
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 REST 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.