Dinger

Developer / Production API / Merchant Callback

Merchant Callback


callback to 3rd party

After user do pay online, dinger will push the result to the merchant callback url . The result contains two fields. Dinger will also invoke to your callback url if the transaction is success or fail. If it is in pending status, dinger will not invoke the callback url.

• paymentResult (Needs to decrypt the paymentResult response with Base64 first and then with AES/ECB/PKCS7Padding algorithm)

• checksum(sha256(jsonString(resultObj))

Testing Callback Key - d655c33205363f5450427e6b6193e466



Request

This API requests only one payload param(base64(rsa(obj)) string) in form body.


Sample Response After Decryption


{
   "totalAmount":1000,
   "createdAt":"20210916 085233",
   "transactionStatus":"SUCCESS",
   "methodName":"QR",
   "merchantOrderId":"0586",
   "transactionId":"TRX312720215216085254",
   "customerName":"Min Thu Kyaw",
   "providerName":"KBZ Pay"
}

Decryption Code Sample



                                        
from Crypto.Util.Padding import pad
from Crypto.Cipher import AES
import base64
 
class PrpCrypt(object):
 
    def __init__(self):
        self.unpad = lambda date: date[0:-ord(date[-1])]
 
    def aes_cipher(self, key, aes_str):
        aes = AES.new(key.encode('utf-8'), AES.MODE_ECB)
        pad_pkcs7 = pad(aes_str.encode('utf-8'), AES.block_size, style='pkcs7') 
        encrypt_aes = aes.encrypt(pad_pkcs7)
        encrypted_text = str(base64.encodebytes(encrypt_aes), encoding='utf-8') 
        encrypted_text_str = encrypted_text.replace("\n", "")
 
        return encrypted_text_str
 
    def decrypt(self, key, decrData):
        res = base64.decodebytes(decrData.encode("utf8"))
        aes = AES.new(key.encode('utf-8'), AES.MODE_ECB)
        msg = aes.decrypt(res).decode("utf8")
        return self.unpad(msg)
 
 
if __name__ == '__main__':
    # replace with your callback key
    key = "d655c33205363f5450427e6b6193e466"

    # callback data to be decrypted
    paymentResult = "mX2Ku+jslxIXDSQMxl3wzDclIiKilKlakN2149ijiV467m3lgyQTHuUlobdKDUrfxa5xlMg5HLj9MuO0WWssf+EjcRnPI8LMxU7LnM8lDYO52QeuU1bZ/0WV95jzJ1jOt6AJXNiSl+wu6wy6sQioCjVyyRXIpSug/4pokaXkIdQCpZo/YKa5QpVtSf1DucnCG/ESsxTw1sJQ39Pox8tdbcSvTPZrdFzcAyi/C8JFVtavTaUS8X1QndfKQphquZVhfKhVBA8etZaMwsoclfB8/e8mCSMUn+2s7/LYf9i9QHqlVdoS2ssTqJT+Rcfs9/Wa"
        
    result = PrpCrypt().decrypt(key,paymentResult)
    print(result)


Callback Response Parameters

Content of Payment Result

Name Type Mandatary Description
totalAmount Integer Yes
createdAt String Yes yyyyMMdd HHmmss
transactionStatus String Yes SUCCESS, ERROR, CANCELLED, TIMEOUT,DECLINED, SYSTEM_ERROR
methodName String Yes
providerName String Yes
customerName String Yes
merchantOrderId String Yes
transactionId String Yes