Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xtrasimplicity/5802c030d196f8570bbd93c4fb6371cf to your computer and use it in GitHub Desktop.
Save xtrasimplicity/5802c030d196f8570bbd93c4fb6371cf to your computer and use it in GitHub Desktop.
Generating a fingerprint for SecurePay Australia's DirectPost integration.
require 'openssl'
raw_fingerprint = [merchant_id, merchant_password, transaction_type, reference_id, amount, timestamp].join('|')
digest = OpenSSL::Digest.new('sha256')
fingerprint = OpenSSL::HMAC.hexdigest(digest, merchant_password, raw_fingerprint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment