HMAC Signature Verification
The section describes how the hmac signature sent in the callback header OR in the redirect data can be verified
Last updated
The section describes how the hmac signature sent in the callback header OR in the redirect data can be verified
Last updated
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 you account details in the merchant dashboard. GovBill 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 (sample redirect data is available );
Obtain the value of the hmac-signature
header (if callback) OR the value of the hmac_signature
query parameter (if redirect). The value sent in the signature header takes the format t=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 be transaction.failed:MCTREFYDPE9LMZ34S8HM:GOVBILGHQ6ZDXFK7C7NJ:COLLECTION:FAILED
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