Skip to main content

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:

PropertyTypeDescription
errorinteger|nullIf the token creation went fine, the error property will be null, otherwise an integer will indicate the error encountered. See note above.
messagestring|nullThe corresponding error message for the given code. (This message will always be in english)
tokenstring|nullThe returned token to be submitted by the form, or null if an error occurred
api_codeintegerIn case of request error, the actual API error code will be given here.
api_messagestringThe corresponding api_code message

Error codes

CodeDescription
4Invalid or missing cardholder name
8Invalid or missing card number
16Invalid or missing expiration month
32Invalid or missing expiration year
64Invalid or missing cvc
128Request 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
256Response error - The Syspay API call failed (server-side or network error)