An HMAC combines a message with a secret key and a hash function to produce a tag that only someone holding the key can create. Payment providers, webhook senders and many REST APIs use it to prove that a request came from them and was not altered on the way.
Pick the algorithm the provider documents. HMAC-SHA256 is the modern default, HMAC-SHA1 still appears in older integrations, and HMAC-MD5 is included for compatibility. The output is shown as lowercase hexadecimal and as Base64, because providers differ on which encoding they expect.
The message must be byte-for-byte identical to the one the provider signed. Whitespace, JSON key order and line endings all change the result, so copy the raw request body rather than a re-formatted version.