Skip to main content
Version: Lastest

Security

1. How to generate signature for API Buy card code

Example of parameters passed to the API

{
"partnerRefId": "AB123",
"productCode": "AC100",
"quantity": 10,
"signature": "b10294bae53e89919b3efd62a763bf3..."
}

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

"partnerRefId=AB123&productCode=AC100&quantity=10"

signature = HMAC_SHA256("partnerRefId=AB123&productCode=AC100&quantity=10", YOUR_SECRET_KEY)

With type: "sms"

{
"partnerRefId": "AB123",
"productCode": "VT10",
"type": "sms",
"quantity": 1,
"customerPhone": "0912345678",
"signature": "b10294bae53e89919b3efd62a763bf3..."
}

The parameters are included into signature: partnerRefId + productCode + quantity + type + customerPhone
Just like in the previous example, the string generated with the above parameters will be:

"customerPhone=0912345678&partnerRefId=AB123&productCode=VT10&quantity=1&type=sms"

signature = HMAC_SHA256("customerPhone=0912345678&partnerRefId=AB123&productCode=VT10&quantity=1&type=sms", YOUR_SECRET_KEY)