This allows you to integrate with risk SDK and fetch the session_id
For the best performance of Tazapay's Fraud Detection system, you should integrate the risk SDK into every payment process initiated by shoppers. It captures advanced signals that are leveraged in Tazapay's fraud model. These signals include:
- Device Identification
- Geolocation
- Spoofing Attempts
- Fingerprinting Data
How it works
Integrate the risk SDK
Set up tazapay.js
<head>
<title>Checkout</title>
<script type="text/javascript" src="https://js.tazapay.com/v3.js"></script>
</head>
<head>
<title>Checkout</title>
<script type="text/javascript" src="https://js-sandbox.tazapay.com/v3.js"></script>
</head>
Dynamic Injection
Before injecting the SDK dynamically, please use the following event listener to determine when the script has finished loading.
window.addEventListener('tazapaySDKReady', () => { // continue to use library });
Initialising tazapay.js with your public key
const tazapay = await window.tazapay('pk_test_TYooMyTiskhfuvdEDq54NiTphI7jx');
The above code creates an instance of the Tazapay object. This created object now serves as an entry-point to the rest of Tazapay’s JS SDK.
You can fetch the public key from the Tazapay dashboard.
Retrieve the session_id
When the customer clicks to pay, publish the device data and retrieve the session_id
const session_id = await tazapay.publishRiskData();
The function tazapay.publishRiskData() will create a promise when called which resolves into a session_id string.
Attach the session_id to the transaction
- Pass the session_id to your server.
- Pass the session_id in the API calls to the following depending on your use case