Handle Nigerian phone numbers in a bill payment API

Normalize airtime and data recipients, preserve leading zeros, confirm the network and keep test numbers separate from real customer purchases.

Already registered? Open API settings and follow the business-access steps. Sandbox purchases do not deliver real services.

Reviewed

A customer pastes a number with spaces or a country code. Your checkout should turn a supported input into the API's expected format, show the result for confirmation and reject inputs it cannot interpret safely. A successful format check does not establish that the customer chose the right recipient.

Keep the number as text

Use a string from the form through the order record and API payload. Converting it to an integer removes the initial zero and makes comparisons with saved recipients unreliable. A spreadsheet import should also preserve phone numbers as text.

The airtime and data examples use the 11-digit local form, such as 08011111111. A country-code input with +234 represents the corresponding national number without the local leading zero. Handle that transformation deliberately; avoid taking the last eleven digits of any arbitrary input and treating the result as valid.

Input problemCheckout response
Spaces or a supported display separatorNormalize, then display the result
Recognized country-code formConvert through your validated normalization rule
Too many digits or an extensionAsk for a corrected recipient
Missing leading zero in a local numberApply an explicit supported rule or ask for correction
Number changes after confirmationConfirm the revised recipient again

Validate on the server too

Run your recipient checks where the purchase request is built. Browser validation improves the form, but it does not protect an API endpoint from a manually edited request. Keep the original input only if your support process needs it, under the same access controls as the order.

Ask the customer to confirm the network separately. Do not treat the number's prefix as an authoritative network lookup. The purchase's network field must match the selected product, while the customer remains responsible for confirming the intended recipient.

Keep test recipients out of live orders

Sandbox numbers select specific simulated results. 08011111111 selects a successful airtime or data scenario; the pending and failure fixtures serve other tests. These are not general sample recipients to carry into a live purchase.

Use separate test fixtures and production order inputs. Before enabling production, inspect any seeded beneficiaries, example request bodies and support macros that could copy a simulator number into a real checkout.

Test local and country-code input, spaces, too many digits, a changed recipient and an unchanged pending order. Reopening that pending receipt should show the stored number and status. It should not normalize a new input and send another purchase.