### Install minFraud Client Library for C# Source: https://dev.maxmind.com/minfraud/report-a-transaction Install the minFraud client library for C# using NuGet. ```csharp // Install via NuGet Install-Package MaxMind.MinFraud ``` -------------------------------- ### Install minFraud Client Library for PHP Source: https://dev.maxmind.com/minfraud/report-a-transaction Install the minFraud client library for PHP using Composer. ```php # Install via Composer composer require maxmind/minfraud:~3.0 ``` -------------------------------- ### Install minFraud Client Library for Python Source: https://dev.maxmind.com/minfraud/report-a-transaction Install the minFraud client library for Python using pip. ```python # Install via pip pip install minfraud ``` -------------------------------- ### Install minFraud Client Library for Java Source: https://dev.maxmind.com/minfraud/report-a-transaction Install the minFraud client library for Java using Maven or Gradle. ```xml // Install via Maven, recommended com.maxmind.minfraud minfraud 4.2.0 // Or install via Gradle repositories { mavenCentral() } dependencies { implementation 'com.maxmind.minfraud:minfraud:4.2.0' } ``` -------------------------------- ### Install minFraud Client Library for Node.js Source: https://dev.maxmind.com/minfraud/report-a-transaction Install the minFraud client library for Node.js using npm or yarn. ```javascript // Install via npm npm install @maxmind.com/minfraud-api-node // Or install via yarn yarn add @maxmind.com/minfraud-api-node ``` -------------------------------- ### Install minFraud Client Library for Ruby Source: https://dev.maxmind.com/minfraud/report-a-transaction Install the minFraud client library for Ruby as a gem or add it to your Gemfile. ```ruby # Install as a gem gem install minfraud # Or add this to your Gemfile gem 'minfraud' ``` -------------------------------- ### Install GeoIP2 Client Library for C# Source: https://dev.maxmind.com/geoip/geolocate-an-ip/databases Install the GeoIP2 client library for C# using NuGet. ```csharp // Install via NuGet Install-Package MaxMind.GeoIP2 ``` -------------------------------- ### Install GeoIP2 Client Library for PHP Source: https://dev.maxmind.com/geoip/geolocate-an-ip/databases Install the GeoIP2 client library for PHP using Composer. ```php # Install via Composer composer require geoip2/geoip2:~3.0 ``` -------------------------------- ### Cold Fusion City/ISP/Org Web Service Example Source: https://dev.maxmind.com/geoip/docs/web-services/legacy This Cold Fusion snippet demonstrates how to make a GET request to the City/ISP/Org web service, parse the comma-separated response, and store it in structures for easy access by ID or name. It includes accessing specific fields and dumping the resulting structures. ```Cold Fusion
#qMaxMindByID[3]#
#qMaxMindByName['city']#

``` -------------------------------- ### Example minFraud Output Source: https://dev.maxmind.com/minfraud/minfraud-legacy This is an example of the minFraud service output, showing a few common fields separated by semicolons. ```text riskScore=13.2;distance=6;countryMatch=Yes;countryCode=US;freeMail=Yes ``` -------------------------------- ### Install GeoIP2 Client Library for Java Source: https://dev.maxmind.com/geoip/geolocate-an-ip/databases Install the GeoIP2 client library for Java using Maven or Gradle. ```xml // Install via Maven, recommended com.maxmind.geoip2 geoip2 5.0.2 // Or install via Gradle repositories { mavenCentral() } dependencies { implementation 'com.maxmind.geoip2:geoip2:5.0.2' } ``` -------------------------------- ### Install GeoIP2 Client Library for Python Source: https://dev.maxmind.com/geoip/geolocate-an-ip/databases Install the GeoIP2 client library for Python using pip. ```python # Install via pip pip install geoip2 ``` -------------------------------- ### Install GeoIP2 Client Library for Ruby Source: https://dev.maxmind.com/geoip/geolocate-an-ip/databases Install the GeoIP2 client library for Ruby as a gem or add it to your Gemfile. ```ruby # Install as a gem gem install maxmind-geoip2 # Or add this to your Gemfile gem 'maxmind-geoip2' ``` -------------------------------- ### Install GeoIP2 Client Library for Node.js Source: https://dev.maxmind.com/geoip/geolocate-an-ip/databases Install the GeoIP2 client library for Node.js using npm or yarn. ```javascript // Install via npm npm install @maxmind/geoip2-node // Or install via yarn yarn add @maxmind/geoip2-node ``` -------------------------------- ### Install Device Tracking npm Package Source: https://dev.maxmind.com/minfraud/track-devices/web Install the device tracking module using npm if you are using a JavaScript bundler or build system. ```bash npm install @maxmind/device-tracking ``` -------------------------------- ### Device Object Example Source: https://dev.maxmind.com/minfraud/api-documentation/requests This is an example of the 'device' JSON object. It includes fields like IP address, user agent, session information, and tracking token. ```json { "accept_language": "en-US,en;q=0.8", "ip_address": "2001:db8::ff00:42:8329", "session_age": 3600.5, "session_id": "c2ffa1b7-f5c5-4702-beb2-4254794fe391", "tracking_token": "abc123...", "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36" } ``` -------------------------------- ### minFraud Response Example Source: https://dev.maxmind.com/minfraud/api-documentation/responses This example shows a typical minFraud response body, including address, phone, credit card, and device details. ```json { "warning": "Encountered value at /shipping/city that does not meet the required constraints" } ] } { "billing_address": { "distance_to_ip_location": 100, "is_in_ip_country": true, "is_postal_in_city": true, "latitude": 37.545, "longitude": -122.421 }, "billing_phone": { "country": "US", "is_voip": true, "matches_postal": true, "network_operator": "Verizon/1", "number_type": "fixed" }, "credit_card": { "brand": "Visa", "country": "US", "is_business": true, "is_issued_in_billing_address_country": true, "is_prepaid": true, "is_virtual": true, "issuer": { "matches_provided_name": true, "matches_provided_phone_number": true, "name": "Bank of America", "phone_number": "800-732-9194" }, "type": "credit" }, "device": { "confidence": 99, "id": "7835b099-d385-4e5b-969e-7df26181d73b", "last_seen": "2016-06-08T14:16:38Z", "local_time": "2018-01-02T10:40:11-08:00" }, "email": { "domain": { "classification": "business", "first_seen": "2015-01-20", "risk": 1.23, "visit": { "has_redirect": true, "last_visited_on": "2025-11-15", "status": "live" }, "volume": 6.5 }, "first_seen": "2016-02-03", "is_disposable": false, "is_free": false, "is_high_risk": true }, "shipping_address": { "distance_to_billing_address": 22, "distance_to_ip_location": 15, "is_high_risk": true, "is_in_ip_country": true, "is_postal_in_city": true, "latitude": 37.632, "longitude": -122.313 }, "shipping_phone": { "country": "CA", "is_voip": true, "matches_postal": true, "network_operator": "Telus Mobility-SVR/2", "number_type": "mobile" } } ``` -------------------------------- ### Example minFraud Legacy Sandbox Request Source: https://dev.maxmind.com/minfraud/minfraud-legacy This example request uses an approved test IP address to simulate a minFraud Legacy transaction on the Sandbox. It is designed to return a valid response with a proxyScore between 2 and 4, without warnings or errors. ```http https://sandbox.maxmind.com/minfraud/v1.0/legacy?i=128.101.101.101&license_key=&country=US ``` -------------------------------- ### VBScript Client for MaxMind Proxy Detection Source: https://dev.maxmind.com/minfraud/proxy-detection A VBScript example for querying the MaxMind Proxy Detection API. It uses ServerXMLHTTP to make a GET request and writes the response text to the output. ```vbscript Dim objHttp, strQuery strQuery = "https://minfraud.maxmind.com/app/ipauth_http?l=" & license_key & _ "&i=" & ipaddress set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") objHttp.open "GET", strQuery, false objHttp.send Response.Write objHttp.ResponseText Set objHttp = Nothing ``` -------------------------------- ### Command Line Example Using curl Source: https://dev.maxmind.com/minfraud/working-with-transaction-dispositions Use curl to make a GET request to the Dispositions API. Replace placeholders with your MaxMind account ID and license key. Ensure you are using HTTPS. ```bash curl -u "{account_id}:{license_key}" \ https://minfraud.maxmind.com/minfraud/disposition/v1.0/updates\?updates_after\=2021-03-15T09:00:00.00000Z ``` -------------------------------- ### Sample minFraud Alert Webhook Request Source: https://dev.maxmind.com/minfraud/alerts This is an example of a GET request sent to your configured webhook URL when a minFraud Alert is triggered. It includes various parameters detailing the transaction and the reason for the alert. ```http http://yourdomain/yoururl?i=24.24.24.24&maxmindID=1234ABCD&domain=sample.com&city=Anytown®ion=CA&country=US&date=Jan.+1,+1970&txnID=foo123&reason=IP+address+has+been+marked+as+a+high-risk+IP&reason_code=HIGH_RISK_IP&minfraud_id=2afb0d26-e3b4-4624-8e66-fd10e64b95df&shop_id=shop321 ``` -------------------------------- ### Full MinFraud Transaction Evaluation Example (Ruby) Source: https://dev.maxmind.com/minfraud/evaluate-a-transaction This comprehensive example demonstrates how to configure the Minfraud client, prepare a detailed transaction request including device, event, account, billing, shipping, payment, credit card, order, shopping cart, and custom input data. It then shows how to retrieve and process the Factors, Insights, and Score response models, including iterating through warnings and risk score reasons. ```ruby require 'minfraud' # Configure the client. Minfraud.configure do |c| c.account_id = 10 c.license_key = 'LICENSEKEY' c.enable_validation = true end # Prepare the request. assessment = Minfraud::Assessments.new( device: { ip_address: '1.1.1.1', accept_language: 'en-US,en;q=0.8', session_age: 3600.5, session_id: 'foo', user_agent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36', }, event: { transaction_id: 'txn3134133', shop_id: 's2123', time: '2012-04-12T23:20:50+00:00', type: :purchase, }, account: { user_id: '3132', username_md5: '4f9726678c438914fa04bdb8c1a24088', }, email: { address: 'test@maxmind.com', domain: 'maxmind.com', }, billing: { first_name: 'First', last_name: 'Last', company: 'Company, Inc.', address: '1 Billing Address St.', address_2: 'Unit 1', city: 'Waltham', region: 'MA', country: 'US', postal: '02451', phone_number: '555-555-5555', phone_country_code: '1', }, shipping: { first_name: 'First', last_name: 'Last', company: 'Company, Inc.', address: '1 Shipping Address St.', address_2: 'Unit 1', city: 'Waltham', region: 'MA', country: 'US', postal: '02451', phone_number: '555-555-5555', phone_country_code: '1', delivery_speed: :same_day, }, payment: { processor: :stripe, was_authorized: false, decline_code: 'invalid number', }, credit_card: { issuer_id_number: '411111', last_digits: '1234', bank_name: 'Test Bank', bank_phone_country_code: '1', bank_phone_number: '555-555-5555', token: 'abcd', avs_result: 'Y', cvv_result: 'N', }, order: { amount: 323.21, currency: 'USD', discount_code: 'FIRST', is_gift: true, has_gift_message: true, affiliate_id: 'af12', subaffiliate_id: 'saf42', referrer_uri: 'http://www.amazon.com/', }, shopping_cart: [ { category: 'pets', item_id: 'leash-0231', quantity: 2, price: 20.43, }, { category: 'beauty', item_id: 'msc-1232', quantity: 1, price: 100.00, }, ], custom_inputs: { section: 'news', previous_purchases: 19, discount: 3.2, previous_user: true, }, ) # To get the Factors response model, use #factors. factors_model = assessment.factors.body factors_model.warnings.each { |w| puts w.warning } factors_model.risk_score_reasons.each do |risk_score_reason| p risk_score_reason.multiplier risk_score_reason.reasons.each do |reason| p "#{reason.code}: #{reason.reason}" end end p factors_model.risk_score # To get the Insights response model, use #insights. insights_model = assessment.insights.body insights_model.warnings.each { |w| puts w.warning } p insights_model.credit_card.issuer.name p insights_model.risk_score # To get the Score response model, use #score. score_model = assessment.score.body score_model.warnings.each { |w| puts w.warning } p score_model.risk_score ``` -------------------------------- ### ASP City/ISP/Org Web Service Example Source: https://dev.maxmind.com/geoip/docs/web-services/legacy This ASP snippet shows how to make a GET request to the City/ISP/Org web service using ServerXMLHTTP and display the raw response text. Ensure you have a valid license key and IP address. ```ASP Dim objHttp, strQuery strQuery = "https://geoip.maxmind.com/v1.0/city-isp-org?l=" & license_key & "&i=" & ipaddress set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") objHttp.open "GET", strQuery, false objHttp.send Response.Write objHttp.ResponseText Set objHttp = Nothing ``` -------------------------------- ### Check GeoIP Update Installation Path Source: https://dev.maxmind.com/geoip/upgrading-geoip-update If installed via 'make install', use this command to find the current installation path of the geoipupdate executable. This helps in managing installations and avoiding conflicts. ```bash which geoipupdate > /usr/bin/geoipupdate ``` -------------------------------- ### Create minFraud Client Object (PHP) Source: https://dev.maxmind.com/minfraud/evaluate-a-transaction Instantiate the MinFraud client with your account ID and license key. ```php $accountId = 10; $licenseKey = 'LICENSEKEY'; $client = new MinFraud($accountId, $licenseKey); ``` -------------------------------- ### Create minFraud Client Object (Python) Source: https://dev.maxmind.com/minfraud/evaluate-a-transaction Create a synchronous or asynchronous minFraud client instance using your account ID and license key. ```python from minfraud import Client, AsyncClient account_id = 10 license_key = 'LICENSEKEY' # If you want to use synchronous requests client = Client(account_id, license_key) # Or if you want to use asynchronous requests async_client = AsyncClient(account_id, license_key) ``` -------------------------------- ### Create minFraud Client Object (Node.js) Source: https://dev.maxmind.com/minfraud/evaluate-a-transaction Initialize a minFraud client with your account ID and license key for making API requests. ```javascript import * as minFraud from '@maxmind/minfraud-api-node'; const accountId = '10'; const licenseKey = 'LICENSEKEY'; const client = new minFraud.Client(accountId, licenseKey); ``` -------------------------------- ### Configure minFraud Client (Ruby) Source: https://dev.maxmind.com/minfraud/evaluate-a-transaction Configure the minFraud client with your account ID, license key, and enable validation. ```ruby Minfraud.configure do |c| c.account_id = 10 c.license_key = 'LICENSEKEY' c.enable_validation = true end ``` -------------------------------- ### Evaluate Transaction C# Example Source: https://dev.maxmind.com/minfraud/evaluate-a-transaction This C# example demonstrates how to build a comprehensive transaction object, including device, event, account, email, billing, shipping, payment, credit card, order, shopping cart, and custom inputs. It then uses the WebServiceClient to send this transaction data to the MinFraud API for scoring. Ensure you replace placeholder credentials with your actual account ID and license key. Sharing a single WebServiceClient instance across multiple requests is recommended for connection reuse. ```csharp using MaxMind.MinFraud; using MaxMind.MinFraud.Request; using System; using System.Collections.Generic; using System.Net; using System.Threading.Tasks; public class MinFraudExample { static void Main() { MinFraudAsync().Wait(); } static public async Task MinFraudAsync() { var transaction = new Transaction { Device = new Device { IPAddress = IPAddress.Parse("1.1.1.1"), UserAgent = "Mozilla/5.0 (X11; Linux x86_64)", AcceptLanguage = "en-US,en;q=0.8", SessionAge = 3600, SessionId = "a333a4e127f880d8820e56a66f40717c" }, Event = new Event { TransactionId = "txn3134133", ShopId = "s2123", Time = new DateTimeOffset(2014, 4, 12, 23, 20, 50, 52, new TimeSpan(0)), Type = EventType.Purchase }, Account = new Account { UserId = "3132", Username = "fred" }, Email = new Email { Address = "test@maxmind.com", Domain = "maxmind.com" }, Billing = new Billing { FirstName = "First", LastName = "Last", Company = "Company, Inc.", Address = "1 Billing Address St.", Address2 = "Unit 1", City = "Waltham", Region = "MA", Country = "US", Postal = "02451", PhoneNumber = "555-555-5555", PhoneCountryCode = "1" }, Shipping = new Shipping { FirstName = "First", LastName = "Last", Company = "Company Inc.", Address = "1 Shipping Address St.", Address2 = "Unit 1", City = "Waltham", Region = "MA", Country = "US", Postal = "02451", PhoneNumber = "555-555-5555", PhoneCountryCode = "1", DeliverySpeed = ShippingDeliverySpeed.SameDay }, Payment = new Payment { Processor = PaymentProcessor.Stripe, WasAuthorized = false, DeclineCode = "invalid number" }, CreditCard = new CreditCard { IssuerIdNumber = "411111", BankName = "Test Bank", BankPhoneCountryCode = "1", BankPhoneNumber = "555-555-5555", AvsResult = 'Y', CvvResult = 'N', LastDigits = "1234", Token = "123456abc1234" }, Order = new Order { Amount = 323.21m, Currency = "USD", DiscountCode = "FIRST", AffiliateId = "af12", SubaffiliateId = "saf42", ReferrerUri = new Uri("http://www.amazon.com/"), IsGift = true, HasGiftMessage = true }, ShoppingCart = new List { new ShoppingCartItem { Category = "pets", ItemId = "ad23232", Quantity = 2, Price = 20.43m }, new ShoppingCartItem { Category = "beauty", ItemId = "bst112", Quantity = 1, Price = 100.00m } }, CustomInputs = new CustomInputs.Builder { { "float_input", 12.1d}, { "integer_input", 3123}, { "string_input", "This is a string input."}, { "boolean_input", true}, }.Build() }; // If you are making multiple requests, a single WebServiceClient // should be shared across requests to allow connection reuse. // The // class is thread safe. // // Replace "6" with your account ID and "ABCD567890" with your license // key. using (var client = new WebServiceClient(6, "ABCD567890")) { // Use `InsightsAsync` if querying Insights; `FactorsAsync` if querying Factors var score = await client.ScoreAsync(transaction); Console.WriteLine(score); } } } ``` -------------------------------- ### VB.Net City/ISP/Org Web Service Example Source: https://dev.maxmind.com/geoip/docs/web-services/legacy This VB.Net example fetches City, ISP, and Organization data using the legacy web service. It includes basic error handling and resource cleanup. Replace 'YOUR_LICENSE_KEY' with your valid license key. ```VB.Net ' Contributed by Rubens A. Lucca Private Function ReturnData(ByVal IP As String) As String Dim objUrl As New System.Uri("https://geoip.maxmind.com/v1.0/city-isp-org?l=YOUR_LICENSE_KEY&i=" & IP) Dim objWebReq As System.Net.WebRequest Dim objResp As System.Net.WebResponse Dim sReader As System.IO.StreamReader Dim strReturn As String 'Try to connect to the server and retrieve data. Try objWebReq = System.Net.WebRequest.Create(objUrl) objResp = objWebReq.GetResponse 'Get the data and store in a return string. sReader = New System.IO.StreamReader(objResp.GetResponseStream) strReturn = sReader.ReadToEnd 'Close the objects. sReader.Close() objResp.Close() Catch ex As Exception Finally objWebReq = Nothing End Try Return strReturn End Function ```