Update a Transaction

This code steps you through the process of updating an existing transaction (i.e. for tips).

There are three outcomes when processing credit card transactions:

  1. Approved
  2. Declined
  3. Error

'Approved' transactions can be charged against customers' credit cards. 'Declined' transactions can't be charged. As a result, in order to test the process of charging a customer's credit card, you must first pass an odd dollar amount. This returns the transaction with an 'Approved' status. You can then charge the credit card to complete the transaction.

An error could result from a variety of conditions such as missing data, invalid card numbers, and expiration dates provided in invalid formats.

The following sample code calls a routine from our Code Library.
Download BluePay.php
Or, download via GitHub

' *
' * Bluepay VB.NET Sample code.
' *
' * This code sample runs a $3.00 Credit Card Sale transaction
' * against a customer using test payment information. If
' * approved, a 2nd transaction is run to update the first transaction
' * to $5.75, $2.75 more than the original $3.00.
' * If using TEST mode, odd dollar amounts will return
' * an approval and even dollar amounts will return a decline.
' *

Imports System
Imports vbnet.BPVB

Namespace Transactions

    Public Class UpdateTransaction

        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 payment As BluePay = New BluePay(
                accountID,
                secretKey,
                mode
            )

            payment.setCustomerInformation(
                firstName:="Bob",
                lastName:="Tester",
                address1:="12345 Test St.",
                address2:="Apt #500",
                city:="Testville",
                state:="IL",
                zipCode:="54321",
                country:="USA",
                phone:="123-123-12345",
                email:="[email protected]"
            )

            payment.setCCInformation(
                ccNumber:="4111111111111111",
                ccExpiration:="1225",
                cvv2:="123"
            )

            payment.sale(amount:="3.00")

            payment.process()
           
            If payment.isSuccessfulTransaction() Then
               
                Dim paymentUpdate As BluePay = New BluePay(
                    accountID,
                    secretKey,
                    mode
                )

                ' Updates a transaction from previous sale
                paymentUpdate.update(transactionID:= payment.GetTransID(), amount:="5.75")

                paymentUpdate.process()

                Console.Write("Transaction Status: " + paymentUpdate.getStatus() + Environment.NewLine)
                Console.Write("Transaction Message: " + paymentUpdate.getMessage() + Environment.NewLine)
                Console.Write("Transaction ID: " + paymentUpdate.getTransID() + Environment.NewLine)
                Console.Write("AVS Result: " + paymentUpdate.getAVS() + Environment.NewLine)
                Console.Write("CVV2 Result: " + paymentUpdate.getCVV2() + Environment.NewLine)
                Console.Write("Masked Payment Account: " + paymentUpdate.getMaskedPaymentAccount() + Environment.NewLine)
                Console.Write("Card Type: " + paymentUpdate.getCardType() + Environment.NewLine)
                Console.Write("Authorization Code: " + paymentUpdate.getAuthCode() + Environment.NewLine)
            Else
                Console.Write("Transaction Error: " + payment.getMessage() + Environment.NewLine)
            End If
        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
  • 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.