Introducing FraudLabs Pro Scala SDK

FraudLabs Pro Scala SDK

Introduction

Scala is a powerful language that blends object-oriented and functional programming. It is popular for building high-performance, data-intensive, and enterprise-grade applications on the JVM. With the release of the FraudLabs Pro Scala SDK, developers can now easily implement fraud detection features into their Scala solutions using the FraudLabs Pro API.

This library makes integration simple and efficient, allowing businesses to protect their applications against fraud with minimal coding effort.

Key Features of the Scala SDK

Below are the features of this Scala library:

  • Fraud analysis and scoring
    Analyze all orders on multiple elements such as IP, email, billing address, shipping address, and so on. Then, the SDK returns a fraud score, enabling merchants to quickly decide whether to approve, review, or reject an order.
  • IP address geolocation & proxy validation
    Determine the physical location of a user’s IP address and detect whether the transaction is being routed through anonymous proxies, VPNs, or TOR networks.
  • Email address validation
    Verify the email address to identify disposable, free, or suspicious domains that fraudsters frequently use when attempting fraudulent transactions.
  • Credit card issuing bank validation
    Check if the credit card’s issuing bank details match the customer’s billing information to detect stolen, fake, or mismatched card usage.
  • Transaction velocity validation
    Monitor how frequently a single email, IP address, or credit card is used within a given timeframe. Abnormally high transaction velocity may reveal bot-driven or repeated fraud attempts.
  • Device transaction validation
    Identify unusual patterns in device usage by analyzing browser fingerprints, operating systems, and other device-level identifiers to prevent repeated fraud attempts from the same device.
  • Blacklist validation
    Compare incoming transactions against FraudLabs Pro’s extensive blacklist database of known fraudsters, or enforce your own custom blacklist rules to stop repeat offenders.
  • Custom rules trigger
    Create tailored rules to meet specific business needs such as blocking high-value purchases from risky countries, flagging orders with mismatched addresses and so on.
  • Email notification of fraud orders
    Get email alerts whenever an order is identified as high risk, so fraud can be stopped.
  • Mobile app notification of fraud orders
    Get real-time push notifications from the FraudLabs Pro mobile app, ensuring fraud is addressed promptly.

How to Use FraudLabs Pro Scala SDK

1. Get Your API Key

An API key is required to use the SDK. You can subscribe to a free API key here:

👉 https://www.fraudlabspro.com/checkout-micro

2. Validate an Order (Sample Code)

Here’s a simple example of validating an order using FraudLabs Pro in Scala:

import com.fraudlabspro._
import java.util

object TestValidate {
  def main(args: Array[String]): Unit = {
    // Configures FraudLabs Pro API key
    FraudLabsPro.APIKEY = "YOUR_API_KEY"

    // Screen Order API
    val order = new Order
    // Sets order details
    val data = new util.Hashtable[String, String]
    data.put("ip", "146.112.62.105") // IP parameter is mandatory

    data.put("first_name", "Hector")
    data.put("last_name", "Henderson")
    data.put("email", "hh5566@gmail.com")
    data.put("user_phone", "561-628-8674")
    // Billing information
    data.put("bill_addr", "1766 PowderHouse Road")
    data.put("bill_city", "West Palm Beach")
    data.put("bill_state", "FL")
    data.put("bill_country", "US")
    data.put("bill_zip_code", "33401")
    data.put("number", "4556553172971283")
    // Order information
    data.put("user_order_id", "67398")
    data.put("user_order_memo", "Online shop")
    data.put("amount", "79.89")
    data.put("quantity", "1")
    data.put("currency", "USD")
    data.put("payment_gateway", "stripe")
    data.put("payment_mode", order.CREDIT_CARD) // Please refer reference section for full list of payment methods

    // Shipping information
    data.put("ship_first_name", "Hector")
    data.put("ship_last_name", "Henderson")
    data.put("ship_addr", "4469 Chestnut Street")
    data.put("ship_city", "Tampa")
    data.put("ship_state", "FL")
    data.put("ship_zip_code", "33602")
    data.put("ship_country", "US")
    val result = order.validate(data) // Sends order details to FraudLabs Pro
    println(result)
  }
}

Run the code to get the validation result.

This is the sample output:

{
    "ip_geolocation": {
        "ip": "146.112.62.105",
        "continent": "North America",
        "country_code": "US",
        "country_name": "United States of America",
        "region": "Washington",
        "city": "Vancouver",
        "latitude": 45.6386,
        "longitude": -122.6615,
        "zip_code": "98663",
        "timezone": "-07:00",
        "isp_name": "Cisco OpenDNS LLC",
        "domain": "opendns.com",
        "netspeed": "T1",
        "mobile_mnc": null,
        "mobile_mcc": null,
        "mobile_brand": null,
        "elevation": 53,
        "usage_type": [
            "Content Delivery Network"
        ],
        "is_proxy": false,
        "proxy_type": null,
        "is_in_blacklist": false
    },
    "billing_address": {
        "ip_distance_in_km": 4295.37,
        "ip_distance_in_mile": 2669.02,
        "is_ip_country_match": true
    },
    "shipping_address": {
        "is_address_ship_forward": false,
        "is_bill_country_match": true,
        "is_bill_state_match": true,
        "is_bill_city_match": false,
        "is_bill_postcode_match": false,
        "is_export_controlled_country": null,
        "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": false
    },
    "username": {
        "is_high_risk": null,
        "is_in_blacklist": null
    },
    "credit_card": {
        "card_brand": null,
        "card_type": null,
        "card_issuing_bank": null,
        "card_issuing_country": null,
        "is_prepaid": false,
        "is_bin_exist": true,
        "is_bin_country_match": null,
        "is_in_blacklist": false
    },
    "device": {
        "is_malware_exploit": false,
        "is_in_blacklist": null
    },
    "user_order_id": "67398",
    "fraudlabspro_id": "20250917-1GSA5Z",
    "fraudlabspro_score": 74,
    "fraudlabspro_status": "REVIEW",
    "fraudlabspro_rules": [],
    "api_version": "2.0.0",
    "remaining_credits": 499
}

Running this program will send an order validation request to FraudLabs Pro and return the fraud analysis result.

For detailed documentation and other examples, visit the official FraudLabs Pro Scala SDK page.

For developer guides, visit the FraudLabs Pro Developer Guide page.

Conclusion

The FraudLabs Pro Scala SDK gives developers a powerful and straightforward way to embed fraud prevention features into their Scala applications. With features such as fraud scoring, IP and email validation, device analysis, blacklist checks, and real-time alerts, it helps businesses reduce chargebacks and protect against fraudulent transactions.

Start building secure, fraud-resistant applications today with the FraudLabs Pro Scala SDK and keep your business safe from evolving online threats.


Fortify Your Business Against Fraud

Streamline your works with our fraud detection API now!

Was this article helpful?

Related Articles