Skip to main content

Airtime Purchase

Airtime Purchase

The Airtime Purchase process is designed to be simple and user-friendly, allowing User to purchase airtime for themselves or clients for any obile network provider. Clients submit a request to the API and receive a confirmation sms upon successful purchase. Users are able to generate reports and statistics which ensures efficiency and reliabilty.

Airtime Purchase Request Parameters

To initialize the transaction, you need to pass information such as amount and phone number etc. The table below lists the parameters that you can pass when initializing a transaction.

ParameterTypeRequired?Description
secret_keystringyesThe secret key of your Lipila account
amountdoubleyesThe value of the airtime being purchased
accountNumberstringyesThe destination account for the airtime
externalIdstringnoThe external ID of the payment (optional)
narrationstringnoBrief transaction description
billTypestringyesnetwork provider(e.g AirtelAirtime)

The Table below shows the different bill types based on the network provider

Mobile NetworkbillType value
MTNMtnAirtime
AirtelAirtelAirtime
ZamtelZamtelAirtime

Below is a sample snapshot of the Airtime purchase request and the request Url.

curl -X 'POST' \
'https://lipila-uat.hobbiton.app/transactions/bills/airtime' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_SECRET_KEY' \
-H 'Content-Type: application/json' \
-d '{
"billType": "MtnAirtime",
"externalId": "string",
"narration": "string",
"amount": 1,
"accountNumber": "0961630967"
}'

Make sure to replace YOUR_SECRET_KEY with your Lipila secret key.

Airtime Purchase Response

The Lipila API returns a JSON response with the following fields:

FieldTypeDescription
statusstringThe status of the transaction
messagestringThe message of the transaction
transactionIdstringThe transaction ID of the transaction
externalIdstringThe external ID of the transaction
amountdoubleThe amount of the transaction
tokenstringResponse token from the API

Below is an example of a response when a Transaction has been successfully sent for processing:

{
"status": "Pending",
"message": "Transaction sent for processing",
"transactionId": "123456789",
"externalId": "32142",
"amount": 1.0,
"token" : "xxxxxxx"
}