HMAC Signature Verification
The section describes how the HMAC signature sent in the callback header OR in the redirect data can be verified
Obtain the Signing Key
The signing key is an alpha-numeric string generated by our platform during your merchant account creation and it is stored against your account record. This value can be found under your account details in the merchant dashboard. DusuPay uses this value to create the HMAC signature and the same will be used when verifying the signature. It is recommended that it is copied and stored safely together with the security keys.
Below is the sample callback data to be used for the demonstration.
Next Steps
Obtain the value of the
hmac-signature
header (if callback) OR the value of thehmac_signature
query parameter (if redirect). The value sent in the signature header takes the formatt=timestamp,s=hmac_hash
Form the string payload to be used in signature verification. This is obtained by concatenating values of the callback/redirect data in the format;
event:merchant_reference:internal_reference:transaction_type:transaction_status
and these values are obtained from the callback/redirect data. The string payload in this case would therefore betransaction.completed:MCTREFT2WMNWZ23SBN6Y:DUSUPAYRMGRXNNYBWATKJ:COLLECTION:COMPLETED
Create the hmac hash of the string payload.
Compare the resulting hash to the value in the hmac-signature header. Equality means the signature is valid.
Below is a sample signature generated using the signing key: SGNKYUEMYFDEHRWGPEUG
Last updated