Conekta.JS allows tokenization of card holder's sensitive information.

Include the library

You can include our library without downloading it on your site.

Language

You can change the language of the response.

Get the default language:

Public key

To tokenize you need your public key. Remember to replace you sandbox mode public key for your production mode public key when you are ready to process real charges. You can get all of the key in your admin within the API Keys section.

To get your public key:

Token

successResponseHandler receives the token as a javascript object with which you can send the token_id to your server.

errorResponseHandler will be used for any condition generated by an unsuccessful response. This normally occurs with card validation errors.

tokenParams is a hash. The minimum required attributes are number, name, cvc, exp_month and exp_year.

Conekta.Token.create sends the information to our server to generate the token and travels in a secure manner to your server.

In addition to creating the object, you can use data-attributes along with jQuery to generate the token, visit our card tutorial to see an example.

Validations

Conekta.card.validateNumber reviews that the format of the card number is correct.

Conekta.card.validateExpirationDate reviews that the expiration date is a valid and future date.

Conekta.card.validateCVC reviews that the security code is a valid whole number, 3 to 4 characters long.

Conekta.card.getBrand returns the card type as a string.

Perform a charge in your server

After obtaining the token send it to your server and generate an order.