2 posts / 0 new
Last post
ramiromartinez11978
HMAC validation Failure

Hi all, i am sendig this request:

POST /v1/transaction HTTP/1.1
Host: api-cert.payeezy.com
Content-Type: application/json
apiKey: fpeAnZm0t6nX2afcUGGkLuAIEtKr4K3N
token: fdoa-790b082c6b83f8944a51b683fb377389790b082c6b83f894
nonce: 4001686741
timestamp: 1482422110000
Authorization: MzQyNDdhOWE1MWRhZTUwY2RmYmY4NzhjYWJhMjAzZDM1Nzc1MGE1ODVkOTk1NjMxY2ViN2FmZjRkMWY1Y2QyZTkwYWMzNzNkMjMzMWYyYTgwNDFkM2FkNGQ1Y2RmMWViMDBlZmJhZmY1NWY2NTVhZjRiZDY0ZDAwNGViNmRhOTE=
Cache-Control: no-cache
Postman-Token: 8b0e37dd-bf7a-cff7-ddef-24402b99852e

{
"transaction_type":"purchase",
"amount":"150075",
"currency_code":"USD",
"credit_card": {
"type":"Visa",
"cvv":"123",
"cardholder_name":"Ramiro Martinez",
"card_number":"4788250000028291",
"exp_date":"1020"
}
}

And i get the next response:

{
"code": "403",
"message": "HMAC validation Failure"
}

I generated the hmac authorization data using this code (from the Payeezy PHP GITHUB examples):

$cstrong = true;
$nonce = strval(hexdec(bin2hex(openssl_random_pseudo_bytes(4, $cstrong))));
$timestamp = strval(time() * 1000);
$phrase = $this->key . $nonce . $timestamp . $this->merchant . $payload;
$hmac = hash_hmac(static::HMAC_HASH_ALG, $phrase, $this->secret, false);
$authorization = base64_encode($hmac);

return [
'nonce' => $nonce,
'timestamp' => $timestamp,
'authorization' => $authorization
];

Any ideas ?


riteshkumarshah...
Re: HMAC validation Failure

We use SHA256.

You should be able to see the full details at 

https://developer.payeezy.com/payeezy-api/apis/post/transactions-3

click on headers

Click on i next to generate HMAC