### Run Magento Setup Upgrade Command Source: https://www.fraudlabspro.com/resources/tutorials/how-to-install-fraudlabs-pro-sms-verification-plugin-on-magento-2 Execute this command in your Magento root directory after manually installing the plugin files to apply upgrades. ```bash php bin/magento setup:upgrade ``` -------------------------------- ### Install FraudLabs Pro Go SDK Source: https://www.fraudlabspro.com/resources/tutorials/introducing-the-fraudlabs-pro-go-sdk Use this command to install the FraudLabs Pro Go SDK into your project. ```bash go get github.com/fraudlabspro/fraudlabspro-go ``` -------------------------------- ### Screen Order API v2 Request Example (cURL) Source: https://www.fraudlabspro.com/resources/tutorials/how-to-migrate-fraudlabs-pro-screen-api-from-v1-to-v2 Use POST requests with data parameters for the v2 Screen Order API. Ensure all parameters are sent in the request body, not as GET parameters. ```bash $ 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" ``` -------------------------------- ### Feedback Order API v2 Request Example (cURL) Source: https://www.fraudlabspro.com/resources/tutorials/how-to-migrate-fraudlabs-pro-screen-api-from-v1-to-v2 Use POST requests with data parameters for the v2 Feedback Order API. Ensure all parameters are sent in the request body, not as GET parameters. ```bash $ 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" ``` -------------------------------- ### Run Go Application Source: https://www.fraudlabspro.com/resources/tutorials/introducing-the-fraudlabs-pro-go-sdk Execute your Go application to get the validation result from FraudLabs Pro. ```bash go run . ``` -------------------------------- ### Get Verification Result API v2 Response Example Source: https://www.fraudlabspro.com/resources/tutorials/how-to-migrate-fraudlabs-pro-screen-api-from-v1-to-v2 Example of the JSON response format for the Get Verification Result API v2. ```json { "result": "Y" } ``` -------------------------------- ### Send SMS Verification API v2 CURL Example Source: https://www.fraudlabspro.com/resources/tutorials/how-to-migrate-fraudlabs-pro-screen-api-from-v1-to-v2 Example of using CURL to send an SMS verification request to the v2 API. Note the change from GET to POST method and the use of -d for data parameters. ```bash $ 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 " -d "country_code=US" -d "otp_timeout=3600" ``` -------------------------------- ### Validate an Order with FraudLabs Pro Go SDK Source: https://www.fraudlabspro.com/resources/tutorials/introducing-the-fraudlabs-pro-go-sdk This Go code snippet demonstrates how to initialize the SDK, set up order parameters, and perform fraud validation using the FraudLabs Pro API. Replace 'YOUR_API_KEY' with your actual API key. Ensure all required parameters like IP, order details, and customer information are provided. ```go package main import ( "github.com/fraudlabspro/fraudlabspro-go/fraudlabspro" "fmt" ) func main() { apikey := "YOUR_API_KEY" config, err := fraudlabspro.OpenConfiguration(apikey) if err != nil { fmt.Print(err) return } flp, err := fraudlabspro.OpenOrder(config) if err != nil { fmt.Print(err) return } params := make(map[string]string) params["ip"] = "146.112.62.105" params["user_order_id"] = "67398" params["currency"] = "USD" params["amount"] = "79.89" params["quantity"] = "1" params["payment_gateway"] = "Gateway To Bliss" params["payment_mode"] = fraudlabspro.PaymentMethodCreditCard params["number"] = "4556553172971283" params["first_name"] = "Hector" params["last_name"] = "Henderson" params["email"] = "hh5566@gmail.com" params["user_phone"] = "561-628-8674" params["bill_addr"] = "1766 Powder House Road" params["bill_city"] = "West Palm Beach" params["bill_state"] = "FL" params["bill_zip_code"] = "33401" params["bill_country"] = "US" params["ship_first_name"] = "Hector" params["ship_last_name"] = "Henderson" params["ship__addr"] = "4469 Chestnut Street" params["ship_city"] = "Tampa" params["ship_state"] = "FL" params["ship_zip_code"] = "33602" params["ship_country"] = "US" res, err := flp.Validate(params) fmt.Printf("%+vn", res) } ``` -------------------------------- ### Configure FraudLabs Pro API Key in Bagisto Source: https://www.fraudlabspro.com/resources/tutorials/how-to-use-fraudlabs-pro-api-to-validate-order-in-bagisto Add your FraudLabs Pro API key to the `.env` file and configure the `config/services.php` file to use this key. This step is crucial for authenticating with the FraudLabs Pro API. ```php 'fraudlabspro' => [ 'key' => env('FRAUDLABSPRO_API_KEY'), ], ``` -------------------------------- ### Screen Order API v2 Migration Source: https://www.fraudlabspro.com/resources/tutorials/how-to-migrate-fraudlabs-pro-screen-api-from-v1-to-v2 This section details the changes required to migrate from the v1 Screen Order API to v2. It covers updating the API endpoint and changing the request method from GET to POST, along with providing a cURL example for the new POST request. ```APIDOC ## Screen Order API v2 Migration ### Description This endpoint is used to screen an order for potential fraud. ### Method POST ### Endpoint https://api.fraudlabspro.com/v2/order/screen ### Parameters #### Request Body - **key** (string) - Required - Your FraudLabs Pro API key. - **format** (string) - Optional - The desired response format (e.g., json). - **ip** (string) - Required - The IP address of the customer. - **bill_city** (string) - Optional - The billing city of the customer. - **bill_state** (string) - Optional - The billing state or province of the customer. - **bill_zip_code** (string) - Optional - The billing postal code of the customer. - **bill_country** (string) - Optional - The billing country of the customer (ISO 3166-1 alpha-2 format). - **ship_addr** (string) - Optional - The shipping street address. - **ship_city** (string) - Optional - The shipping city. - **ship_state** (string) - Optional - The shipping state or province. - **ship_zip_code** (string) - Optional - The shipping postal code. - **ship_country** (string) - Optional - The shipping country (ISO 3166-1 alpha-2 format). - **user_phone** (string) - Optional - The customer's phone number. - **bin_no** (string) - Optional - The first 6 digits of the credit card number. - **user_order_id** (string) - Optional - Your internal order ID. - **amount** (string) - Optional - The total amount of the order. - **quantity** (string) - Optional - The total quantity of items in the order. - **payment_mode** (string) - Optional - The payment method used (e.g., creditcard). ### Request Example ```bash 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" ``` ### Response #### Success Response (200) - **ip_geolocation** (object) - Information about the IP address geolocation. - **billing_address** (object) - Information about the billing address. - **shipping_address** (object) - Information about the shipping address. - **email_address** (object) - Information about the email address. - **phone_number** (object) - Information about the phone number. - **username** (object) - Information about the username. - **credit_card** (object) - Information about the credit card. - **device** (object) - Information about the device. - **user_order_id** (string) - The user-provided order ID. - **fraudlabspro_id** (string) - The unique ID generated by FraudLabs Pro for this transaction. - **fraudlabspro_score** (integer) - The fraud score assigned to the transaction. - **fraudlabspro_status** (string) - The status of the transaction (e.g., REVIEW, REJECT, APPROVE). - **fraudlabspro_rules** (array) - A list of rules that were triggered. - **api_version** (string) - The version of the API used. - **remaining_credits** (integer) - The number of remaining credits on the account. #### Response Example ```json { "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 } ``` ``` -------------------------------- ### Generate Bagisto Event Listeners Source: https://www.fraudlabspro.com/resources/tutorials/how-to-use-fraudlabs-pro-api-to-validate-order-in-bagisto Run these Artisan commands in your Bagisto project to create the necessary listener files for order validation and status updates. ```bash php artisan make:listener ValidateOrder php artisan make:listener UpdateOrderStatus ``` -------------------------------- ### Validate an Order with FraudLabs Pro SDK Source: https://www.fraudlabspro.com/resources/tutorials/introducing-the-fraudlabs-pro-rust-sdk This example sends an order validation request to FraudLabs Pro and prints the fraud analysis report in JSON format. Ensure you have the SDK configured with your API key. ```rust { "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 } ``` -------------------------------- ### Send SMS Verification API v2 Response Example Source: https://www.fraudlabspro.com/resources/tutorials/how-to-migrate-fraudlabs-pro-screen-api-from-v1-to-v2 Example of the JSON response format for the Send SMS Verification API v2. ```json { "tran_id": "AAAAAAAAAA0000000000", "credits_remaining": "99" } ``` -------------------------------- ### Order Results API v2 Response Example Source: https://www.fraudlabspro.com/resources/tutorials/how-to-migrate-fraudlabs-pro-screen-api-from-v1-to-v2 This is an example of the new JSON object-based response format for the Order Results API v2. ```json { "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 } ``` -------------------------------- ### Update Get Verification Result API Endpoint Source: https://www.fraudlabspro.com/resources/tutorials/how-to-migrate-fraudlabs-pro-screen-api-from-v1-to-v2 Change the API endpoint from v1 to v2 for retrieving SMS verification results. The GET method remains the same. ```text https://api.fraudlabspro.com/v1/verification/result ``` ```text https://api.fraudlabspro.com/v2/verification/result ```