Transaction Notification

This code steps you through the basics of configuring Web Hooks to handle data that gets posted to a URL that's associated with your BluePay Platform Account. When you're using this code in "test mode," only test transactions are returned.

Please contact our integration team with your gateway account ID & the URL of your receiving script to have this feature enabled.

The following sample code makes method calls utilizing our ruby gem.
Download BluePay gem
Or, download via GitHub

##
# BluePay Ruby Sample code.
#
# This code sample shows a very based approach
# on handling data that is posted to a script running
# a merchant's server after a transaction is processed
# through their BluePay gateway account.
##

require_relative "../../lib/bluepay.rb"
require "cgi"

ACCOUNT_ID = "Merchant's Account ID Here"
SECRET_KEY = "Merchant's Secret Key Here"
MODE = "TEST"

tps = BluePay.new(account_id: ACCOUNT_ID, secret_key: SECRET_KEY, mode: MODE)

vars = CGI.new

# Assign values
trans_id = vars["trans_id"]
trans_status = vars["trans_status"]
trans_type = vars["trans_type"]
amount = vars["amount"]
batch_id = vars["batch_id"]
rebill_id = vars["rebill_id"]
rebill_amount = vars["reb_amount"]
rebill_status = vars["status"]
tps_hash_type = vars["TPS_HASH_TYPE"]
bp_stamp = vars["BP_STAMP"]
bp_stamp_def = vars["BP_STAMP_DEF"]

# Calculate expected bp_stamp
bp_stamp_string = ''
bp_stamp_def.split(' ').each do |field|
  bp_stamp_string += vars[field]
end
expected_stamp = tps.create_tps_hash(bp_stamp_string, tps_hash_type).upcase

# check if expected bp_stamp = actual bp_stamp
if expected_stamp == vars["BP_STAMP"]

  # Reads the response from BluePay
  puts 'Transaction ID: ' + trans_id
  puts 'Transaction Status: ' + trans_status
  puts  'Transaction Type: ' + trans_type
  puts  'Transaction Amount: ' + amount
  puts  'Rebill ID: ' + rebill_id
  puts  'Rebill Amount: ' + rebill_amount
  puts  'Rebill Status: ' + rebill_status
else
  puts 'ERROR IN RECEIVING DATA FROM BLUEPAY'
end
Can’t find what you’re
looking for? We can help.

Contact 800-350-2684 for Integration Support.

  • Microsoft Gold Partner Badge
  • Susan G. Komen for the Cure Supporter
  • 2018 American Business Awards Gold Stevie® Winner Badge for Best Payment and Electronic Commerce Solution
  • 2018 CNP Awards Customer Choice Winner Badge for Best E-Commerce Platform/Gateway
  • 2017 TSG Gateway Awards Winner Badge for Best Onboarding Process
  • Best in Biz Awards 2018 Silver Winner Badge for Business Development Department of the Year
BluePay Processing, LLC is a registered ISO of Wells Fargo Bank, N.A., Concord, CA, 94524 U.S.A.
BluePay Canada ULC, is a Registered ISO/MSP of Peoples Trust Company, Vancouver, Canada.