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

* BluePay Java 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.

package get_data;
import bluepay.*;

import javax.servlet.*;
import javax.servlet.http.*;

public class Transaction_Notification extends HttpServlet {
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {

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

    BluePay tps = new BluePay(

    // get POST parameters
    String TRANS_ID = request.getParameter("trans_id");
    String TRANS_STATUS = request.getParameter("trans_status");
    String TRANS_TYPE = request.getParameter("trans_type");
    String AMOUNT = request.getParameter("amount");
    String REBILL_ID = request.getParameter("rebill_id");
    String REBILL_AMOUNT = request.getParameter("reb_amount");
    String REBILL_STATUS = request.getParameter("status");
    String TPS_HASH_TYPE = request.getParameter("TPS_HASH_TYPE");
    String BP_STAMP = request.getParameter("BP_STAMP");
    String BP_STAMP_DEF = request.getParameter("BP_STAMP_DEF");

    // calculate expected bp_stamp
    String bpStampString = "";
    String[] bpStampFields = BP_STAMP_DEF.split("%20");
    for (String field : bpStampFields) {
      bpStampString += request.getParameter(field);
    bpStampString =, "UTF-8");
    String expectedStamp = "";
    try {
        expectedStamp = tps.generateTPS(bpStampString, TPS_HASH_TYPE).toUpperCase();
    } catch (NoSuchAlgorithmException e) {
    // check if expected bp_stamp = actual bp_stamp
    if (expectedStamp == BP_STAMP) {
    // output response
      System.out.println("Transaction ID: " + TRANS_ID);
      System.out.println("Transaction Status: " + TRANS_STATUS);
      System.out.println("Transaction Type: " + TRANS_TYPE);
      System.out.println("Transaction Amount: " + AMOUNT);
      System.out.println("Rebill ID: " + REBILL_ID);
      System.out.println("Rebill Amount: " + REBILL_AMOUNT);
      System.out.println("Rebill Status: " + REBILL_STATUS);
    } else {
        System.out.println("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
  • 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.