Developer Guide

Get Verification Result

Verify that an OTP sent by the Send SMS Verification API is valid.

GET https://api.fraudlabspro.com/v1/verification/result

Request
Parameter Description
key (required) FraudLabs Pro API key.
tran_id (required) The unique ID that was returned by the Send Verification SMS API that triggered the OTP sms.
otp (required) The OTP that was sent to the recipient’s phone.
format (optional) Returns the API response in json (default) or xml format.
Valid values: json | xml
Response
Parameter Description
result Indicates if the input parameters matched a valid OTP. Y if a valid OTP is found and N if no valid OTP found.
error Blank if there is no error otherwise it will contain one of the errors below:
FraudLabs Pro plan has expired.
Invalid transaction ID.
Invalid OTP.
API key not found.
Sample Code
require_once 'lib/FraudLabsPro.php';

// Configures FraudLabs Pro API key
FraudLabsPro\Configuration::apiKey('YOUR_API_KEY');

// Get SMS Verification result
FraudLabsPro\SMSVerification::verifysms([
	'tran_id'		=> 'UNIQUE_TRANS_ID',
	'otp'			=> 'OTP_RECEIVED',
]);
import com.fraudlabspro.*;
import java.util.Hashtable;

public class FLP {

    public static void main(String[] args) {
        // Configures FraudLabs Pro API key
        FraudLabsPro.APIKEY = "YOUR_API_KEY";

        // Get Verification Result API
        SMSVerification verification = new SMSVerification();

        // Sets transaction ID and otp details for verification purpose
        Hashtable data = new Hashtable<>();
        data.put("tran_id", "UNIQUE_TRANS_ID");
        data.put("otp", "OTP_RECEIVED");

        String result = verification.verifySMS(data);
    }
}
Imports System.Net
Imports System.IO
Imports System.Uri

Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim request As HttpWebRequest = Nothing
        Dim response As HttpWebResponse = Nothing

        Dim apiKey As String = "Enter_License_Key"
        Dim data As New Dictionary(Of String, String)

        data.Add("format", "json")
        data.Add("tran_id", "Enter_Transaction_ID")
        data.Add("otp", "Enter_OTP")
        Dim datastr As String = String.Join("&", data.[Select](Function(x) x.Key & "=" & EscapeDataString(x.Value)).ToArray())

        request = Net.WebRequest.Create("https://api.fraudlabspro.com/v1/verification/result?key=" & apiKey & "&" & datastr)

        request.Method = "GET"
        response = request.GetResponse()

        Dim reader As System.IO.StreamReader = New IO.StreamReader(response.GetResponseStream())

        Page.Response.Write(reader.ReadToEnd)

    End Sub

End Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Net;
using System.IO;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            WebRequest request = null;
            WebResponse response = null;

            string apiKey = "Enter_License_Key";
            Dictionary<string, string> data = new Dictionary<string, string>();

            data.Add("format", "json");
            data.Add("tran_id", "Enter_Transaction_ID");
            data.Add("otp", "Enter_OTP");
            string datastr = string.Join("&", data.Select(x => x.Key + "=" + System.Uri.EscapeDataString(x.Value)).ToArray());

            request = System.Net.WebRequest.Create("https://api.fraudlabspro.com/v1/verification/result?key=" + apiKey + "&" + datastr);

            request.Method = "GET";
            response = request.GetResponse();

            System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());

            Page.Response.Write(reader.ReadToEnd());
        }
    }
}
 # Import SDK to use the function
from libs.smsverification import SMSVerification

 # Configure your API key
api_key = 'YOUR_API_KEY'

verify_sms_variables = {
	'key': api_key,
	'tran_id': 'UNIQUE_TRANS_ID',
	'otp': 'OTP_RECEIVED',
}
print(SMSVerification.verify_sms(verify_sms_variables))
$ curl https://api.fraudlabspro.com/v1/verification/result -X POST \
	-d "key=Enter_License_Key" \
	-d "format=json" \
	-d "tran_id=Enter_Transaction_ID" \
	-d "otp=Enter_OTP"
require 'fraudlabspro_ruby'

FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'

result = FraudlabsproRuby::Api::SMSVerification.verifySMS(
  tran_id: 'UNIQUE_TRANS_ID',
  otp: 'OTP_RECEIVED'
)