1. How does EBANX JS works?

Customer Data

The customer will inform their creditcard data through your store page. This data will be used to generate token.

Request Token

A request will be made to our servers, sending the customer creditcard data, to generate a token that represents the customer credit card. The token will be returned to the customer to continue the request.

Request Payment

Once the token is received, the form with the payment details will be submitted to our API, which will create the payment.

The diagram below show the flow of the operation.


2. Why use EBANX JS

One of the main reasons to use EBANX JS is that you don’t have to worry about storing and securing cardholder data.

According to PCI DSS requirements, you must restrict access and protect stored cardholder data.

Through EBANX JS, the customer will inform their creditcard data and our servers will generate a token for this creditcard, so you don’t have to store any sensitive data. This token will be used for the whole request.

3. Start using EBANX JS


Add this script to your page:

<script type="text/javascript" src="https://js.ebanx.com/"></script>


EBANX.config.setMode('test'); // Set mode. production/test
EBANX.config.setPublishableKey('put your key here'); // Set your Publishable key. To identify your site to EBANX API you must start by providing your [publishable key](https://developers.ebanx.com/merchant-area/merchant-options).
EBANX.config.setCountry('br'); // Set your checkout country (see: https://en.wikipedia.org/wiki/ISO_3166-1).


The following is an example of action to create a single use token, used to pass credit-card information to your server in a safe way.

var createTokenCallback = function(ebanxResponse) {
  if (ebanxResponse.data.hasOwnProperty('status')) {
      document.getElementById('status').textContent = 'Success, the token is: ' + ebanxResponse.data.token;
  } else {
      var errorMessage = ebanxResponse.error.err.status_message || ebanxResponse.error.err.message;
      document.getElementById('status').textContent = 'Error ' + errorMessage;

  card_number: document.getElementById('card-number').value,
  card_name: document.getElementById('card-name').value,
  card_due_date: document.getElementById('card-due-date').value,
  card_cvv: document.getElementById('card-cvv').value
}, createTokenCallback);


If you have any doubts or need help, you can send and email to: