thomaslorentsen/adyen-hpp-hmac

HMAC Generator for Adyen Hosted Payment Pages

v0.3.1 2017-09-07 11:41 UTC

This package is not auto-updated.

Last update: 2024-04-24 00:23:52 UTC


README

Build Status Packagist Coverage Status

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