BatiB2B developer reference
The BatiB2B API
Sell data, airtime, cable TV subscriptions and electricity from your own application.
The API is REST over HTTPS. Send request bodies as JSON and expect JSON back. Every purchase is paid for from your BatiB2B wallet, so keep it funded.
Base URL
https://batib2b.com.ng/api
Send these headers with every request
Accept: application/json
Content-Type: application/json
Authorization: Bearer YOUR_API_TOKEN
Quick start
Create an account , verify your email and set your 4-digit transaction PIN.
Call Get an API token with your email and password, then keep the token safe on your server.
Try your integration while your account is in test mode . Nothing is charged.
Fund your wallet, switch the API mode to live on your profile page, and start vending.
Your token and transaction PIN give access to your wallet. Call the API from your server only, never from a browser or mobile app.
Responses & statuses
Every response has a success boolean. Purchase (vend) responses also carry a vend_status, which is what tells you whether value was delivered:
A vend can return "success": true together with "vend_status": "failed". Always decide on vend_status, not on success alone.
You are charged the face value of every product. Your commission on each successful purchase is paid into your commissions wallet, which you can move to your main wallet from the dashboard.
Test mode
New accounts start in test mode. In test mode every vend request that passes validation returns a mock successful response. No value is delivered, your wallet is not charged and no transaction is recorded.
Switch between test and live on your profile page under API settings.
Errors & limits
Error responses look like this
{
"success" : false ,
"message" : "Insufficient wallet balance..Please topup wallet to be able to vend"
}
Authentication
Get an API token
POST
/login
No token needed
Exchange your account email and password for a bearer token. Send the token in the Authorization header of every other request.
Parameters
Example request
curl -X POST "https://batib2b.com.ng/api/login" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"email":"you@business.com","password":"your-password"}'
Example responses
200
Success
{
"success" : true ,
"message" : "User logged in successfully" ,
"data" : {
"token" : "12|Xy3kP0qv..."
}
}
Networks
List networks
GET
/networks
Requires token
Returns the mobile networks and their IDs. Use the ID as network_id when vending airtime or filtering data plans.
Example request
curl -X GET "https://batib2b.com.ng/api/networks" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Example responses
200
Success
{
"success" : true ,
"message" : "fetched successfully" ,
"data" : [
{
"id" : 1 ,
"name" : "MTN"
}
]
}
Data
List data plans
GET
/data/plans/{network_id?}
Requires token
Returns the available data plans. Pass a network ID in the URL to get the plans for one network only.
Parameters
Example request
curl -X GET "https://batib2b.com.ng/api/data/plans/{network_id?}" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Example responses
200
Success
{
"success" : true ,
"data" : [
{
"id" : 4 ,
"name" : "1GB - 30 Days" ,
"network" : {
"id" : 1 ,
"name" : "MTN"
},
"type" : "SME" ,
"price" : 300
}
],
"message" : "Data Plans fetched successfully"
}
Buy data
POST
/data/vend
Requires token
Buys a data plan for a phone number. Your wallet is charged the plan price.
Parameters
Example request
curl -X POST "https://batib2b.com.ng/api/data/vend" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"plan_id":4,"recipient":"08031234567","transaction_pin":"1234","custom_ref":"ORDER-10001"}'
Example responses
200
Successful
200
Processing
200
Failed (wallet refunded)
{
"success" : true ,
"vend_status" : "successful" ,
"data" : []
}
{
"success" : true ,
"vend_status" : "processing" ,
"data" : []
}
{
"success" : true ,
"vend_status" : "failed" ,
"data" : []
}
Airtime
Buy airtime
POST
/airtime/vend
Requires token
Sends airtime to a phone number. Your wallet is charged the airtime amount.
Parameters
Example request
curl -X POST "https://batib2b.com.ng/api/airtime/vend" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"network_id":1,"recipient":"08031234567","amount":500,"transaction_pin":"1234","custom_ref":"ORDER-10002"}'
Example responses
200
Successful
200
Processing
200
Failed (wallet refunded)
422
Validation error
{
"success" : true ,
"vend_status" : "successful" ,
"data" : []
}
{
"success" : true ,
"vend_status" : "processing" ,
"data" : []
}
{
"success" : true ,
"vend_status" : "failed" ,
"data" : []
}
{
"success" : false ,
"message" : "Validation failed: The transaction pin field is required."
}
Cable TV
List cable plans
GET
/cable/plans/{type}
Requires token
Returns the plans for one cable provider.
Parameters
Example request
curl -X GET "https://batib2b.com.ng/api/cable/plans/{type}" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Example responses
200
Success
{
"success" : true ,
"message" : "Cable plans fetched successfully" ,
"data" : [
{
"id" : 2 ,
"name" : "GOtv Jolli" ,
"type" : "gotv" ,
"amount" : 5800
}
]
}
Validate a smart card number
POST
/cable/validate
Requires token
Confirms a smart card / IUC number and returns the customer name. Do this before vending.
Parameters
Example request
curl -X POST "https://batib2b.com.ng/api/cable/validate" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"type":"gotv","smart_card_no":"2012345678"}'
Example responses
200
Success
422
Validation error
{
"success" : true ,
"msg" : "Operation successful" ,
"data" : {
"customer_name" : "JOHN DOE" ,
"customer_no" : ""
}
}
{
"success" : false ,
"message" : "Validation failed: The transaction pin field is required."
}
Pay a cable subscription
POST
/cable/vend
Requires token
Pays for a cable plan on a smart card. Your wallet is charged the plan amount.
Parameters
Example request
curl -X POST "https://batib2b.com.ng/api/cable/vend" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"plan_id":2,"smart_card_no":"2012345678","transaction_pin":"1234","custom_ref":"ORDER-10003"}'
Example responses
200
Successful
200
Processing
200
Failed (wallet refunded)
422
Validation error
{
"success" : true ,
"vend_status" : "successful" ,
"data" : []
}
{
"success" : true ,
"vend_status" : "processing" ,
"data" : []
}
{
"success" : true ,
"vend_status" : "failed" ,
"data" : []
}
{
"success" : false ,
"message" : "Validation failed: The transaction pin field is required."
}
Electricity
List discos
GET
/power/discos
Requires token
Returns the electricity distribution companies and their IDs.
Example request
curl -X GET "https://batib2b.com.ng/api/power/discos" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Example responses
200
Success
{
"success" : true ,
"message" : "Discos fetch successfully" ,
"data" : [
{
"id" : 1 ,
"name" : "Ikeja Electric" ,
"short_name" : "IKEDC"
}
]
}
Validate a meter number
POST
/power/validate
Requires token
Confirms a meter number and returns the customer name and address. Do this before vending.
Parameters
Example request
curl -X POST "https://batib2b.com.ng/api/power/validate" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"disco_id":1,"meter_no":"45012345678","type":"prepaid"}'
Example responses
200
Success
422
Validation error
{
"success" : true ,
"data" : {
"customer_name" : "JOHN DOE" ,
"customer_address" : "12 ALLEN AVENUE IKEJA"
}
}
{
"success" : false ,
"message" : "Validation failed: The transaction pin field is required."
}
Buy electricity
POST
/power/vend
Requires token
Buys electricity units for a meter. Your wallet is charged the amount. For prepaid meters the token is returned in data.token.
Parameters
Example request
curl -X POST "https://batib2b.com.ng/api/power/vend" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"disco_id":1,"type":"prepaid","meter_no":"45012345678","amount":5000,"transaction_pin":"1234","custom_ref":"ORDER-10004"}'
Example responses
200
Successful
200
Processing
200
Failed (wallet refunded)
422
Validation error
{
"success" : true ,
"vend_status" : "successful" ,
"data" : {
"token" : "1234-5678-9012-3456-7890"
}
}
{
"success" : true ,
"vend_status" : "processing" ,
"data" : []
}
{
"success" : true ,
"vend_status" : "failed" ,
"data" : []
}
{
"success" : false ,
"message" : "Validation failed: The transaction pin field is required."
}
Transactions
Check a transaction
GET
/transaction/{custom_ref}
No token needed
Returns the current status of an order, looked up by the custom_ref you sent when vending. Use this to follow up on orders that came back as processing.
Parameters
Example request
curl -X GET "https://batib2b.com.ng/api/transaction/{custom_ref}" \
-H "Accept: application/json"
Example responses
200
Success
422
Not found
{
"success" : true ,
"message" : "Transaction successfully fetched" ,
"data" : {
"ref_id" : "AB123456" ,
"desc" : "Network: MTN" ,
"custom_ref" : "ORDER-10002" ,
"type" : "AirtimePurchase" ,
"request_ip" : "102.89.0.1" ,
"status" : "successful"
}
}
{
"success" : false ,
"message" : "No transaction with this custom reference exist"
}