Skip to main content

Payload Hashing

If the destination endpoint requires a hash of the payload to verify authenticity, you may generate the hash value by constructing your detokenize payload and posting it to the payload hashing endpoint. This endpoint will detokenize the payload, perform any other processing, then hash the payload in its entirety using the hashing algorithm specified in the 'Type' query string parameter. Acceptable Type values are:

  • MD5
  • SHA1
  • SHA256
  • SHA384
  • SHA512

The payload hashing endpoint also supports the HMAC variants of the above algorithms:

  • HMACMD5
  • HMACSHA1
  • HMACSHA256
  • HMACSHA384
  • HMACSHA512
danger

To perform Hashing using HMAC key, the tx-HMACkey header must be supplied and its value must be in base64 encoded format.

The resulting hash will be returned in the body of the Response.

POST https://test-tgapi.tokenex.com/Hash?Type=SHA256 HTTP/1.1
Content-Type: application/json
TX-URL: https://www.example.com
TX-TokenEx-ID: YourTokenExID
TX-APIKey: YourAPIKey

{
{{{411111J7BDcj1111}}}
}

HMAC

POST https://test-tgapi.tokenex.com/Hash?Type=HMACSHA256 HTTP/1.1
Content-Type: application/json
TX-URL: https://www.example.com
TX-TokenEx-ID: YourTokenExID
TX-APIKey: YourAPIKey
TX-HMACKey: M2eUVlF3U0+OEQk6ttWSWA==

{
"card": {
"type": "MC",
"number": "{{{545454tEc3Hk5454}}}",
"expDate": "1126",
"cardValidationNum": "123"
}
}