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.php
Or, download via GitHub

<?php
/**
* BluePay PHP 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.
*/
include('../BluePay.php');
$accountID = "Merchant's Account ID Here";
$secretKey = "Merchant's Secret Key Here";
$mode = "TEST";
$tps = new BluePay(
   
$accountID,
   
$secretKey,
   
$mode
);
// get POST parameters
$transID = isset($_REQUEST['trans_id']) ? $_REQUEST['trans_id'] : null;
$transStatus = isset($_REQUEST['trans_status']) ? $_REQUEST['trans_status'] : null;
$transType = isset($_REQUEST['trans_type']) ? $_REQUEST['trans_type'] : null;
$amount = isset($_REQUEST['amount']) ? $_REQUEST['amount'] : null;
$rebillID = isset($_REQUEST['rebill_id']) ? $_REQUEST['rebill_id'] : null;
$rebillAmount = isset($_REQUEST['reb_amount']) ? $_REQUEST['reb_amount'] : null;
$rebillStatus = isset($_REQUEST['status']) ? $_REQUEST['status'] : null;
$bpStamp = isset($_REQUEST['BP_STAMP']) ? $_REQUEST['BP_STAMP'] : null;
$bpStampDef = isset($_REQUEST['BP_STAMP_DEF']) ? $_REQUEST['BP_STAMP_DEF'] : null;
$tpsHashType = isset($_REQUEST['TPS_HASH_TYPE']) ? $_REQUEST['TPS_HASH_TYPE'] : null;
// calculate expected bp_stamp
$bpStampFields = explode(' ', $bpStampDef); // Split BP_STAMP_DEF on whitespace
$bpStampString = '';
$fieldValue = '';
foreach (
$bpStampFields as $field) {
   
$fieldValue = isset($_REQUEST[$field]) ? $_REQUEST[$field] : null;
   
$bpStampString .= $fieldValue; // Concatenate values used to calculate expected BP_STAMP
}
$expectedStamp = $tps->createTPSHash($bpStampString, $tpsHashType);
// check if expected bp_stamp = actual bp_stamp
if (!empty($bpStamp)) {
    if (
$bpStamp == $expectedStamp) {
       
// Read response from BluePay
       
echo 'Transaction ID: ' . $transID . '<br />' .
       
'Transaction Status: ' . $transStatus . '<br />' .
       
'Transaction Type: ' . $transType . '<br />' .
       
'Transaction Amount: ' . $amount . '<br />' .
       
'Rebill ID: ' . $rebillID . '<br />' .
       
'Rebill Amount: ' . $rebillAmount . '<br />' .
       
'Rebill Status: ' . $rebillStatus . '<br />';
    } else {
        echo
'ERROR IN RECEIVING DATA FROM BLUEPAY';
    }
}
?>

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.