OTP Phone Verify

A beautiful and customizable Flutter package for phone number verification using WhatsApp OTP via WhatsOTP.me service.

pub package License: MIT

Screenshots

Phone Input Screen OTP Input Screen

API Documentation

Full API Documentation: WhatsOTP.me API Docs

Features

  • Send OTP via WhatsApp to any phone number
  • Verify OTP codes with local verification (fast & secure)
  • Resend OTP functionality with countdown timer
  • Check account balance
  • Multiple theme presets (Default, Dark, Blue, Green, Purple)
  • Multi-language support (English, Arabic, French, Spanish)
  • RTL support for Arabic
  • Easy integration with just a few lines of code

Installation

Add this to your pubspec.yaml:

dependencies:
  otp_phone_verify: ^1.0.3

Or from GitHub:

dependencies:
  otp_phone_verify:
    git:
      url: https://github.com/Ouknik/otp_phone_verify.git
      ref: main

Then run:

flutter pub get

Getting API Credentials

  1. Sign up at WhatsOTP.me
  2. Go to your dashboard and get your API credentials
  3. View full API documentation: API Docs

Quick Start

Basic Usage with Dialog

The easiest way to implement phone verification:

import 'package:otp_phone_verify/otp_phone_verify.dart';

// Configure your credentials
final config = OtpConfig(
  apiKey: 'YOUR_API_KEY',
  apiSecret: 'YOUR_API_SECRET',
);

// Show verification dialog
final result = await OtpPhoneVerifyDialog.show(
  context: context,
  config: config,
  phoneNumber: '+1234567890',
);

if (result != null && result.verified) {
  print('Phone verified successfully!');
  print('Phone: ${result.phoneNumber}');
}

With Custom Theme

final result = await OtpPhoneVerifyDialog.show(
  context: context,
  config: config,
  phoneNumber: '+1234567890',
  theme: OtpDialogTheme.dark(), // or .blue(), .green(), .purple()
);

With Arabic Language (RTL)

final result = await OtpPhoneVerifyDialog.show(
  context: context,
  config: config,
  phoneNumber: '+1234567890',
  translations: OtpTranslations.arabic(),
  isRtl: true,
);

Available Themes

Theme Description
OtpDialogTheme() Default light theme
OtpDialogTheme.dark() Dark mode theme
OtpDialogTheme.blue() Blue accent theme
OtpDialogTheme.green() Green accent theme
OtpDialogTheme.purple() Purple accent theme

Available Languages

Language Usage
English OtpTranslations()
Arabic OtpTranslations.arabic()
French OtpTranslations.french()
Spanish OtpTranslations.spanish()

API Reference

OtpConfig

Parameter Type Description
apiKey String Your WhatsOTP.me API key
apiSecret String Your WhatsOTP.me API secret

OtpPhoneVerifyDialog.show()

Parameter Type Description
context BuildContext Required - Build context
config OtpConfig Required - API configuration
phoneNumber String Required - Phone number to verify
theme OtpDialogTheme Optional - Dialog theme
translations OtpTranslations Optional - Text translations
isRtl bool Optional - RTL layout support

Security

  • OTP codes are verified locally after being received from the server
  • API credentials are sent via secure headers
  • All communication uses HTTPS

Example App

Check out the example directory for a complete working example.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For questions or support, please visit WhatsOTP.me or open an issue on GitHub.

Libraries

otp_phone_verify
OTP Phone Verify - A beautiful Flutter package for phone verification