Version: current

LIB JS

info

We have released a brand new Web SDK! Check it out here and give it try!

How does EBANX JS works?

Customer Data

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

Using LIB js, the request will be made directly from customerā€™s browser to EBANX server. Meaning that customerā€™s credit card information will not be stored in Merchantā€™s server.

Request Token

A request will be made from customerā€™s browser to EBANX server, sending the customer creditcard data to generate a token that represents the customer credit card information. 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.

Your title

Why use LIB JS

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

Through LIB 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.

How to use EBANX JS

Script

Add this script to your page:

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

Config

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://ebxdevelopers2.wpengine.com/merchant-area/merchant-options).
EBANX.config.setCountry('br'); // Set your checkout country (see: https://en.wikipedia.org/wiki/ISO_3166-1).

card.createToken

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;
}
};
EBANX.card.createToken(
{
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
);

Contact

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

Last updated on by ā€œElderBalsani