Data Purchase
You can make a data bill payment purchase in three easy steps:
List the data providers
List the provider's details
Initiate the bill payment purchase
1. Get the list of data providers
GET
{{baseUrl}}/api/bills/data/get_data_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 \
--url https://api.smarthivesms.com/api/data/get_data_providers \
--header 'accept: application/json' \
--header 'x-api-key: <API KEY>'
2. Get the provider’s details
GET
{{baseUrl}}/api/bills/data/get_data_products?providerId={providerId}
Then call the list biller product endpoint and pass the providerId
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 data bundle specified in the countries lowest currency unit. Price is a fixed for data
providerId
is the unique Id of the bill provider.
slug
is the human readable identifier of the data product/plan. When you list a biller product you will see the product slug on each biller product.
Sample request payload and sample 200 OK response payload are given below:
curl --request GET \
--url https://api.smarthivesms.com/api/data/get_data_products?billerId=168322497175013-anc_blr \
--header 'accept: application/json' \
--header 'x-api-key: <API KEY>'
3. Initiate the data bill payment:
POST
{{baseUlr}}/api/bills/data/get_data
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).
productSlug
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,
"productSlug": "mtn_dataplan_100mb_daily_24_hours_",
"reference": 3456789
}'
Last updated