Developer Guide

Get Verification Result

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


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
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
$apiKey = 'Enter_License_Key';
$params['format']      = 'json';
$params['tran_id']     = 'Enter_Transaction_ID';
$params['otp']         = 'Enter_OTP';

$query = '';

foreach($params as $key=>$value){
	$query .= '&' . $key . '=' . rawurlencode($value);

//For https request, please make sure you have enabled php_openssl.dll extension.
//How to enable https
//- Uncomment ;extension=php_openssl.dll by removing the semicolon in your php.ini, and restart the apache.
//In case you have difficulty to modify the php.ini, you can always make the http request instead of https.
$result = file_get_contents('' . $apiKey . $query);

$data = json_decode($result);

import java.util.Hashtable;
import java.util.Map;

public class test {
    public static void main(String[] args) {
        try {
            String key = "Enter_License_Key";
            Hashtable<String, String> data = new Hashtable<String, String>();
            data.put("format", "json");
            data.put("tran_id", "Enter_Transaction_ID");
            data.put("otp", "Enter_OTP");

            String datastr = "";
            for (Map.Entry<String,String> entry : data.entrySet()) {
                datastr += "&" + entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), "UTF-8");
            URL url = new URL("" + key + datastr);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestProperty("Accept", "application/json");

            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());

            BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

            String output;

            while ((output = br.readLine()) != null) {
        catch (MalformedURLException e) {
        catch (IOException e) {
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("" & apiKey & "&" & datastr)

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

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


    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("" + apiKey + "&" + datastr);

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

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

import httplib
import urllib
import hashlib

p = { 'key': 'Enter_License_Key', 'format': 'json', 'tran_id': 'Enter_Transaction_ID', 'otp': 'Enter_OTP' }

conn = httplib.HTTPConnection("")
conn.request("GET", "/v1/verification/result?" + urllib.urlencode(p))
res = conn.getresponse()