No commit activity in last 3 years
No release in over 3 years
Merchant signature calculator for Adyen (https://www.adyen.com) payments service. It is implementation of HPP HMAC (SHA-256) algorithm from Adyen documentation (https://docs.adyen.com/display/TD/HPP+HMAC+calculation).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.4, ~> 10.4.2
~> 0.8.7, ~> 0.8.7.6
 Project Readme

Adyen HPP HMAC Calculator

AdyenHppHmacCalculator is a gem to calculate Adyen (http://www.adyen.com) Hosted Payment Pages HMAC (SHA-256). It is implementation of process described on next link: https://docs.adyen.com/display/TD/HPP+HMAC+calculation

Instalation

Install AdyenHppHmacCalculator using gem command:

    gem install adyen_hpp_hmac_calculator

or add it to your Gemfile:

    gem 'adyen_hpp_hmac_calculator'

Usage

You can calculate merchant signature on two ways. The first one is by using class method AdyenHppHmacCalculator::caluclate:

    hmac_key = "4468D9782DEF54FCD706C9100C71EC43932B1EBC2ACF6BA0560C05AAA7550C48"
    params = { 
      "merchantAccount"   => "TestMerchant",
      "currencyCode"      => "EUR",
      "paymentAmount"     => "199",
      "sessionValidity"   => "2015-06-25T10:31:06Z",
      "shipBeforeDate"    => "2015-07-01",
      "shopperLocale"     => "en_GB",
      "merchantReference" => "SKINTEST-1435226439255",
      "skinCode"          => "X7hsNDWp"
    }
    AdyenHppHmacCalculator.calculate(hamc_key, params) #=> "GJ1asjR5VmkvihDJxCd8yE2DGYOKwWwJCBiV3R51NFg="

The second one is by creating instance of AdyenHppHmacClaculator initialized with hmac_key. To calculate merchant signature use AdyenHppHmacCalculator#calculate like below:

    hmac_key = "4468D9782DEF54FCD706C9100C71EC43932B1EBC2ACF6BA0560C05AAA7550C48"
    adyen_hpp_hmac_calculator = AdyenHppHmacCalculator.new(hamc_key)
     
    params = { 
      "merchantAccount"   => "TestMerchant",
      "currencyCode"      => "EUR",
      "paymentAmount"     => "199",
      "sessionValidity"   => "2015-06-25T10:31:06Z",
      "shipBeforeDate"    => "2015-07-01",
      "shopperLocale"     => "en_GB",
      "merchantReference" => "SKINTEST-1435226439255",
      "skinCode"          => "X7hsNDWp"
    }
    adyen_hpp_hmac_calculator.calculate(params) #=> "GJ1asjR5VmkvihDJxCd8yE2DGYOKwWwJCBiV3R51NFg="