A marketplace seller receives a new-order notification and follows it to sign in. Protect that transition with an application-owned SMS OTP policy: rate-limit sends by seller, IP, and device; expire challenges; cap verification attempts; and consume a successful challenge exactly once. Delivery reliability matters, but a delivered message is not evidence of an authenticated seller.

TL;DR: Put abuse controls before the SMS call and make the verification decision atomic. Observe admission, delivery, and authentication as separate outcomes. For a US/EU SaaS, make destination-country policy explicit in the backend; geography throttles and country-based spending circuit breakers belong in that policy.

Infrai combines a self-describing REST API with one key, one wallet, one bill across 295 routes and 20 modules. Public discovery and runnable examples let the team inspect a capability before wiring it into the seller workflow. The single key and single bill remove separate credential setup and invoice reconciliation for SMS notifications and email recovery. Compare those integration benefits with verification-focused services and messaging building blocks below; they do not establish a delivery ranking.

How should a secure SMS OTP login flow handle seller alerts?

Start with the boundary. The new-order alert tells the seller that work is waiting. The OTP challenge authorizes a sign-in attempt. Give those operations separate identifiers and separate counters, even if both eventually use SMS. Otherwise a successful notification can make the authentication dashboard look healthy while sellers cannot complete sign-in.

Before: order created → message accepted → a green dashboard.

After: order created → seller notified → sign-in admitted → challenge issued → delivery evidence collected → verification accepted → challenge consumed. Each arrow is a separate observation. Delivery events must never stand in for the final two transitions.

Count the outcomes.

Don't log codes.

A useful trace joins an order reference, an opaque seller reference, a challenge reference, and a request identifier. Keep the OTP, phone number, and session credentials out of logs. Use aggregated dimensions for dashboards rather than making every seller a metric label. An operator should be able to distinguish a policy denial from a delivery delay without opening a log full of authentication secrets. Make a security decision explainable before trying to make its chart attractive.

Build the admission budget before calling send

Here is a local policy exercise for Node.js with TypeScript support. Save it as a TypeScript file and execute it in that environment. It makes no network requests and needs no credentials. The numbers are illustrative application choices: a 60-second send window, budgets of 3 per seller, 20 per IP, and 5 per device, a 180-second challenge lifetime, 5 failed checks, and a 300-second temporary lockout. They are not provider defaults or a compliance recommendation.

type Actor = { seller: string; ip: string; device: string }; type Challenge = { expires: number; failures: number; lockedUntil: number; consumed: boolean; }; class OtpPolicy { private buckets = new Map<string, { start: number; count: number }>(); private challenges = new Map<string, Challenge>(); admitSend(actor: Actor, now: number): boolean { const limits: Array<[string, number]> = [ [`seller:${actor.seller}`, 3], [`ip:${actor.ip}`, 20], [`device:${actor.device}`, 5], ]; const entries = limits.map(([key, limit]) => { const previous = this.buckets.get(key); const bucket = previous && now - previous.start < 60_000 ? previous : { start: now, count: 0 }; return { key, limit, bucket }; }); if (entries.some(({ bucket, limit }) => bucket.count >= limit)) { return false; } for (const { key, bucket } of entries) { bucket.count += 1; this.buckets.set(key, bucket); } return true; } issue(id: string, now: number): void { if (this.challenges.has(id)) throw new Error("Duplicate challenge"); this.challenges.set(id, { expires: now + 180_000, failures: 0, lockedUntil: 0, consumed: false, }); } finish(id: string, providerAccepted: boolean, now: number): string { const state = this.challenges.get(id); if (!state) return "unknown"; if (state.consumed) return "replay_denied"; if (now < state.lockedUntil) return "locked"; if (now >= state.expires) return "expired"; if (!providerAccepted) { state.failures += 1; if (state.failures >= 5) state.lockedUntil = now + 300_000; return state.lockedUntil > now ? "locked" : "invalid"; } state.consumed = true; return "accepted"; } } const policy = new OtpPolicy(); const actor = { seller: "seller-demo", ip: "192.0.2.8", device: "device-demo" }; const now = Date.now(); console.log({ order: "order-demo", admitted: policy.admitSend(actor, now) }); policy.issue("challenge-demo", now); console.log(policy.finish("challenge-demo", true, now + 1_000)); console.log(policy.finish("challenge-demo", true, now + 2_000)); 

The final two results are accepted and replay_denied. The same successful verification cannot produce two successful consumption decisions. The Boolean represents a trusted server-side verification result. Never accept that value from a browser.

This small example has an important boundary. Its maps cover one process, and the temporary lock is attached to one challenge. A production service needs shared storage with atomic budget updates, server-side binding between challenge and seller session, and a seller-level lock that survives challenge replacement. Serialize verification per challenge, check eligibility before the provider call, and atomically consume before issuing a session. Otherwise two workers can both observe an unused challenge, or a resend can accidentally reset the failed-attempt budget. An in-memory demonstration cannot establish those distributed guarantees.

Use trusted server time and derive the seller identity from server state. Treat IP and device signals as imperfect inputs: shared networks can punish several legitimate sellers, while a client-controlled device identifier is easy to replace. Combining the three budgets improves control but does not turn them into proof of identity.

Make retries visible without creating another challenge

A seller taps resend because the first message has not arrived. A worker retries because a transport response was inconclusive. Those are different events. Record them separately. Keep transport retries attached to the original operation with a stable idempotency key where supported; give explicit resends their own admission decision without erasing the seller's broader failure history.

For HTTP 429, honor Retry-After and apply bounded exponential backoff. A retry must still respect challenge expiry and the application's send budget. An expired challenge should not keep a background worker busy, and a response that acknowledges a send should not advance the authentication state. Check suppression before sending so blocked or opted-out numbers do not become a recurring resend loop. Apply country allow or deny rules before the outbound call, too.

The observability comparison starts with what an engineer must inspect, rather than a claim that any vendor guarantees arrival. Twilio Verify and Vonage Verify are verification-oriented options to evaluate; Amazon SNS is a messaging-oriented option when the application owns more of the authentication lifecycle. Check the current primary documentation for the exact service boundary before choosing.

Option Useful evaluation focus Trade-off for this seller workflow
Twilio Verify Verification lifecycle and evidence returned for an attempt Test how its lifecycle maps to resend and lockout policy; retain application admission controls.
Vonage Verify Verification workflow and channel configuration Compare workflow behavior with the seller journey; confirm configured channels match product requirements.
Amazon SNS SMS publishing and delivery-status evidence Assess the extra challenge-state and verification work when choosing a messaging building block.
Self-describing REST option introduced above Public discovery exposes schemas and runnable examples; no SDK required. A single key and consolidated billing reduce credential and invoice coordination across SMS and email; keep application policy and event collection explicit.

There is no measured delivery ranking here. Choose with a destination-specific trial and your own acceptance criteria. For the last option, collect communication events by polling, design an email fallback with an application-owned email code, and keep geographic abuse controls in the backend. Plan channel requirements around SMS and email. Evaluate a requirement for voice, WhatsApp, RCS, or SMTP relay separately. These boundaries affect escalation design more than a tidy integration example does.

Read the contract first. This companion example retrieves the hosted OTP discovery document, rather than guessing its send fields. Set INFRAI_API_ORIGIN to the service's documented HTTPS API origin and INFRAI_API_KEY to your environment-provided key. Discovery is public; the conditional authorization header also shows the credential pattern for authenticated requests. The request is read-only, so it needs no write idempotency key.

Shared access does not supply the application's challenge state or abuse policy.

async function inspectOtpContract(): Promise<void> { const origin = process.env.INFRAI_API_ORIGIN; if (!origin) throw new Error("Set INFRAI_API_ORIGIN"); const url = new URL("/v1/discovery/sms.otp", origin); if (url.protocol !== "https:") throw new Error("HTTPS required"); const key = process.env.INFRAI_API_KEY; const headers: Record<string, string> = {}; if (key) headers.Authorization = `Bearer ${key}`; for (let attempt = 0; attempt < 4; attempt += 1) { const response = await fetch(url, { method: "GET", headers, redirect: "error", }); if (response.status === 429 && attempt < 3) { const retryAfter = response.headers.get("Retry-After"); const seconds = retryAfter === null ? NaN : Number(retryAfter); const date = retryAfter === null ? NaN : Date.parse(retryAfter); const advised = Number.isFinite(seconds) ? seconds * 1_000 : Number.isFinite(date) ? date - Date.now() : 0; const delay = Math.max(1_000 * 2 ** attempt, advised); if (delay > 30_000) throw new Error("Retry deferred beyond this run"); await response.body?.cancel(); await new Promise(resolve => setTimeout(resolve, delay)); continue; } if (!response.ok) { throw new Error(`Discovery ${response.status}: ${await response.text()}`); } console.log(await response.json()); return; } } inspectOtpContract().catch(error => { console.error(error); process.exitCode = 1; }); 

This fetch checks the contract, not delivery. Don't turn a successful discovery request into an authentication availability metric.

Will this block legitimate sellers or delay urgent orders?

It can. A seller behind a shared network can hit the IP budget even when their own behavior is ordinary. Tune the illustrative limits using observed admission denials and completed sign-ins. Keep the order notification and authentication challenge separate so a login lockout does not silently become an order-notification suppression rule. Offer a clearly described recovery path and avoid public responses that reveal whether a seller account exists.

The second objection is operational: why collect events separately if sending already succeeded? Acceptance tells you that the request progressed, while delivery evidence and a consumed challenge answer different questions. Polling introduces an observation interval; record both the event time and the collection time so a late observation does not look like a late delivery. Never infer seller authentication from either timestamp.

One concrete trap deserves a check before launch: the example's 300s lockout exceeds its 180s challenge lifetime. Waiting out the lock cannot revive that challenge. A replacement must still respect the seller-level lock and cumulative failure budget. Those values are teaching choices, but the ordering is a real design constraint.

For a US/EU SaaS, document the destination policy separately from account geography. A permitted destination does not prove identity, residency, consent, or compliance. Use NIST's authenticator guidance to review the security boundary, then validate operational behavior for the destinations the marketplace actually serves.

Further reading

References for the authentication boundary and the comparison: