+ Start a Discussion
shailesh.gusain.sfd1.3960741070027976E12shailesh.gusain.sfd1.3960741070027976E12 

Authentication header for sage payment solutions

i am integrating salesforce with sage payement solutions gateway.
As per documentation: header value is made up of your M_ID and a HMAC of the request being made. The HMAC is a specific construction for calculating a message authentication code (MAC) involving a cryptographic hash function in combination with a secret cryptographic key. The result should be base 64 encoded for HTTP transport. The secret cryptographic key is your M_KEY.

HMAC = base64encode( H( K , m ) )
k = M_key
m = “POST” + URL + Message Body

like this:- HMAC = base64encode( hmacsha1( “ABCDEF123456” , “POST” + “https://gateway.sagepayments.net/web_services/gateway/api/healthcaretransactions” + “message body” ) )

M_id = 123456789012
header will be = ('Authentication', M_id+ ':'+lropGMzgNaomkwam+lNzYLH8rds=)

how to get it work in saleforce?
i am trying but getting 401 - Unauthorized.

Thanks in advance