/ Published in: VB.NET
Checking customer's IP address if is match with billing address is one of the simple steps in order to prevent fraud. If you are looking for sample codes to validate that the transaction is being requested by the real cardholder, see below.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Imports IP2Location Private Sub Query(ByVal strIPAddress As String, billingCountry As String) Dim oIPResult As New IP2Location.IPResult Try If strIPAddress <> "" Then IP2Location.Component.IPDatabasePath = "C:\\Program Files\\IP2Location\\Database\\IP-COUNTRY.SAMPLE.BIN" oIPResult = IP2Location.Component.IPQuery(strIPAddress) Select Case oIPResult.Status Case "OK" If oIPResult.CountryShort = billingCountry Then ' buyer is from the same country by IP address Else ' buyer is from the different country by IP address End If Case "EMPTY_IP_ADDRESS" Response.Write("IP Address cannot be blank.") Case "INVALID_IP_ADDRESS" Response.Write("Invalid IP Address.") Case "MISSING_FILE" Response.Write("Invalid Database Path.") End Select Else Response.Write("IP Address cannot be blank.") End If Catch ex As Exception Response.Write(ex.Message) Finally oIPResult = Nothing End Try End Sub