Skip to main content
Version: Lastest

Security

1. How to generate signature for API Check bill information

Example of parameters passed to the API

{
"partnerRefId": "AB123",
"billCode": "PD12121",
"serviceCode": "ENVHN",
"signature": "b10294bae53e89919b3efd62a763bf3..."
}

The order of parameters to create the signature will be sorted alphabetically.
The parameters are included into signature: billCode + partnerRefId + serviceCode
The string generated with the above parameters will be:

"billCode=PD12121&partnerRefId=AB123&serviceCode=ENVHN"

signature = HMAC_SHA256("billCode=PD12121&partnerRefId=AB123&serviceCode=ENVHN", YOUR_SECRET_KEY)

2. How to generate signature for API Payment bill

Example of parameters passed to the API

{
"amount": 100000,
"billDetail": [
{
"billNumber": "117934",
"period": "4/2020",
"amount": 100000,
"billCreated": "",
"billExpiry": "",
"billType": "",
"billOtherInfo": "",
"isPartialPaymentAllowed": false,
"extraInfo": ""
}
],
"partnerRefId": "AB123",
"billCode": "PD12121",
"serviceCode": "ENVHN",
"signature": "b10294bae53e89919b3efd62a763bf3..."
}

The order of parameters to create the signature will be sorted alphabetically.
The parameters are included into signature: amount + billCode + billDetail + partnerRefId + serviceCode
The string generated with the above parameters will be:

"amount=100000&billCode=PD12121&billDetail=Array&partnerRefId=AB123&serviceCode=ENVHN"

signature = HMAC_SHA256("amount=100000&billCode=PD12121&billDetail=Array&partnerRefId=AB123&serviceCode=ENVHN", YOUR_SECRET_KEY)

Example response of the API

{
"errorCode": 0,
"message": "Thành công",
"billDetail": [
{
"billNumber": "117934",
"period": "4/2020",
"amount": 100000,
"billCreated": "",
"billExpiry": "",
"billType": "",
"billOtherInfo": "",
"isPartialPaymentAllowed": false,
"extraInfo": ""
}
],
"transaction": {
"amount": 100000,
"billAmount":100000,
"appotapayTransId": "01ARXAAWEBDS",
"time": "10-04-2020 10:10:10"
},
"account": {
"balance": 12200000
},
"signature": "b10294bae53e89919b3efd62a763bf3228e260ef1a329..."
}

The order of parameters to create the signature will be sorted alphabetically.
The parameters are included into signature: amount + appotapayTransId + billAmount + errorCode + time
The string generated with the above parameters will be:

"amount=100000&appotapayTransId=01ARXAAWEBDS&billAmount=100000&errorCode=0&time=10-04-2020 10:10:10"

signature = HMAC_SHA256("amount=100000&appotapayTransId=01JCM8K321W0ZFHK99T8JBXR2P&errorCode=0&phoneNumber=0866123456&time=14-11-2024 09:38:43&topupAmount=100000", YOUR_SECRET_KEY)