API - Electricity


API Verify Customer:


https://subandgain.com/api/verify_electricity.php?username=****&apiKey=****&service=****&meterNumber=****&meterType=****
//Replace **** with your username, api key...

E.g.
https://subandgain.com/api/verify_electricity.php?username=Peter&apiKey=sag8rqpfa8vkpn1ler56ygh8kxxw1aor8&service=AEDC&meterNumber=45036572027&meterType=PRE
//where username is Peter, apiKey is sag8rqpfa8vkpn1ler56ygh8kxxw1aor8, service is AEDC, meterNumber is 45036572027, meterType is PRE

Response:


JSON Format:
{"status":"success","customerName":"Ajibola Bolaji","accessToken":"230111498000"}

Else, if there is an error in your request, the response will be displayed in this format:
{"error":"ERR210","description":"Error! Invalid meter number. Meter Number is unable to be validated."}


Parameters:
Parameter_Name Description
username Your SubAndGain username
apiKey Your SubAndGain API Key
service service code, click Here to see
meterNumber meter number
meterType PRE or POST (UPPERCASE) - PRE for prepaid, POST for postpaid
accessToken access token generated from the verify meter endpoint
amount amount of electricity bills - minimum 1000

API Command:


https://subandgain.com/api/electricity.php?username=****&apiKey=****&service=****&meterNumber=****&meterType=****&accessToken=****&amount=****
//Replace **** with your username, api key...

E.g.
https://subandgain.com/api/electricity.php?username=Peter&apiKey=sag8rqpfa8vkpn1ler56ygh8kxxw1aor8&service=AEDC&meterNumber=45036572027&meterType=PRE&accessToken=230111498000&amount=2000
//where username is Peter, apiKey is sag8rqpfa8vkpn1ler56ygh8kxxw1aor8, service is AEDC, meterNumber is 45036572027, meterType is PRE, accessToken is 230111498000, amount is 2000

Response:


JSON Format:
{"status":"Approved","trans_id":"88c4r5one73","service":"Abuja Electric - AEDC","MeterType":"PRE","MeterNo":"45036572027","MeterToken":"6646-4560-2879-0511-8019","amount":"2000","balance":"2500"}

Else, if there is an error in your request, one of the responses below will be displayed in this format:
{"error":"ERR201","description":"Invalid Username or Api Key"}
status can be - Pending, Approved or Cancelled

Responses:
Error Description
ERR200 Username Field Is Empty
ERR201 Invalid Username or Api Key
ERR202 Invalid Meter number
ERR203 Insufficient Balance
ERR204 Invalid Service Code
ERR205 Less Than Minimum Amount
ERR206 Order Not Processed
ERR208 Meter Type does not tally with Service

API Query:


https://subandgain.com/api/query_electricity.php?username=****&apiKey=****&trans_id=****
//Replace **** with your username, api key...

E.g.
https://subandgain.com/api/query_electricity.php?username=Peter&apiKey=sag8rqpfa8vkpn1ler56ygh8kxxw1aor8&trans_id=88c4r5one73
//where username is Peter, apiKey is sag8rqpfa8vkpn1ler56ygh8kxxw1aor8, trans_id is 88c4r5one73

Response:


JSON Format:
{"status":"Approved","trans_id":"88c4r5one73","service":"Abuja Electric - AEDC for 45036572027","MeterNo":"45036572027","MeterToken":"6646-4560-2879-0511-8019","amount":"2000"}

Else, if there is an error in your request, response will be displayed in this format:
{"error":"ERR210","description":"Transaction not found on SubAndGain"}

Electricity:
Service code Distributor
IKEDC Ikeja Electric
EKEDC Eko Electric
AEDC Abuja Electric
KEDC Kano Electric
JEDC Jos Electric
IBEDC Ibadan Electric
KAEDC Kaduna Electric
EEDC Enugu Electric
PhED Port Harcourt Electric
BEDC Benin Electric - BEDC
ABA Aba Power Electric - ABA
YEDC Yola Electricity Distribution Company - YEDC