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

' *
' * Bluepay VB.NET 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.
' *

Imports System
Imports vbnet.BPVB
Imports System.IO
Imports System.Collections.Specialized
Imports System.Web
Imports System.Net

Namespace GetData

     Public Class TransactionNotification

        Public Sub New()
        End Sub

        Public Shared Sub run()
            Dim accountID As String = "Merchant's Account ID Here"
            Dim secretKey As String = "Merchant's Secret Key Here"
            Dim mode As String = "TEST"

            Dim tps As BluePay = New BluePay(

            Dim listener As HttpListener = New HttpListener()
            Dim prefix As String = "http://localhost:8080/" ' Change this to your listener URL (and optionally port)
            Dim responseString As String = ""

                'Listen for incoming data
            Catch ex As HttpListenerException
            End Try
            While (listener.IsListening)
                Dim context As HttpListenerContext = listener.GetContext()
                Dim response As HttpListenerResponse = context.Response
                Dim body As String = New StreamReader(context.Request.InputStream).ReadToEnd()

                ' Return HTTP Status of 200 to BluePay
                context.Response.StatusCode = 200
                context.Response.KeepAlive = False
                context.Response.ContentLength64 = body.Length

                ' Get Response
                Dim buffer() As Byte = System.Text.Encoding.UTF8.GetBytes(body)
                response.ContentLength64 = buffer.Length
                Dim output As System.IO.Stream = response.OutputStream
                output.Write(buffer, 0, buffer.Length)
                responseString = System.Text.Encoding.ASCII.GetString(buffer)

                ' Parse data into a NVP collection
                Dim vals As NameValueCollection = HttpUtility.ParseQueryString(responseString)
                Dim bpStampDef As String = vals("BP_STAMP_DEF")
                Dim tpsHashType As String = vals("TPS_HASH_TYPE")
                Dim bpStampVals As String
                Dim strArr() As String
                Dim i As Integer
                strArr = bpStampDef.Split(" ")
                For i = 0 To strArr.Length - 1
                    bpStampVals += vals(strArr(i))

                ' calculate the expected BP_STAMP
                Dim bpStamp As String = tps.generateTPS(bpStampVals, tpsHashType)

                ' Output data if the expected bp_stamp matches the actual BP_STAMP
                If bpStamp = vals("BP_STAMP") Then
                    Console.Write("Transaction ID: " + vals("trans_id"))
                    Console.Write("Transaction Status: " + vals("trans_stats"))
                    Console.Write("Transaction Type: " + vals("trans_type"))
                    Console.Write("Transaction Amount: " + vals("amount"))
                    Console.Write("Rebill ID: " + vals("rebill_id"))
                    Console.Write("ERROR IN RECEIVING DATA FROM BLUEPAY")
                End If

            End While
        End Sub
    End Class
End Namespace
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.