updated api document (STAR)
updated api document (STAR)
Edition 1.3.20
5/1/2020
1 / 25 Edition: 1.3.5
Table of Contents
1. Abbreviations ........................................................................................................................4
2. Introduction to Interfaces ........................................................................................................6
2.1 Flow Chart...........................................................................................................................6
2.2 General Interfaces................................................................................................................6
2.2.1 Login Interface ..................................................................................................................6
2.2.2 Pre-Charge .......................................................................................................................9
2.2.3 Remote Recharge Interface..............................................................................................12
2.2.4 History............................................................................................................................16
2.2.5 Change Password ...........................................................................................................19
2.2.6 Transaction Report Interface ............................................................................................21
2.2.7 Global ............................................................................................................................32
1. Abbreviations
1P Single phase
3P Three phase
AES Advanced Encryption Standard
App Application
API An application programming interface (API) is an interface or communication
protocol between a client and a server intended to simplify the building of
client-side software
BERC Bangladesh Energy Regulatory Commission
URL http://ip:port/nesco/login
postAuthCode String
Example {
"app_name":"pos",
"app_password":"123456",
"postAuthCode":"2316d133-4782-3c83-94fa-0d54530fba50"
Response
parameters Name Type Description
access_token String Authentication token
resultcode String Result code
resultdesc String Result description
balance String Balance
expires_in String Validity of token (seconds). It is a time period starting from
the moment when the user stops the last operation. When
beyond such time period, it is required to authenticate
again.
firstLogin Boolea Whether to log in for the first time
n
Example of // Succeed
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
"access_token":"eyJhbGciOiJIUzI1NiJ9.eyJzdGFyIjoiNzkwIiwiY3JlYXRlZCI6MTYwOT
M4NDUwNjU5MiwibWF4RGF5IjoiMTYwOTM4NTAwNjU5MiIsImlwIjoiMTkyLjEyNS4xN
TUuMTQzIiwiZXhwIjoxNjA5Mzg1MTA2fQ.tPjyKwYq2tVDiBZWhF9Pc1Qx9IQqalx56cb
3Ua075l8"
"balance":"9177648.52",
"firstLogin":false,
"resultcode":"0",
"expires_in":"600000"
"resultdesc":"Succeed"
Exception
Content-Type: application/json;charset=UTF-8
"resultcode":"1010004",
Result code
1010009 Device
identification
code is
incorrect
0000002 Instrument
information
does not exist
1020003 Customer no
has been
locked
2.2.2 Pre-Charge
This function has been developed in order to confirmation of purchase before generate token that
prevent from any discrepancy of payment which is developed based on precharge code .
Conditions
The purchase amount must be more than 0.
The purchase amount keeps a decimal point at most.
The total purchase amount must be less than the balance of the third party where the customer
purchases electricity.
In the case of more than 1 token, it should be separated by a comma between each token.
Request POST
method
URL http://ip:port/starpay/nesco/preCharge
Request access_token:
Header eyJhbGciOiJIUzI1NiJ9.eyJzdGFyIjoiNzkwIiwiY3JlYXRlZCI6MTYwOTM4NDUwNjU5MiwibWF
4RGF5IjoiMTYwOTM4NTAwNjU5MiIsImlwIjoiMTkyLjEyNS4xNTUuMTQzIiwiZXhwIjoxNjA5
Mzg1MTA2fQ.tPjyKwYq2tVDiBZWhF9Pc1Qx9IQqalx56cb3Ua075l8
Request
parameter
Name Type Description
customerNo String Customer Number
meterNo String Meter number
payinAmount String Amount of electricity purchase
Request {
example
"customerNo":"22189991742",
"meterNo":"",
"payinAmount":501
Content-Type: application/json;charset=UTF-8
"data":{
"newCurrencyError":0,
"fee":{
"Energy Cost":"481.84",
"Monthly Rent(pp)(40/month)":"0.00",
"Demand Charge(30/kW)":"0.00",
"Purchase Amount":"501.00",
"Rebate(1%)":"-4.72",
"PFC":"0.00",
"Last Error":"0.02",
"Paid Debt":"0.00",
"VAT(5%)":"23.86"
},
"meterNo":"22189991742",
"transactionId":"40fd1b0f76d164860176d1859bfe0008",
"customerNo":"22189991742",
"customerName":"22189991742"
},
"resultcode":"0",
"resultdesc":"Succeed"
Result code
URL http://ip:port/starpay/nesco/remoteCharge
Request access_token:
Header eyJhbGciOiJIUzI1NiJ9.eyJzdGFyIjoiNzkwIiwiY3JlYXRlZCI6MTYwOTM4NDUwNj
U5MiwibWF4RGF5IjoiMTYwOTM4NTAwNjU5MiIsImlwIjoiMTkyLjEyNS4xNTU
uMTQzIiwiZXhwIjoxNjA5Mzg1MTA2fQ.tPjyKwYq2tVDiBZWhF9Pc1Qx9IQqalx
56cb3Ua075l8
Request
parameter
Name Type Description
transactionId String Transaction Identification
Request {
example
"transactionId":"40fd1b0f76d164860176d1859bfe0008"
Content-Type: application/json;charset=UTF-8
Success case 1:
"data":{
"orderNo":"506342316116217856",
"newCurrencyError":0.08,
"fee":{
"Monthly Rent(pp)(40/month)":0,
"Energy Cost":481.84,
"Demand Charge(30/kW)":0,
"Purchase Amount":501,
"Rebate(1%)":-4.72,
"PFC":0,
"Last Error":0.02,
"Paid Debt":0,
"VAT(5%)":23.86
},
"meterNo":"22189991742",
"orderDate":"05/01/2021 15:50:25",
"customerName":"22189991742",
"customerNo":"22189991742",
"transactionId":"40fd1b0f76d164860176d1859bfe0008",
"token":"4003-5727-2451-7398-9173"
},
"resultcode":"0",
"resultdesc":"Succeed"
Success case 2:
{
"data":{
"orderNo":"506342316116217856",
"newCurrencyError":0.08,
"fee":{
"Monthly Rent(pp)(40/month)":0,
"Energy Cost":481.84,
"Demand Charge(30/kW)":0,
"Purchase Amount":501,
"Rebate(1%)":-4.72,
"PFC":0,
"Last Error":0.02,
"Paid Debt":0,
"VAT(5%)":23.86
},
"meterNo":"22189991742",
"orderDate":"05/01/2021 15:50:25",
"customerName":"22189991742",
"customerNo":"22189991742",
"transactionId":"40fd1b0f76d164860176d1859bfe0008",
"token":"4003-5727-2451-7398-9173"
},
"resultcode":"10010",
Exception
Content-Type: application/json;charset=UTF-8
Failure case 1
"resultcode":"14003",
"data":{
"transactionId":"40fd1b0f76b6cab70176b6cd07600001"
Failure case 2
"resultcode":"10009",
"data":{
"transactionId":"40fd1b0f76b6cab70176b6cd07600001"
Result code
Method of POST
Request
URL http://ip:port/starpay/nesco/getPurchaseRecord
Request access_token:
Header eyJhbGciOiJIUzI1NiJ9.eyJzdGFyIjoiNzkwIiwiY3JlYXRlZCI6MTYwOTM4NDUwNjU5Miwib
WF4RGF5IjoiMTYwOTM4NTAwNjU5MiIsImlwIjoiMTkyLjEyNS4xNTUuMTQzIiwiZXhwIjox
NjA5Mzg1MTA2fQ.tPjyKwYq2tVDiBZWhF9Pc1Qx9IQqalx56cb3Ua075l8
Request
parameter
Name Type Description
transactionId String Transaction Identification
Request {
example
"transactionId":"40fd1b0f76d164860176d1859bfe0008"
Response
parameter Name Type Description
resultcode String Result code
resultdesc String Result description
data Object Data details
Data
fee Object Details of Electricity token : 3P Meter
rent(250/month), Error Amount, TAX, Rebate(1%),
Demand charge(25/kW), Last Error, PFC, Paid
Debt, VAT(5%)
orderNo String
newCurrencyError Number
meterNo String
orderDate String
transactionId String
customerNo String
customerName String
token String
Example of // Succeed
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
"data":{
"orderNo":"506342316116217856",
"newCurrencyError":0.08,
"fee":{
"Monthly Rent(pp)(40/month)":0,
"Energy Cost":481.84,
"Demand Charge(30/kW)":0,
"Purchase Amount":501,
"Rebate(1%)":-4.72,
"PFC":0,
"Last Error":0.02,
"Paid Debt":0,
"VAT(5%)":23.86
},
"meterNo":"22189991742",
"orderDate":"05/01/2021 15:50:25",
"transactionId":"40fd1b0f76d164860176d1859bfe0008",
"customerNo":"22189991742",
"customerName":"22189991742",
"token":"4003-5727-2451-7398-9173"
},
"resultcode":"0",
"resultdesc":"Succeed"
}
Result code
URL http://ip:port/starpay/nesco/changePassword
Request access_token:
Header eyJhbGciOiJIUzUxMiJ9.eyJzdGFyIjoiMTY4IiwiY3JlYXRlZCI6MTU5MTA2MDk3NDMyNSwiZ
XhwIjoxNTkxMTQ3Mzc0fQ.y7PIcCox37ahlcxKeVHXKFPu3f4BRZbvCJgOZAeKkWiAdQ_6
mx-pf6mAxkjvawKnOJwNpOZPR0p-PKui4HXoUA
Request
parameter
Name Type Description
access_token String Authentication token
app_name String Registration name
app_old_passwor String Old password
d
Request {
example "app_name": "pos",
"app_new_password": "000000",
"app_old_password": "123456"
Response
parameter Name Type Description
resultcode String Result code
resultdesc String Result description
Example of // Succeed
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
"resultcode":"0",
"resultdesc":"Succeed"
Exception
Content-Type: application/json;charset=UTF-8
"resultcode":"10015",
Result code
10016 Password
change failed,
Abnormal
database
changes
URL http://ip:port/starpay/nesco/transactionReport
Request access_token:
Header eyJhbGciOiJIUzUxMiJ9.eyJzdGFyIjoiMTY4IiwiY3JlYXRlZCI6MTU5MTA2MDk3NDMyNSwiZ
XhwIjoxNTkxMTQ3Mzc0fQ.y7PIcCox37ahlcxKeVHXKFPu3f4BRZbvCJgOZAeKkWiAdQ_6
mx-pf6mAxkjvawKnOJwNpOZPR0p-PKui4HXoUA
Request
parameter
Name Type Description
salesName String Name of selling point
startTime String Min time the past year
endTime String Max time the current time
Request {
example
"endTime":"05/01/2021 16:13:00",
"startTime":"04/01/2021 16:53:32"
}
Response
parameter Name Type Description
resultcode String Result code
resultdesc String Result description
data String The last Five Transactions
total Int Total number of data records
Data
orderNo String Work order number
Content-Type: application/json;charset=UTF-8
"data":[
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0,
"meterNo":"22189991742",
"newCurrencyError":0.08,
"orderNo":"506342316116217856",
"penaltyMoney":0,
"principleAmount":477.14,
"purchaseDate":1609833025000,
"purchaseEnergy":108.15,
"purchaseMoney":481.84,
"saleName":"POS",
"subsidyMoney":-4.72,
"tax":23.86,
"totalMoney":501
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0,
"meterNo":"22189991742",
"newCurrencyError":0,
"orderNo":"506329886335148032",
"penaltyMoney":0,
"principleAmount":477.14,
"purchaseDate":1609830062000,
"purchaseEnergy":108.14,
"purchaseMoney":481.82,
"saleName":"POS",
"subsidyMoney":-4.72,
"tax":23.86,
"totalMoney":501
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":10,
"meterNo":"22189991742",
"newCurrencyError":0.02,
"orderNo":"506318336203399168",
"penaltyMoney":0,
"principleAmount":477.14,
"purchaseDate":1609827308000,
"purchaseEnergy":106.39,
"purchaseMoney":471.8,
"saleName":"POS",
"subsidyMoney":-4.72,
"tax":23.86,
"totalMoney":501
},
{
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":4.95,
"meterNo":"22189991742",
"newCurrencyError":0.05,
"orderNo":"506300313119727616",
"penaltyMoney":0,
"principleAmount":500,
"purchaseDate":1609823011000,
"purchaseEnergy":346.65,
"purchaseMoney":494.97,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":500
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":4.96,
"meterNo":"22189991742",
"newCurrencyError":0.08,
"orderNo":"506253085817638912",
"penaltyMoney":0,
"principleAmount":501,
"purchaseDate":1609811751000,
"purchaseEnergy":347.36,
"purchaseMoney":496.04,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":501
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0.5,
"meterNo":"22189991742",
"newCurrencyError":0,
"orderNo":"506037805761892352",
"penaltyMoney":0,
"principleAmount":50,
"purchaseDate":1609760424000,
"purchaseEnergy":49.5,
"purchaseMoney":49.5,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":50
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0.5,
"meterNo":"22189991742",
"newCurrencyError":0,
"orderNo":"506035529282424832",
"penaltyMoney":0,
"principleAmount":50,
"purchaseDate":1609759882000,
"purchaseEnergy":49.5,
"purchaseMoney":49.5,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":50
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0.5,
"meterNo":"22189991742",
"newCurrencyError":0,
"orderNo":"506035117120753664",
"penaltyMoney":0,
"principleAmount":50,
"purchaseDate":1609759783000,
"purchaseEnergy":49.5,
"purchaseMoney":49.5,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":50
},
{
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0.5,
"meterNo":"22189991742",
"newCurrencyError":0,
"orderNo":"506029292427874304",
"penaltyMoney":0,
"principleAmount":50,
"purchaseDate":1609758395000,
"purchaseEnergy":49.5,
"purchaseMoney":49.5,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":50
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0.5,
"meterNo":"22189991742",
"newCurrencyError":0,
"orderNo":"506007113640382464",
"penaltyMoney":0,
"principleAmount":50,
"purchaseDate":1609753107000,
"purchaseEnergy":49.5,
"purchaseMoney":49.5,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":50
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0.5,
"meterNo":"22189991742",
"newCurrencyError":0,
"orderNo":"506002476947447808",
"penaltyMoney":0,
"principleAmount":50,
"purchaseDate":1609752001000,
"purchaseEnergy":49.5,
"purchaseMoney":49.5,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":50
},
"custName":"22189991742",
"custNo":"22189991742",
"debtMoney":0,
"mcostMoney":0.5,
"meterNo":"22189991742",
"newCurrencyError":0,
"orderNo":"505998021816459264",
"penaltyMoney":0,
"principleAmount":50,
"purchaseDate":1609750939000,
"purchaseEnergy":49.5,
"purchaseMoney":49.5,
"saleName":"POS",
"subsidyMoney":0,
"tax":0,
"totalMoney":50
],
"resultcode":"0",
"resultdesc":"Succeed"
}
Result code
2.2.7 Global
Error code Error message Error description
0000003 The token is incorrect
{
"data":"eyJhbGciOiJIUzI1NiJ9.eyJzdGFyIjoiNzkwIiwiY3JlYXRlZCI6MTYwOT
EzODAzMTYzNiwibWF4RGF5IjoiMTYwOTEzODMzMTYzNiIsImlwIjoiMTkyLjEyN
S4xNTUuMTQzIiwiZXhwIjoxNjA5MTM4MjExfQ.AAWb-
vo4Oh9yyfPdBGVyutvHwBiE9roJHDLlD3zuO4A",
"resultcode":"0000013",
"resultdesc":"Token expired, please replace the old token"
}
If the error code is 0000013 , Please replace the original token with data in the response data
{
"code":"-1",
"msg":"Server error"
}