Network Prefixes
Nigerian phone number prefixes for identifying network providers and handling Mobile Number Portability (MNP).
Nigerian Network Prefixes
Phone numbers in Nigeria are 11 digits long and start with 0 (or +234 / 234 in international format). The first 4 digits identify the network provider that originally issued the number.
MTN
0803, 0806, 0810, 0813, 0814, 0816
0903, 0906, 0913, 0916
0702, 0703, 0704, 0706, 0707
GLO
0805, 0807, 0811, 0815
0905, 0705, 0915
AIRTEL
0802, 0808, 0812, 0708
0701, 0901, 0902, 0904
0907, 0912, 0911, 0917
9MOBILE
0809, 0817, 0818
0909, 0908
Mobile Number Portability (MNP): In Nigeria, subscribers can port their phone numbers from one network to another while retaining their original prefix (e.g. an 0803 number ported from MTN to Airtel). Prefix auto-detection identifies the original issuing network, which may differ from the subscriber's current active network.
Handling Ported Numbers
When initiating purchase requests for Airtime or Data services:
- Allow Manual Network Selection: In your client application UI, pre-select the network based on prefix auto-detection, but always allow end-users to manually override and pick their current active network operator.
- Set
isPorted: true: If the target phone number has been ported to another network provider, pass"isPorted": truein your API payload. This instructs KDA Turbo and vendor networks to process the order via MNP routing channels.
Example Payload for a Ported Number:
{
"planId": "kds-airtime-airtel-vtu-v1",
"number": "08031234567",
"amount": 500,
"isPorted": true,
"idempotencyKey": "681227cc-2638-49fe-bbe3-d2500cf54767"
}Client-Side Validation & Auto-Detection
Use the helper script below to validate Nigerian phone numbers and auto-detect the default network prefix:
const providerPrefixes = {
MTN: ["0803","0806","0810","0813","0814","0816","0903","0906","0913","0916","0702","0703","0704","0706","0707"],
GLO: ["0805","0807","0811","0815","0905","0705","0915"],
AIRTEL: ["0802","0808","0812","0708","0701","0901","0902","0904","0907","0912","0911","0917"],
"9MOBILE": ["0809","0817","0818","0909","0908"],
};
function identifyNetwork(phone) {
const digits = phone.replace(/\D/g, "");
let number = digits;
if (number.startsWith("234")) number = "0" + number.slice(3);
else if (number.startsWith("+234")) number = "0" + number.slice(4);
const prefix = number.slice(0, 4);
for (const [network, prefixes] of Object.entries(providerPrefixes)) {
if (prefixes.includes(prefix)) {
return { network, isValid: number.length === 11 };
}
}
return null;
}
console.log(identifyNetwork("08031234567")); // { network: "MTN", isValid: true }
console.log(identifyNetwork("07081234567")); // { network: "AIRTEL", isValid: true }
console.log(identifyNetwork("08051234567")); // { network: "GLO", isValid: true }PROVIDER_PREFIXES = {
"MTN": ["0803","0806","0810","0813","0814","0816","0903","0906","0913","0916","0702","0703","0704","0706","0707"],
"GLO": ["0805","0807","0811","0815","0905","0705","0915"],
"AIRTEL": ["0802","0808","0812","0708","0701","0901","0902","0904","0907","0912","0911","0917"],
"9MOBILE": ["0809","0817","0818","0909","0908"],
}
def identify_network(phone: str):
digits = "".join(c for c in phone if c.isdigit())
number = digits
if number.startswith("234"):
number = "0" + number[3:]
elif number.startswith("+234"):
number = "0" + number[4:]
prefix = number[:4]
for network, prefixes in PROVIDER_PREFIXES.items():
if prefix in prefixes:
return {"network": network, "isValid": len(number) == 11}
return None
print(identify_network("08031234567")) # {'network': 'MTN', 'isValid': True}
print(identify_network("07081234567")) # {'network': 'AIRTEL', 'isValid': True}
print(identify_network("08051234567")) # {'network': 'GLO', 'isValid': True}$providerPrefixes = [
'MTN' => ['0803','0806','0810','0813','0814','0816','0903','0906','0913','0916','0702','0703','0704','0706','0707'],
'GLO' => ['0805','0807','0811','0815','0905','0705','0915'],
'AIRTEL' => ['0802','0808','0812','0708','0701','0901','0902','0904','0907','0912','0911','0917'],
'9MOBILE' => ['0809','0817','0818','0909','0908'],
];
function identifyNetwork(string $phone): ?array {
$digits = preg_replace('/\D/', '', $phone);
$number = $digits;
if (str_starts_with($number, '234')) {
$number = '0' . substr($number, 3);
} elseif (str_starts_with($number, '+234')) {
$number = '0' . substr($number, 4);
}
$prefix = substr($number, 0, 4);
foreach ($GLOBALS['providerPrefixes'] as $network => $prefixes) {
if (in_array($prefix, $prefixes)) {
return ['network' => $network, 'isValid' => strlen($number) === 11];
}
}
return null;
}
print_r(identifyNetwork('08031234567')); // ['network' => 'MTN', 'isValid' => true]
print_r(identifyNetwork('07081234567')); // ['network' => 'AIRTEL', 'isValid' => true]
print_r(identifyNetwork('08051234567')); // ['network' => 'GLO', 'isValid' => true]