Analyze users with Address Verification scoring through a real-time API call. Instantly detect invalid addresses, misformatted user data and typos, and physical addresses that have recently been reported for fraudulent behavior. Physical Address Verification makes verifying users and validating personal user information easy.
- Proxy & VPN Detection API
- Email Verification API
- Phone Number Validation API
- Device Fingerprint API
- Malicious URL Scanner API
- Mobile Device Fingerprinting SDK
- Gaming Fraud Detection SDK
- Dark Web Leak API
- Malware File Scanner API
- Request List API
- Fraud Reporting API
- Account Management APIs
- Bulk Validation CSV API
- Allowlist & Blocklist APIs
- Plugins Platforms & Integrations
- IP Reputation Database
- Email Verification Database
- Custom Integrations
- Country List API
Address Validation
Verify Postal Addresses by API Lookup
Address Validation Example API Request
The example below incorporates scoring a physical address with an IP address. We recommend passing all available billing and shipping variables.
You should pass the user's primary information into the "billing" variables even if a transaction is not taking place. Additional user data can be passed with this request.
Key | Expected Values | Description |
billing_address_1 | String | User's billing or primary street address part 1. |
billing_address_2 | String | User's billing or primary street address part 2. |
billing_city | String | User's billing or primary city. |
billing_region | String | User's billing or primary region or state. |
billing_postcode | String / Number | User's billing or primary postcode or zipcode. |
billing_country | String | User's billing or primary country name or billing country ISO-Alpha2. (EG: United States or US) |
shipping_address_1 | String | User's billing or primary street address part 1. |
shipping_address_2 | String | User's billing or primary street address part 2. |
shipping_city | String | User's billing or primary city. |
shipping_region | String | User's billing or primary region or state. |
shipping_postcode | String / Number | User's billing or primary postcode or zipcode. |
shipping_country | String | User's billing or primary country name or shipping country ISO-Alpha2. (EG: United States or US) |
EXAMPLE CODE
xxxxxxxxxx
1
// Your API Key.
2
$key = 'YOUR_API_KEY_HERE';
3
4
/*
5
* Retrieve the user's IP address.
6
* You could also pull this from another source such as a database.
7
*
8
* If you use cloudflare change REMOTE_ADDR to HTTP_CF_CONNECTING_IP
9
*/
10
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_CLIENT_IP'];
11
12
13
// Retrieve additional (optional) data points which help us enhance fraud scores.
14
$user_agent = $_SERVER['HTTP_USER_AGENT'];
15
$user_language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
16
17
// Set the strictness for this query. (0 (least strict) - 3 (most strict))
18
$strictness = 0;
19
20
// You may want to allow public access points like coffee shops, schools, corporations, etc...
21
$allow_public_access_points = 'true';
22
23
// Create parameters array.
24
$parameters = array(
25
'user_agent' => $user_agent,
26
'user_language' => $user_language,
27
'strictness' => $strictness,
28
'allow_public_access_points' => $allow_public_access_points
29
);
30
31
/* User & Transaction Scoring
32
* Score additional information from a user, order, or transaction for risk analysis
33
* All transaction parameters are optional, please remove any that are not used
34
* Non paid actions such as lead generation and user scoring can be substituted into the "billing" or "shipping" variables
35
* This feature requires a Premium plan or greater
36
* Premium users can also adjust transaction scoring rules: https://www.ipqualityscore.com/user/transaction/weights
37
*/
38
39
// All variables are optional - the primary address should be scored in the "billing" variables
40
$transaction_parameters = array(
41
'billing_address_1' => '',
42
'billing_address_2' => '',
43
'billing_city' => '',
44
'billing_state' => '',
45
'billing_zipcode' => '',
46
'billing_country' => '',
47
'shipping_address_1' => '',
48
'shipping_address_2' => '',
49
'shipping_city' => '',
50
'shipping_state' => '',
51
'shipping_zipcode' => '',
52
'shipping_country' => ''
53
);
54
55
// Format Parameters
56
if(is_array($transaction_parameters)){
57
$formatted_parameters = http_build_query(array_merge($parameters, $transaction_parameters));
58
} else {
59
$formatted_parameters = http_build_query($parameters);
60
}
61
62
// Create API URL
63
$url = sprintf(
64
'https://www.ipqualityscore.com/api/json/ip/%s/%s?%s',
65
$key,
66
$ip,
67
$formatted_parameters
68
);
69
70
// Fetch The Result
71
$timeout = 5;
72
73
$curl = curl_init();
74
curl_setopt($curl, CURLOPT_URL, $url);
75
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
76
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
77
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
78
79
$json = curl_exec($curl);
80
curl_close($curl);
81
82
// Decode the result into an array.
83
$result = json_decode($json, true);
84
85
// Check to see if our query was successful.
86
if(isset($result['success']) && $result['success'] === true){
87
// NOTICE: If you want to use one of the examples below, remove
88
// any lines containing /*, */ and *-, then remove * from any of the
89
// the remaining lines.
90
91
/*
92
*- Address Verification Example 1: We'd like to block users with an invalid physical address or address that was recently used for a fraudulent action
93
*
94
* if($result['transaction_details']['valid_billing_address'] === false || $result['transaction_details']['valid_shipping_address'] === false){
95
* exit(header("Location: https://google.com"));
96
* }
97
*/
98
99
/*
100
*- Address Verification Scoring Example 2: We'd like to block users with any occurrence of high risk behavior or an overall Fraud Score >= 90
101
*
102
* if($result['fraud_score'] >= 90 || $result['transaction_details']['fraudulent_behavior'] === true){
103
* exit(header("Location: https://google.com"));
104
* }
105
*/
106
107
/*
108
*- Address Verification Example 3: We'd like to block users with an overall Fraud Score >= 90, users with VPN connections, or users with an invalid or abusive physical address
109
*
110
* if($result['fraud_score'] >= 90 || $result['vpn'] === true || $result['transaction_details']['valid_billing_address'] === false || $result['transaction_details']['valid_shipping_address'] === false){
111
* exit(header("Location: https://google.com"));
112
* }
113
*/
114
115
/*
116
* If you are confused with these examples or simply have a use case
117
* not covered here, please feel free to contact IPQualityScore's support
118
* team. We'll craft a custom piece of code to meet your requirements.
119
*/
120
}