import { postToVerify } from "./postToVerify";
async function startVerify() {
const r = await fetch("/verify/start", {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "include",
body: JSON.stringify({
action: "payment", // your own value — login, phone-change, approval, …
params: { paymentId: 8842 }, // whatever that action needs
destination: "0501234567",
}),
});
const data = await r.json();
if (!data.verifyUrl || !data.handoff) throw new Error("no handoff");
postToVerify(data.verifyUrl, data.handoff); // optional: { lang: "ar" }
}