Adyen HHP HMAC Generator
HMAC Generator for Adyen Hosted Payment Pages
Installation
Install with composer
composer require thomaslorentsen/adyen-hpp-hmac
Usage
$hmacKey = 'YOUR_HMAC_KEY'
$params = [
"merchantReference" => "SKINTEST-123456789",
"merchantAccount" => "merchantAccount",
"currencyCode" => "GBP",
"paymentAmount" => "2000",
"sessionValidity" => "2020-12-25T10:31:06Z",
"shipBeforeDate" => "2017-08-25",
"shopperLocale" => "en_GB",
"skinCode" => "skinCode",
"brandCode" => "paypal_ecs",
"shopperEmail" => "test@adyen.com",
"shopperReference" => "123",
];
You can call the function directory to get a hash
adyen_hmac($hmacKey, $params);
Get a hash using the class
$signature = new Signature();
$hash = $signature->generate($hmacKey, $params);
Validate a hash
$signature = new Signature($hmacKey);
$hash = $signature->validate($signature, $params);
Testing
vendor/bin/phpunit