A professional TypeScript SDK for seamless integration with the FraudLabs Pro API. This SDK provides comprehensive fraud detection capabilities for e-commerce platforms, online services, and any application requiring robust fraud prevention mechanisms.
- 🛡️ Complete Fraud Detection: Payment fraud, identity verification, IP geolocation analysis
- 🔒 100% Type Safe: Full TypeScript support with comprehensive type definitions
- 🚀 Easy Integration: Simple, intuitive API design
- 📊 Comprehensive Scoring: Advanced risk scoring algorithms
- 🌍 Global Coverage: Worldwide IP geolocation and risk assessment
- ⚡ High Performance: Optimized for production environments
# npm
npm install fraudlabspro-sdk
# yarn
yarn add fraudlabspro-sdk
# pnpm
pnpm add fraudlabspro-sdkimport {
FraudLabsPro,
FraudApiRequest,
FraudApiResponse,
} from "fraudlabspro-sdk";
// Initialize the SDK with your API key
const fraudLabsPro = new FraudLabsPro("YOUR_API_KEY");
// Create a fraud screening request
const request: FraudApiRequest = {
ip: "146.112.62.105",
order_id: "ORDER_12345",
order_amount: 199.99,
order_currency: "USD",
bill_fname: "John",
bill_lname: "Doe",
bill_email: "john.doe@example.com",
bill_phone: "+1234567890",
bill_addr: "123 Main Street",
bill_city: "New York",
bill_state: "NY",
bill_country: "US",
bill_zip: "10001",
card_bin: "424242",
};
// Screen the order for fraud
const response: FraudApiResponse = await fraudLabsPro.screenOrder(request);
console.log("Fraud Score:", response.fraudlabspro_score);
console.log("Status:", response.fraudlabspro_status);
console.log("Risk Factors:", {
isProxyIP: response.is_proxy_ip,
isHighRiskCountry: response.is_high_risk_country,
isEmailValid: response.is_email_valid,
});new FraudLabsPro(apiKey: string, apiUrl?: string)apiKey: Your FraudLabs Pro API keyapiUrl: Optional custom API endpoint (defaults to FraudLabs Pro production API)
Screen an order for fraud detection.
Alias for screenOrder() method for backward compatibility.
The SDK supports all FraudLabs Pro API parameters:
ip: Customer's IP address
order_id: Merchant transaction IDorder_amount: Order amountorder_currency: ISO 4217 currency code
bill_fname,bill_lname: Customer namebill_email: Email addressbill_phone: Phone numberbill_addr,bill_city,bill_state,bill_country,bill_zip: Address details
ship_fname,ship_lname: Recipient nameship_addr,ship_city,ship_state,ship_country,ship_zip: Shipping address
card_bin: First 6 digits of credit cardcard_hash: Hashed credit card number
The API returns comprehensive fraud analysis including:
fraudlabspro_score: Risk score (0-100)fraudlabspro_status: APPROVE, REVIEW, or REJECTfraudlabspro_rules: Triggered fraud rules- IP geolocation data
- Email and phone validation results
- Credit card BIN information
- Risk indicators (proxy detection, blacklist checks, etc.)
try {
const response = await fraudLabsPro.screenOrder(request);
if (response.success) {
// Handle successful response
console.log("Fraud score:", response.fraudlabspro_score);
} else {
// Handle API errors
console.error("API Error:", response.error);
}
} catch (error) {
// Handle network or other errors
console.error("Request failed:", error);
}This SDK is built with TypeScript and provides complete type definitions for all API parameters and responses. Your IDE will provide full autocomplete and type checking.
MIT © Dmitrii Selikhov