Callback
The callback given to syspay.tokenizer.tokenizeCard() will be passed a single response object. Some basic pre-validation is made (data types and a LUHN test on the card number) so the callback could be triggered before requesting the token creation to our API if any of these fail.
This response object will contain the following properties:
| Property | Type | Description |
|---|---|---|
| error | integer|null | If the token creation went fine, the error property will be null, otherwise an integer will indicate the error encountered. See note above. |
| message | string|null | The corresponding error message for the given code. (This message will always be in english) |
| token | string|null | The returned token to be submitted by the form, or null if an error occurred |
| api_code | integer | In case of request error, the actual API error code will be given here. |
| api_message | string | The corresponding api_code message |
Error codes
| Code | Description |
|---|---|
| 4 | Invalid or missing cardholder name |
| 8 | Invalid or missing card number |
| 16 | Invalid or missing expiration month |
| 32 | Invalid or missing expiration year |
| 64 | Invalid or missing cvc |
| 128 | Request error - The card information couldn’t be tokenized or the public key is not valid. When this error occurs the object given to the callback will contain an api_code and an api_message properties with further information |
| 256 | Response error - The Syspay API call failed (server-side or network error) |