SDK WEB in fraud detection

SDK WEB in fraud detection

What is LBFraud web SDK?


LBFraud web SDK is the piece that allow you to integrate Ironchip LBFraud in your web
environment. Using it Ironchip can evaluate if the device and environment that uses the
website is secure. To add the SDK to the website you just need to follow the next steps.


JavaScript integration


https://lbfraud-web-sdk.s3.eu-west-3.amazonaws.com/release/0.1/LBFraud-SDKWeb.modern.js


First, you need to download the JavaScript file necessary JavaScript file. Once you
have it you need to import the file 

import { LBFraudSDK, LBFraudSDKEnvironment } from 'ironchip.modern.js';

Then, with the SDK imported you need to initialize the client. Please ensure that you
have the API- Key and the environment where you will work.


You will initialize the client (Choose just one environment): 

const client = new LBFraudSDK({
apiKey: 'api-key',
environment: LBFraudSDKEnvironment.Development,
LBFraudSDKEnvironment.Testing,
LBFraudSDKEnvironment.Production,
});

No sooner you initialize the client you can send transaction using the next method.


Web SDK 2


You have to pass as entry parameters the Transaction ID and the User ID. 

client
.sendTransaction(transactionID, userID)

And that is all. Every time the method is called it will send a transaction. 

Full example


The following code is a very simple example to test the SDK

import { LBFraudSDK, LBFraudSDKEnvironment } from '../dist/ironchip.modern.js';

const client = new LBFraudSDK({
apiKey: 'api-key',
environment: LBFraudSDKEnvironment.Testing
});

const myButton = document.getElementById('myButton');

function setListener() {
myButton.onclick = function(){

const transactionID = document.getElementById('transactionId').value;

const userID = document.getElementById('userId').value;

client
.sendTransaction(transactionID, userID)
.then((success) => {console.log(success)})
.catch((errorMsg) => {
console.log(errorMsg)
});

}

}
window.onload=function(){
setListener()
}
<!DOCTYPE html>
<html>
<head>
Web SDK 3
<title>Web SDK test</title>
</head>
<body>
<label for="transactionId">Transaction ID:</label>
<input type="text" id="transactionId" name="transactionId">
<label for="userId">User ID:</label>
<input type="text" id="userId" name="userId">
<button id="myButton">Send transaction</button>
<script type="module" src="test.js"></script>
</body>
</html>