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 calls a routine from our Code Library.
Download bluepay.pm
Or, download via GitHub

##
# BluePay Perl 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.
##


use strict;
use CGI;
use lib '..';
use bluepay;

my $account_id = "Merchant's Account ID Here";
my $secret_key = "Merchant's Secret Key Here";
my $mode = "TEST";

my $tps = BluePay->new(
    $account_id,
    $secret_key,
    $mode
);

my $vars = new CGI;

# Check if a Transaction ID was returned from BluePay
if (defined $vars->param("trans_id")) {

    # Assign values
    my $trans_id = $vars->param("trans_id");
    my $trans_status = $vars->param("trans_status");
    my $trans_type = $vars->param("trans_type");
    my $amount = $vars->param("amount");
    my $rebill_id = $vars->param("rebill_id");
    my $rebill_amount = $vars->param("reb_amount");
    my $rebill_status = $vars->param("status");
    my $tps_hash_type = $vars->param("TPS_HASH_TYPE");
    my $bp_stamp = $vars->param("BP_STAMP");
    my $bp_stamp_def = $vars->param("BP_STAMP_DEF");

    # Calculate expected bp_stamp
    my $bp_stamp_string = '';
    foreach my $field (split(' ', $bp_stamp_def)){
        $bp_stamp_string .= $vars->param($field);
    }
    my $expected_stamp = uc($tps->generate_tps($bp_stamp_string, $tps_hash_type));

    # If expected bp_stamp = actual bp_stamp
    if ($expected_stamp eq $bp_stamp) {

    # Get response from BluePay
        print 'Transaction ID: ' + $trans_id;
        print 'Transaction Status: ' + $trans_status;
        print  'Transaction Type: ' + $trans_type;
        print  'Transaction Amount: ' + $amount;
        print  'Rebill ID: ' + $rebill_id;
        print  'Rebill Amount: ' + $rebill_amount;
        print  'Rebill Status: ' + $rebill_status;
    }
    else {
        print "ERROR IN RECEIVING DATA FROM BLUEPAY";
    }
} else {
    print "ERROR";
}
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
  • Best in Biz Awards 2018 Silver Winner Badge for Business Development Department of the Year
  • TSG Gateway Awards 2019 BluePay
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.