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:
'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.
# BluePay Ruby 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.
ACCOUNT_ID = "Merchant's Account ID"
SECRET_KEY = "Merchant's Secret Key"
MODE = "TEST"
payment = BluePay.new(
address1: "123 Test St.",
address2: "Apt #500",
email: "[email protected]"
cc_number: "4111111111111111", # Customer Credit Card Number
cc_expiration: "1225", # Card Expiration Date: MMYY
cvv2: "123" # Card CVV2
payment.sale(amount: "3.00") # Sale Amount: $3.00
# Makes the API Request for processing the sale
# If transaction was approved..
payment_update = BluePay.new(
# Creates an update transaction against previous sale
trans_id: payment.get_trans_id, # id of previous transaction to update
amount: "5.75" # add $2.75 to previous amount
# Makes the API Request to process update
# Reads the response from BluePay
puts "TRANSACTION STATUS: " + payment_update.get_status
puts "TRANSACTION MESSAGE: " + payment_update.get_message
puts "TRANSACTION ID: " + payment_update.get_trans_id
puts "AVS RESPONSE: " + payment_update.get_avs_code
puts "CVV2 RESPONSE: " + payment_update.get_cvv2_code
puts "MASKED PAYMENT ACCOUNT: " + payment_update.get_masked_account
puts "CARD TYPE: " + payment_update.get_card_type
puts "AUTH CODE: " + payment_update.get_auth_code
855-812-5191 to get access to the applicable integration modules.