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.
# BluePay Python 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(
account_id = account_id,
secret_key = secret_key,
mode = mode
name1 = "Bob",
name2 = "Tester",
addr1 = "123 Test St.",
addr2 = "Apt #501",
city = "Testville",
state = "IL",
zipcode = "54321",
country = "USA"
card_number = "4111111111111111",
card_expire = "1215",
cvv2 = "123"
# Set Recurring Payment Information
reb_first_date = "2015-01-01", # Rebill Start Date: Jan. 1, 2015
reb_expr = "1 MONTH", # Rebill Frequency: 1 MONTH
reb_cycles = "12", # Rebill # of Cycles: 12
reb_amount = "15.00" # Rebill Amount: $15.00
# Auth Amount: $0.00
rebill.auth(amount = '0.00')
# Makes the API Request for a recurring payment authorization
# If transaction was approved..
rebill_status = BluePay(
account_id = account_id, # Merchant's Account ID
secret_key = secret_key, # Merchant's Secret Key
mode = mode # Transaction Mode: TEST (can also be LIVE)
# Find the rebill by ID and get rebill status
# Makes the API Request to get the rebill status
# Reads response from BluePay
print 'Rebill Status: ' + rebill_status.rebill_status_response
print 'Rebill ID: ' + rebill_status.rebill_id_response
print 'Rebill Creation Date: ' + rebill_status.creation_date_response
print 'Rebill Next Date: ' + rebill_status.next_date_response
print 'Rebill Last Date: ' + rebill.last_date_response
print 'Rebill Schedule Expression: ' + rebill_status.sched_expression_response
print 'Rebill Cycles Remaining: ' + rebill_status.cycles_remaining_response
print 'Rebill Amount: ' + rebill_status.rebill_amount_response
print 'Rebill Next Amount: ' + rebill_status.next_amount_response