Skip to main content

Overview

Before sending a top-up request, validate all inputs to prevent errors and ensure a smooth user experience.
Proper validation reduces API errors and improves user experience by catching mistakes early.

Phone Number Validation

Phone numbers must match this pattern: ^0[567][0-9]{8}$ Requirements:
  • Must start with 0
  • Second digit must be 5, 6, or 7
  • Exactly 10 digits total
  • Only numeric characters
  • "0778037340"
  • "0665983439"
  • "0556121212"

Plan Validation

Validate that the selected plan exists and is available:

Amount Validation

Validate amounts based on plan type (dynamic vs fixed):

Complete Validation

Combine all validations:

Best Practices

Check inputs in the UI before making API calls to improve UX.
Never trust client input. Always validate on the server.
Show specific error messages that help users fix issues.
Remove whitespace and normalize inputs before validation.

Next Steps

Step 3: Sending Top-Ups

Learn how to send top-up requests

API Reference

Complete API documentation