Device Fingerprint
About this guide
This page explains how to create a device ID using our javascript library, EBANX.js. This device ID is then associated with a payment when the customer completes a purchase. This information is used by anti-fraud tools to match the customer’s behavior against known fraudulent behavior to detect potential fraud attempts.
If you are not integrated with EBANX Direct API yet, please take a look at this basic guide about it. Are you not sure if EBANX Direct API is the best option for your e-commerce? Please, talk with one of our integration specialists.
What you will need
Before starting your integration, please make sure that you have:
- An EBANX Sandbox account. That's not the case? Please sign up for an Sandbox Account here;
How it works
To create a device id and add it to your payment request, follow the steps below:
Add EBANX.js to your webpage
Our client SDK enables you to securely collect payment information from your customers. Add the following script to your webpage:
<script type="text/javascript" src="https://ebanx-js.ebanx.com/v1.106.0/dist/ebanx.js"></script>And initialize it with your Merchant's Configuration:
EBANX.init({publicIntegrationKey: 'your_integration_key_goes_here',country: 'br',mode: 'test',});Get the device ID using EBANX.js
Call the
EBANX.deviceFingerprint.getSession
method.EBANX.deviceFingerprint.getSession().then((session) => {// use the session to fullfil your payment}).catch((error) => {// handle any errors that can happen});EBANX.deviceFingerprint.getSession
returns a Promise object, so, make sure you handle the asynchrounous call properly by using a callback function. A successful token creation response contains the following field. The values will vary for each device://The session object created in the previous step will have the following fields:{device_id: 'd7465b1f6b1aaeeab1771fe743e02f34';}Add the device ID to your payment request
Include the device ID you obtained in the previous step to your
payment
object in your Direct API call. For more information on our Direct API, click here!curl -X POST 'https://sandbox.ebanxpay.com/ws/direct' \-d 'request_body={"integration_key": "your_test_integration_key","operation": "request","payment": {"name": "José Silva","email": "jose@example.com","birth_date": "12/04/1979","document": "853.513.468-93","address": "Rua E","street_number": "1040","city": "Maracanaú","state": "CE","zipcode": "61919-230","country": "br","phone_number": "8522847035","payment_type_code": "visa","merchant_payment_code": "3d1e73b0bbe","currency_code": "BRL","instalments": 1,"device_id":"34c376b2767","amount_total": 100,"creditcard": {"card_number": "4111111111111111","card_name": "José Silva","card_due_date": "12/2019","card_cvv": "123"}}}'
Live Sample
Here's a sample of a device ID being generated using EBANX.js:
Getting help
We hope this article was enlightening, but in case we’ve failed to take out your doubts you have the following options to keep on seeking for answers:
- If you’re not our partner yet and would like to know more about our prices and conditions please fill our this form and our commercial team will get in touch with you.
- In case you’re already our partner please get in touch with our support team at integration@ebanx.com.