<?php
// Inside your callback page (e.g. verify_done.php):
$token = $_GET['token'] ?? '';
if (!empty($token)) {
$ch = curl_init("https://api.runotp.com/v1/flash/verify");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json", "x-api-secret: YOUR_API_SECRET"],
CURLOPT_POSTFIELDS => json_encode(["token" => $token])
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!empty($data['verified']) && $data['verified'] === true) {
$verifiedPhone = $data['phone']; // e.g. 2010xxxxxxxx
$clientRef = $data['client_ref']; // Your ORDER_OR_USER_ID
// Success! Token is burned atomically. Activate user in DB.
}
}
// Inside your Express / Next.js callback route:
const token = req.query.token;
if (token) {
const res = await fetch("https://api.runotp.com/v1/flash/verify", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-secret": "YOUR_API_SECRET"
},
body: JSON.stringify({ token })
});
const data = await res.json();
if (data.verified === true) {
const { phone, client_ref } = data;
// Success! Token is burned atomically. Log user in.
}
}
import requests
# Inside your callback route (Flask / Django / FastAPI):
token = request.args.get("token")
if token:
res = requests.post(
"https://api.runotp.com/v1/flash/verify",
headers={"x-api-secret": "YOUR_API_SECRET"},
json={"token": token},
timeout=10
)
data = res.json()
if data.get("verified") is True:
verified_phone = data["phone"]
client_ref = data["client_ref"]
# Success! Token is burned. Activate user.
use Illuminate\Support\Facades\Http;
// Route::get('/verify-done', function (Request $request) { ... });
$data = Http::withHeaders([
'x-api-secret' => 'YOUR_API_SECRET'
])->post('https://api.runotp.com/v1/flash/verify', [
'token' => $request->query('token')
])->json();
if (($data['verified'] ?? false) === true) {
// $data['phone'], $data['client_ref'] -> Mark order/user verified!
}
using System.Net.Http;
using System.Text;
using System.Text.Json;
// Inside your ASP.NET Core / MVC callback action:
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-secret", "YOUR_API_SECRET");
var payload = new StringContent(JsonSerializer.Serialize(new { token }), Encoding.UTF8, "application/json");
var resp = await client.PostAsync("https://api.runotp.com/v1/flash/verify", payload);
var json = await resp.Content.ReadAsStringAsync();
using var doc = JsonDocument.Parse(json);
if (doc.RootElement.GetProperty("verified").GetBoolean()) {
string phone = doc.RootElement.GetProperty("phone").GetString();
string clientRef = doc.RootElement.GetProperty("client_ref").GetString();
}
' Inside Page_Load of your callback page (e.g. Success.aspx.vb):
Dim token As String = Request.QueryString("token")
If Not String.IsNullOrEmpty(token) Then
Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls12
Using wc As New Net.WebClient()
wc.Encoding = Text.Encoding.UTF8
wc.Headers.Add("Content-Type", "application/json")
wc.Headers.Add("x-api-secret", "YOUR_API_SECRET")
Dim ser As New Web.Script.Serialization.JavaScriptSerializer()
Dim bodyJson As String = ser.Serialize(New With {.token = token})
Dim json As String = wc.UploadString("https://api.runotp.com/v1/flash/verify", bodyJson)
Dim data = ser.Deserialize(Of Dictionary(Of String, Object))(json)
If data IsNot Nothing AndAlso Convert.ToBoolean(data("verified")) Then
Dim verifiedPhone As String = Convert.ToString(data("phone"))
Dim clientRef As String = Convert.ToString(data("client_ref"))
End If
End Using
End If
curl -X POST "https://api.runotp.com/v1/flash/verify" \
-H "Content-Type: application/json" \
-H "x-api-secret: YOUR_API_SECRET" \
-d '{"token":"PASTE_RETURNED_TOKEN"}'