Antifraud tutorial
In hola.cash we are aware that fraud prevention is a key feature for our merchants in order to have a successful business, and as a developer, it is important to ensure that you send as much of the anti-fraud data as possible, for this, we created cash.brain, the best fraud prevention system in the market.
We will use this information to detect fraud and stop it, that’s why sending accurate data is very important. Using fake or hard-coded information actually prevents fraud from being detected.
How to create an anti fraud header
The Antifraud Metadata is a list of parameters that needs to be provided to hola.cash. Tokenization and Transaction requests will be rejected if the required parameters are not provided. While some parameters are optional, we encourage you to send them for better fraud prevention.
1. Create the JSON Name/Value structure
Fill all the data that you can collect in the Json object.
const antfraudMetadata = {
"ip_address":"352698276144152",
"device_id" : "352698276144152",
"user_timezone" :"+03:34",
"user-agent-string" :"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36",
"os_version" :"Android 12",
"os_name" :"Android",
"screen_resolution_width" :"1280.0",
"screen_resolution_height" :"1024.0",
"window_position_x" :"780.98757401",
"window_position_y" :"580.71060983",
"color_depth" :"16,777,216.00"
}
2. Encode the JSON Object into a Base64 String
const Buffer = require('buffer').Buffer;
const antifraudMetadataBase64 =
Buffer.from(JSON.stringify(antifraudMetadata))
.toString('base64');
3. Add the Base64 string to the X-Cash-Anti-Fraud-Metadata header.
headers = {
"X-Api-Client-Key":"YOUR_APIKEY",
"X-Cash-Anti-Fraud-Metadata" : "antifraudMetadataBase64"
}