How to Use a Token
This code steps you through the process of using a token to validate a customer's credit card information and capture authorization information for a charge against the card. Tokens can be used to process many types of future transactions such as payments, sales, refunds, and cancellations. Other returned information includes the status, a message, an address verification (AVS) result, and card verification data (CVV2) result.
The token that this code returns is an assigned Transaction ID. Depending on the interface you're using, this Transaction ID is either "Master ID" or "RRNO."
You can test for both outcomes:
Approved: When you pass odd dollar amounts, payment authorizations are returned with an 'Approved' status and authorization information is also captured.
Declined: When you pass even dollar amounts, payment authorizations are returned with a 'Declined' status and no authorization information is passed.
The following sample code calls a routine from our Code Library.
' * Bluepay VB.NET Sample code.
' * This code sample runs a $3.00 Credit Card Auth transaction
' * against a customer using test payment information.
' * If approved, a 2nd transaction is run to capture the Auth.
' * If using TEST mode, odd dollar amounts will return
' * an approval and even dollar amounts will return a decline.
Public Class How_To_Use_Token
Public Sub New()
Public Shared Sub Main()
Dim accountID As String = "MERCHANT'S ACCOUNT ID HERE"
Dim secretKey As String = "MERCHANT'S SECRET KEY HERE"
Dim mode As String = "TEST"
' Merchant's Account ID
' Merchant's Secret Key
' Transaction Mode: TEST (can also be LIVE)
Dim payment As BluePayPayment_BP10Emu = New BluePayPayment_BP10Emu(
' Card Number: 4111111111111111
' Card Expire: 12/15
' Card CVV2: 123
' First Name: Bob
' Last Name: Tester
' Address1: 123 Test St.
' Address2: Apt #500
' City: Testville
' State: IL
' Zip: 54321
' Country: USA
"123 Test St.",
' Phone #: 123-123-1234
' Email Address: firstname.lastname@example.org
' Auth Amount: $3.00
Dim result As String = payment.Process()
' If transaction was approved..
If (result = "1") Then
Dim paymentCapture As BluePayPayment_BP10Emu = New BluePayPayment_BP10Emu(
' Captures auth using Transaction ID token returned
' Outputs response from BluePay gateway
Console.Write("Transaction ID: " + paymentCapture.getTransID() + Environment.NewLine)
Console.Write("Message: " + paymentCapture.getMessage() + Environment.NewLine)
Console.Write("Status: " + paymentCapture.getStatus() + Environment.NewLine)
Console.Write("AVS Result: " + paymentCapture.getAVS() + Environment.NewLine)
Console.Write("CVV2 Result: " + paymentCapture.getCVV2() + Environment.NewLine)
Console.Write("Masked Payment Account: " + paymentCapture.getMaskedPaymentAccount() + Environment.NewLine)
Console.Write("Card Type: " + paymentCapture.getCardType() + Environment.NewLine)
Console.Write("Authorization Code: " + paymentCapture.getAuthCode() + Environment.NewLine)