Airtime Purchase
1. Get the list of airtime providers
To initiate airtime bill payment, make an API call to the list billers endpoint to fetch all the airtime providers’ details on Smarthivesms. If this is successful, you will receive a list of all airtime providers on Smarthivesms:
Airtime Providers on Smarthivesms: MTN, Airtel, 9Mobile, NTEL, GLO
GET
{{baseUrl}}/api/bills/airtime/get_airtime_providers
To initiate data bill payment, make an API call to the list billers endpoint to fetch all the data providers’ details on Anchor. If this is successful, you will receive a list of all data providers on Anchor.
Sample request payload and sample 200 OK response payload are given below:
curl --request GET \
'http://localhost:6008/api/bills/airtime/get_airtime_providers' \
--header 'accept: application/json' \
--header 'x-api-key: <API KEY>'
2. Get the provider’s details
GET
{{baseUrl}}/api/bills/airtime/get_airtime_products?providerId={providerId}
2. Get the airtime provider’s details
Then call the list biller product endpoint and pass the billerId
to fetch all the Products of that provider. When you list the biller product, note the slug
and price
of the data product you want to purchase as you will use this in creating the data bill payment.
price
- price of the of the airtime specified in the countries lowest currency unit. Price is a fixed for data
billerId
is the unique Id of the bill provider on Anchor.
slug
is the human readable identifier of the airtime product/plan. When you list a biller product you will see the product slug on each biller product.
curl --request GET \
'http://localhost:6008/api/bills/airtime/get_airtime_products?providerId=168322497247222-anc_blr' \
--header 'accept: application/json' \
--header 'x-api-key: <API KEY>'
3. Initiate the data bill payment:
POST
{{baseUlr}}/api/bills/airtime/get_airtime
When you have identified the data bundle you want to purchase, you can proceed to purchase the identified data plan.
phoneNumber
This is the phone number that will receive the data bundle.
amount
This is the fixed amount of the data bundle (specified in the currencies lowest denomination).
provider
The slug of the product for which the payment is being made.
reference
The unique identifier of the transaction on your system.
curl --location 'http://localhost:6008/api/bills/data/get_data' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <API KEY>' \
--data '{
"phoneNumber": "23490XXXXXXX",
"amount": 10000,
"provider": "mtn",
"reference": 3456789
}'
Last updated