Outcome - Understand how to calculate the hamc value for the card token callback
Step 1: Sort the Data Lexicographically by Key
Sort the parameters received in the callback in lexicographical order based on their keys. The keys/parameters should be in the same order as shown in the list below.
Shape of data received:
HMAC String Keys:
Step 2: Concatenate the Values
Concatenate the values of the keys/parameters into a single string in the same order as they are listed. This string will be used to calculate the HMAC in the next step. For example, if we consider the sample transaction processed callback, the resultant string would look like this:
HMAC Concatenated String:
Step 3: Calculate the HMAC
Use your HMAC secret and the SHA-512 hashing algorithm to generate an HMAC from the concatenated string.
HMAC Calculated Sample:
Step 4: Compare the Calculated HMAC
Compare the HMAC value you calculated with the hmac value received in the query strings of the callback to verify the integrity and authenticity of the data.