Developer Guide
Get Verification Result
Verify that an OTP sent by the Send SMS Verification API is valid.
Request
GET https://api.fraudlabspro.com/v2/verification/result
Parameter | Type | Description |
---|---|---|
key | string | (required) FraudLabs Pro API key. |
tran_id | string | (required) The unique ID that was returned by the Send Verification SMS API that triggered the OTP sms. |
otp | string | (required) The OTP that was sent to the recipient’s phone. |
format | string |
(optional) Returns the API response in json (default) or xml format. Valid values: json | xml |
Response
Parameter | Type | Description |
---|---|---|
result | string | Indicates if the input parameters matched a valid OTP. Y if a valid OTP is found and N if no valid OTP found. |
Sample Codes
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 FraudLabsPro.FraudLabsPro
Imports Newtonsoft.Json
Module Program
Sub Main()
'Configure FraudLabs Pro API KEY
FraudLabsProConfig.APIKey = "YOUR_API_KEY"
'Get Verification Result API
Dim VerifySMS As New SMSVerification
'Sets SMS details for authentication purpose
Dim SMSPara As New SMSVerificationPara With {
.TransactionID = "UNIQUE_TRANS_ID",
.OTP = "OTP_RECEIVED"
}
Dim result = VerifySMS.VerifySMS(SMSPara)
Console.WriteLine("result: " & result("result").ToString)
End Sub
End Module
using FraudLabsPro.FraudLabsPro;
using System.Collections;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
// Configure FraudLabs Pro API KEY
FraudLabsProConfig.APIKey = "YOUR_API_KEY";
// Get Verification Result API
SMSVerification VerifySMS = new();
// Sets SMS details for authentication purpose
SMSVerificationPara SMSPara = new()
{
TransactionID = "UNIQUE_TRANS_ID",
OTP = "OTP_RECEIVED"
};
JObject result = VerifySMS.VerifySMS(SMSPara);
Console.WriteLine("result: " + result["result"]);
# 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/v2/verification/result?key=Enter_License_Key&format=json&tran_id=Enter_Transaction_ID&otp=Enter_OTP_Received
require 'fraudlabspro_ruby'
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
result = FraudlabsproRuby::Api::SMSVerification.verifySMS(
tran_id: 'UNIQUE_TRANS_ID',
otp: 'OTP_RECEIVED'
)
const {SMSVerification} = require("fraudlabspro-nodejs");
var sms = new SMSVerification('YOUR API KEY');
params = {
tran_id: 'UNIQUE_TRANS_ID',
otp: 'OTP_RECEIVED',
};
sms.verifyOTP(params, (err, data) => {
if (!err) {
console.log(data);
}
});