How to Migrate FraudLabs Pro Screen API from v1 to v2

Migrate FraudLabs Pro Screen API from v1 to v2

Introduction

FraudLabs Pro is excited to announce the release of the FraudLabs Pro v2 API. This new version of the API has been completely rewritten with a robust infrastructure to ensure fast response times and scalability for merchants.

The key changes to the v2 API are as follows:

Fast Response Time

The new v2 version has been redesigned to take full advantage of multi-threading for algorithm calculation and processing. This allows for simultaneous execution of various types of validations, such as email validation, IP validation, blacklist validation, and so on, resulting in significantly reduced response time.

Object-based JSON Response

One key feature of the FraudLabs Pro v2 API is the organization of response data in objects instead of flat JSON key-value pairs. By grouping related fields together within objects, it improves the overall organization and structure of the response. This allows developers to access and retrieve specific information more efficiently.

Refined HTTP Status Code

In the previous version of the API, error responses were always returned with a 200 code, which could be confusing for developers. In the new v2 API, this has been improved by returning the relevant HTTP code that corresponds to the specific error. For example, if you fail to provide the required input parameters, the API will now respond with a 400 code, indicating a bad request. This standardized approach to error handling makes it easier for developers to identify and handle errors in their applications.

Support POST method

FraudLabs Pro has opted to exclusively support the POST method for the order screen API, prioritizing security and the protection of sensitive information. By utilizing the POST method, customer data is transmitted securely, reducing the risk of unauthorized access or interception.

How to migrate from existing FraudLabs Pro API from v1 to v2

FraudLabs Pro Screen Order API

Step 1: Change the API endpoint

Please update the current API endpoint from

https://api.fraudlabspro.com/v1/order/screen

to

https://api.fraudlabspro.com/v2/order/screen

Step 2: Change the method from GET to POST

The new API will no longer accept GET requests. Please ensure that you are sending a POST request with the POST data. The use of GET parameters will no longer be accepted.

Below is the example of CURL in PHP.

$ curl https://api.fraudlabspro.com/v2/order/screen -X POST \
    -d "key=YOUR_API_KEY" \
    -d "format=json" \
    -d "ip=198.221.136.159" \
    -d "bill_city=Cleveland" \
    -d "bill_state=OH" \
    -d "bill_zip_code=44115" \
    -d "bill_country=US" \
    -d "ship_addr=4987 Bingamon Road" \
    -d "ship_city=Cleveland" \
    -d "ship_state=OH" \
    -d "ship_zip_code=44115" \
    -d "ship_country=US" \
    -d "user_phone=440-5551961" \
    -d "bin_no=558265" \
    -d "user_order_id=7893" \
    -d "amount=99.95" \
    -d "quantity=1" \
    -d "payment_mode=creditcard"

Step 3: Revise the logic for retrieving response data

The response data has been changed to an object-based format. As a result, you need to update your logic for retrieving the response data. Here is an example of the latest JSON object-based response.

{
	"ip_geolocation": {
    	"ip": "198.221.136.159",
    	"continent": "North America",
    	"country_code": "US",
    	"country_name": "United States of America",
    	"region": "Ohio",
    	"city": "Columbus",
    	"latitude": 39.9664,
    	"longitude": -83.0128,
    	"zip_code": "43218",
    	"timezone": "-05:00",
    	"isp_name": "DoD Network Information Center",
    	"domain": "nic.mil",
    	"netspeed": "Company",
    	"mobile_mnc": null,
    	"mobile_mcc": null,
    	"mobile_brand": null,
    	"elevation": 231,
    	"usage_type": [
        	"Military"
    	],
    	"is_proxy": false,
    	"is_in_blacklist": false
	},
	"billing_address": {
    	"ip_distance_in_km": 5.00,
    	"ip_distance_in_mile": 3.12,
    	"is_ip_country_match": true
	},
	"shipping_address": {
    	"is_address_ship_forward": false,
    	"is_bill_country_match": null,
    	"is_bill_state_match": null,
    	"is_bill_city_match": null,
    	"is_bill_postcode_match": null,
    	"is_export_controlled_country": false,
    	"is_in_blacklist": false
	},
	"email_address": {
    	"is_free": true,
    	"is_disposable": false,
    	"is_domain_exist": true,
    	"is_new_domain_name": false,
    	"is_in_blacklist": false
	},
	"phone_number": {
    	"is_disposable": null,
    	"is_in_blacklist": null
	},
	"username": {
    	"is_high_risk": false,
    	"is_in_blacklist": false
	},
	"credit_card": {
    	"card_brand": null,
    	"card_type": null,
    	"card_issuing_bank": null,
    	"card_issuing_country": null,
    	"is_prepaid": null,
    	"is_bin_exist": null,
    	"is_bin_country_match": null,
    	"is_in_blacklist": null
	},
	"device": {
    	"is_malware_exploit": false,
    	"is_in_blacklist": null
	},
	"user_order_id": "142",
	"fraudlabspro_id": "20240101-HW4WJM",
	"fraudlabspro_score": 76,
	"fraudlabspro_status": "REVIEW",
	"fraudlabspro_rules": [
    	"Billing Address NOT EQUALS TO Shipping Address"
	],
	"api_version": "2.0.0",
	"remaining_credits": 9999
}

For more information on the fields and descriptions, please refer to https://www.fraudlabspro.com/developer/api/screen-order

FraudLabs Pro Feedback Order API

Step 1: Change the API endpoint

Please update the current API endpoint from

https://api.fraudlabspro.com/v1/order/feedback

to

https://api.fraudlabspro.com/v2/order/feedback

Step 2: Change the method from GET to POST

The new API will no longer accept GET requests. Please ensure that you are sending a POST request with the POST data. The use of GET parameters will no longer be accepted.

Below is the example of CURL in PHP.

$ curl https://api.fraudlabspro.com/v2/order/feedback -X POST \
    -d "key=Enter_License_Key" \
    -d "format=json" \
    -d "id=20130131-O263CR" \
    -d "action=APPROVE"

FraudLabs Pro Get Order Results API

Step 1: Change the API endpoint

Please update the current API endpoint from

https://api.fraudlabspro.com/v1/order/result

to

https://api.fraudlabspro.com/v2/order/result

Step 2: Revise the logic for retrieving response data

The response data has been changed to an object-based format. As a result, you need to update your logic for retrieving the response data. Here is an example of the latest JSON object-based response.

{
	"ip_geolocation": {
    	"ip": "198.221.136.159",
    	"continent": "North America",
    	"country_code": "US",
    	"country_name": "United States of America",
    	"region": "Ohio",
    	"city": "Columbus",
    	"latitude": 39.9664,
    	"longitude": -83.0128,
    	"zip_code": "43218",
    	"timezone": "-05:00",
    	"isp_name": "DoD Network Information Center",
    	"domain": "nic.mil",
    	"netspeed": "Company",
    	"mobile_mnc": null,
    	"mobile_mcc": null,
    	"mobile_brand": null,
    	"elevation": 231,
    	"usage_type": [
        	"Military"
    	],
    	"is_proxy": false,
    	"is_in_blacklist": false
	},
	"billing_address": {
    	"ip_distance_in_km": 5.00,
    	"ip_distance_in_mile": 3.12,
    	"is_ip_country_match": true
	},
	"shipping_address": {
    	"is_address_ship_forward": false,
    	"is_bill_country_match": null,
    	"is_bill_state_match": null,
    	"is_bill_city_match": null,
    	"is_bill_postcode_match": null,
    	"is_export_controlled_country": false,
    	"is_in_blacklist": false
	},
	"email_address": {
    	"is_free": true,
    	"is_disposable": false,
    	"is_domain_exist": true,
    	"is_new_domain_name": false,
    	"is_in_blacklist": false
	},
	"phone_number": {
    	"is_disposable": null,
    	"is_in_blacklist": null
	},
	"username": {
    	"is_high_risk": false,
    	"is_in_blacklist": false
	},
	"credit_card": {
    	"card_brand": null,
    	"card_type": null,
    	"card_issuing_bank": null,
    	"card_issuing_country": null,
    	"is_prepaid": null,
    	"is_bin_exist": null,
    	"is_bin_country_match": null,
    	"is_in_blacklist": null
	},
	"device": {
    	"is_malware_exploit": false,
    	"is_in_blacklist": null
	},
	"user_order_id": "142",
	"fraudlabspro_id": "20240101-HW4WJM",
	"fraudlabspro_score": 76,
	"fraudlabspro_status": "REVIEW",
	"fraudlabspro_rules": [
    	"Billing Address NOT EQUALS TO Shipping Address"
	],
	"api_version": "2.0.0",
	"remaining_credits": 9999
}

How to migrate from existing FraudLabs Pro SMS Verification API from v1 to v2

FraudLabs Pro Send SMS Verification API

Step 1: Change the API endpoint

Please update the current API endpoint from

https://api.fraudlabspro.com/v1/verification/send

to

https://api.fraudlabspro.com/v2/verification/send

Step 2: Change the method from GET to POST

The new API will no longer accept GET requests. Please ensure that you are sending a POST request with the POST data. The use of GET parameters will no longer be accepted.

Below is the example of CURL in PHP.

$ curl https://api.fraudlabspro.com/v2/verification/send -X POST \
    -d "key=YOUR_API_KEY" \
    -d "format=json" \
    -d "tel=+12015550123" \
    -d "mesg=Your OTP for the transaction is <otp>" \
    -d "country_code=US" \
    -d "otp_timeout=3600" \

Step 3: Revise the logic for retrieving response data

The response data has been changed to an object-based format. As a result, you need to update your logic for retrieving the response data. Here is an example of the latest JSON object-based response.

{
    	"tran_id": "AAAAAAAAAA0000000000",
    	"credits_remaining": "99"
}

For more information on the fields and descriptions, please refer to https://www.fraudlabspro.com/developer/api/send-sms-verification.

Get Verification Result API

Step 1: Change the API endpoint

Please update the current API endpoint from

https://api.fraudlabspro.com/v1/verification/result

to

https://api.fraudlabspro.com/v2/verification/result

Please note that the “Get Verification Result API” will still use the GET method, so there is no need to change the existing GET parameters.

Step 2: Revise the logic for retrieving response data

The response data has been changed to an object-based format. As a result, you need to update your logic for retrieving the response data. Here is an example of the latest JSON object-based response.

{
    	"result": "Y"
}

For more information on the fields and descriptions, please refer to https://www.fraudlabspro.com/developer/api/get-sms-verification-result.

REST API Error Handling Migration

As mentioned in the previous article, the API has been enhanced to return the appropriate HTTP code that corresponds to a specific error, such as 4xx or 5xx, instead of always 200. If your program relies on this HTTP code for subsequent actions, you will need to revise the logic accordingly. Below is the example of error response for invalid key, with HTTP Status Code 400.

{
    "error": {
        "error_code": 10001,
        "error_message": "INVALID API KEY"
    }
}

We strongly recommend that you begin the migration process

In conclusion, the migration from FraudLabs Pro API v1 to v2 brings significant improvements and optimizations to enhance the overall user experience. The new v2 API offers faster response times, object-based JSON responses, refined HTTP status codes, and increased security with exclusive support for the POST method. By migrating to v2, merchants can benefit from improved fraud detection accuracy and streamlined processing. Embrace these enhancements and stay ahead of fraudsters by migrating your existing FraudLabs Pro API to v2 for a more efficient and secure online experience.


Fortify Your Business Against Fraud

Streamline your works with our fraud detection API now!

Was this article helpful?

Related Articles