Integration
Before you start
Make sure you've obtained a token, server URL, and auth key from credolab
1. Declare dependencies
As the private registry is used, you'll need to add to your user or project .npmrc file (if this file is absent you have to create it alongside the package.json file) the following:
@credolab:registry=https://npm.cloudsmith.io/credolab/common-sdk/
//npm.cloudsmith.io/credolab/common-sdk/:username=token
//npm.cloudsmith.io/credolab/common-sdk/:_password=$TOKEN
Run the following command in a terminal to install SDK:
npm install '@credolab/[email protected]'
npm install '@credolab/[email protected]'
Alternatively, you can add it to the dependencies section in your project package.json
file
{ "dependencies":
{ "@credolab/credoapp-sdk": "$version" }
}
{ "dependencies":
{ "@credolab/credoapp-iovation-sdk": "$version" }
}
and then execute thenpm install
command in the terminal.
Note
Replace
$TOKEN
with actual token obtained from credolabAlso, replace
X.Y.Z
with module versions from Web SDK page.
The final result should look like this:npm install '@credolab/[email protected]'
add import declaration for CredoAppService or CredoAppServiceAsync
import { CredoAppService } from "@credolab/credoapp-sdk";
import { CredoAppServiceAsync } from "@credolab/credoapp-sdk";
import { CredoAppService } from "@credolab/credoapp-iovation-sdk";
import { CredoAppServiceAsync } from "@credolab/credoapp-iovation-sdk";
2. Build and use CredoAppService
// CredoApp authentication key provided by credolab team
var authKey = "AUTH_KEY"
// value from CredoLab URLs table
var url = "https://scoring-**.credolab.com";
// reference number intended to associate the collected dataset with the lender's record
var referenceNumber = "UNIQUE_REFERENCE_NUMBER";
// init CredoAppService
var credoAppService = new CredoAppService(url, authKey);
credoAppService.startTracking();
function stopTracking() {
credoAppService.stopTracking()
}
function collectData() {
credoAppService.stopTrackingAndCompleteAsync(referenceNumber).then(() => {
alert(āDataset has been uploaded and completedā);
}, (e) => alert(e));
}
// CredoApp authentication key provided by credolab team
var authKey = "AUTH_KEY"
// value from CredoLab URLs table
var url = "https://scoring-**.credolab.com";
// reference number intended to associate the collected dataset with the lender's record
var referenceNumber = "UNIQUE_REFERENCE_NUMBER";
// init CredoAppService
var credoAppService = new CredoAppServiceAsync(url, authKey);
credoAppService.startTrackingAsync(referenceNumber).then(() => {
alert(āEvent tracking started and dataset continuously uploadedā);
}, (e) => alert(e));
function stopTracking() {
credoAppService.stopTrackingAsync().then(() => {
alert(āEvent tracking stoppedā);
}, (e) => alert(e));
}
function collectData() {
credoAppService.stopTrackingAndCompleteAsync().then(() => {
alert(āDataset has been completedā);
}, (e) => alert(e));
}
Please note that it is not possible to start tracking with a new reference number if there is already ongoing tracking associated with another number. In such cases, an error will be returned, indicating that tracking for a certain reference number is currently in progress. To start tracking with a different reference number, the current tracking process must be stopped on the instance that initiated the tracking process.
Next Steps
After successfully integrating our SDK, it is recommended to proceed with the following steps to utilise our platform effectively:
- Setting up your Reverse Proxy
- Uploading your Dataset. Once the server is configured, you can upload your dataset using the server address.
- Collecting your Dataset Insight or TruValidate(formerly known as iovation) Fraud Check. With the dataset uploaded, you can now get insights or perform TruValidate Fraud Checks to assess risk based on the device and transaction details provided.
If you have any further questions, please do not hesitate to contact us.
Updated 18 days ago