Introducing the FraudLabs Pro Rust SDK

FraudLabs Pro Rust SDK

Introduction

Rust is a modern programming language designed for performance, safety, and concurrency, ensuring memory and thread safety while eliminating the need for a garbage collector. It has become a popular choice for building reliable applications without sacrificing performance. To help developers integrate FraudLabs Pro’s fraud prevention API into their Rust applications, FraudLabs Pro now offers an official Rust SDK. 

Key Features of the Rust SDK

Below are the features of the FraudLabs Pro Rust SDK:

Fraud Analysis and Scoring

Automatically analyze transactions based on multiple elements like IP, email, billing, shipping and so on then return a fraud score. This fraud score helps merchants decide whether to approve, review, or reject the transaction.

Credit Card Issuing Bank Validation

Validate whether a credit card’s issuing bank matches the details provided by the user. This helps to reduce stolen or fake credit card usage.

SMS Verification and Validation

Prevent fake sign-ups and account abuse by verifying user phone numbers through SMS-based one-time passcodes. This ensures the customer is reachable and genuine.

How to Use FraudLabs Pro Rust SDK

To start using the FraudLabs Pro Rust SDK, follow these simple steps:

1. Get Your API Key

You’ll need an API key to use the SDK. Sign up for a free account and obtain your key here:

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

2. Install the SDK

Add the SDK dependency to your Cargo.toml:

fraudlabspro = "1.0.0"

3. Validate an Order (Sample Code)

Here’s a simple example showing how to validate an order using FraudLabs Pro.

Copy the codes below and paste it to your main.rs. Kindly replace YOUR_API_KEY to your FraudLabs Pro API key and save the file.

use fraudlabspro::validation::{FraudValidation, FraudValidationRequest, OrderInfo, CardInfo, BillingInfo, ShippingInfo};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let fv = FraudValidation::new("YOUR_API_KEY");

    let req = FraudValidationRequest {
        ip: Some("146.112.62.105".to_string()),
        flp_checksum: None,
        order: Some(OrderInfo {
            order_id: Some("67398".into()),
            order_note: None,
            currency: Some("USD".into()),
            amount: Some("42".into()),
            quantity: Some("1".into()),
            payment_gateway: Some("stripe".into()),
            payment_method: Some("creditcard".into()),
            department: None,
        }),
        card: Some(CardInfo {
            number: Some("4556553172971283".into()),
            avs_result: None,
			      cvv_result: None,
        }),
        billing: Some(BillingInfo {
            first_name: Some("John".into()),
            last_name: Some("Doe".into()),
            username: Some("jdoe".into()),
            password: Some("s3cr3t".into()),
            email: Some("john@example.com".into()),
            phone: Some("555-123-4567".into()),
            address: Some("1 Main St".into()),
            city: Some("NYC".into()),
            state: Some("NY".into()),
            postcode: Some("10001".into()),
            country: Some("US".into()),
        }),
        shipping: Some(ShippingInfo {
            first_name: Some("John".into()),
            last_name: Some("Doe".into()),
            address: Some("1 Main St".into()),
            city: Some("NYC".into()),
            state: Some("NY".into()),
            postcode: Some("10001".into()),
            country: Some("US".into()),
        }),
    };

    let res = fv.validate(req)?; // JSON text
    println!("{}", res);

    Ok(())
}

Then, run this command to get the validation result.

cargo run

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": 3920.91,
        "ip_distance_in_mile": 2436.34,
        "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": true,
        "is_bill_postcode_match": true,
        "is_export_controlled_country": null,
        "is_in_blacklist": false
    },
    "email_address": {
        "is_free": false,
        "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": 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": "20250827-SMXYFG",
    "fraudlabspro_score": 73,
    "fraudlabspro_status": "REVIEW",
    "fraudlabspro_rules": [],
    "api_version": "2.0.0",
    "remaining_credits": 500
}

This example sends an order validation request to FraudLabs Pro and prints the fraud analysis report in JSON format.

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

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

Conclusion

The FraudLabs Pro Rust SDK is a powerful tool for developers who want to integrate advanced fraud prevention features into their applications while benefiting from Rust’s performance and safety. Whether you are building new applications or enhancing existing systems, the SDK simplifies fraud detection, helping you protect your business and your customers.

Start building secure, reliable applications today with the FraudLabs Pro Rust SDK and stay ahead of online fraud.


Free Fraud Protection Today!

Start safeguarding your business with FraudLabs Pro Fraud Prevention at Zero Cost!

Was this article helpful?

Related Articles