Unified phone verification
I built a shared phone verification flow for purchases, account closure, and refund withdrawals across desktop, mobile web, and app WebViews.
- Next.js
- TypeScript
- Jotai
- Cypress
Customer verification request
Account closure · Purchase · Refund withdrawal
Reusable SMS verification
OTP input · Countdown · Session state
Refresh expired tokens and resume verification
Host-specific completion
- Popup
- Embedded iframe
- Native WebView
Simplified frontend flow; backend services are omitted.
Implementation details
The challenge
The flow needed to preserve verification state while handling expired sessions and different completion requirements in each environment.
Implementation
- Shared phone-number validation and preserved verification results across signup and social-login steps.
- Reused existing countdown and authentication utilities to keep refreshed tokens, OTP expiry, and input state in sync during session recovery.
- Separated shared state transitions from completion callbacks and messages for popups, embedded iframes, and native WebViews.
Validation
Checked expired sessions, unauthorized responses, request payloads, and delayed completion messages. CAPTCHA checks distinguish SDK or environment failures from server rejections.