Get a Recurring Payment Status
This code steps you through the process of establishing a rebilling transaction for the purpose of assigning a Transaction ID. You can then use this Transaction ID to check the status of rebilling in the future.
This code uses BluePay's Rebilling Administration Interface.
For documentation on usage of this interface Go to: Library documentation
You can test for both outcomes:
Approved: When you pass odd dollar amounts, this returns an 'Approved' status.
Declined: When you pass even dollar amounts, this returns a 'Declined' status.
The following sample code makes method calls utilizing our ruby gem.
Download BluePay gem
# BluePay Ruby Sample code.
# This code sample runs a $0.00 Credit Card Auth transaction
# against a customer using test payment information.
# Once the rebilling cycle is created, this sample shows how to
# get information back on this rebilling cycle.
# See comments below on the details of the initial setup of the
# rebilling cycle.
ACCOUNT_ID = "Merchant's Account ID Here"
SECRET_KEY = "Merchant's Secret Key Here"
MODE = "TEST"
rebill = BluePay.new(
address1: "123 Test St.",
address2: "Apt #500",
email: "[email protected]"
cc_number: "4111111111111111", # Customer Credit Card Number
cc_expiration: "1215", # Card Expiration Date: MMYY
cvv2: "123" # Card CVV2
reb_first_date: "2015-01-05", # Rebill Start Date: Jan. 5, 2015
reb_expr: "1 MONTH", # Rebill Frequency: 1 MONTH
reb_cycles: "11", # Rebill # of Cycles: 11
reb_amount: "15.00" # Rebill Amount: $15.00
# Sets a Card Authorization at $0.00
# Makes the API Request to create a recurring payment
# If transaction was successful..
rebill_status = BluePay.new(
# Find the rebill by ID and get rebill status
# Makes the API Request to get the rebill status
# Reads the response from BluePay
puts "REBILL STATUS: " + rebill_status.get_rebill_status
puts "REBILL ID: " + rebill_status.get_reb_id
puts "REBILL CREATION DATE: " + rebill_status.get_creation_date
puts "REBILL NEXT DATE: " + rebill_status.get_next_date
puts "REBILL LAST DATE: " + rebill_status.get_last_date
puts "REBILL SCHEDULE EXPRESSION: " + rebill_status.get_sched_expression
puts "REBILL CYCLES REMAINING: " + rebill_status.get_cycles_remaining
puts "REBILL AMOUNT: " + rebill_status.get_rebill_amount
puts "REBILL NEXT AMOUNT: " + rebill_status.get_next_amount