Example #1
0
# against a customer using test payment information.
# Optional transaction data is also sent.
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##

import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(name1="Bob",
                                 name2="Tester",
                                 addr1="123 Test St.",
                                 addr2="Apt #500",
                                 city="Testville",
                                 state="IL",
                                 zipcode="54321",
                                 country="USA")

payment.set_cc_information(card_number="4111111111111111",
                           card_expire="1215",
                           cvv2="123")

# Optional fields users can set
Example #2
0
# and creates a customer token using test payment information,
# which is then used to run a separate $3.99 sale.
##

from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

store_payment = BluePay(account_id=account_id,
                        secret_key=secret_key,
                        mode=mode)

store_payment.set_customer_information(
    name1="Bob",
    name2="Tester",
    addr1="123 Test St.",
    addr2="Apt #500",
    city="Testville",
    state="IL",
    zipcode="54321",
    #stored_indicator = 'F',
    #stored_type = 'C',
    #stored_id = 'TESTID526957756',
    country="USA")
# customer for $1.75 of the $3.00.
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##

import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

payment.set_cc_information(
# from the BluePay gateway based on certain criteria.
# See comments below on the details of the report.
# If using TEST mode, only TEST transactions will be returned.
##

import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

report = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode 
)

report.get_single_trans_query(
    transaction_id = 'ID of previous transaction', # Transaction ID
    report_start = "2015-01-01", # Query Start Date: Jan. 1, 2013
    report_end = "2015-04-30", # Query End Date: Jan. 15, 2015
    exclude_errors =  "1" # Do not include errored transactions? Yes
 ) 

# Makes the API Request with BluePay
report.process()

# Reads the response from BluePay
print report.response
#
# This code sample runs a $3.00 ACH Sale transaction
# against a customer using test payment information.
##

import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

# Set ACH Payment Information
    batch_status = vars["batch_status"]
    total_count = vars["total_count"]
    total_amount = vars["total_amount"]
    batch_upload_id = vars["batch_upload_id"]
    rebill_id = vars["rebill_id"]
    rebill_amount = vars["reb_amount"]
    rebill_status = vars["status"]

    # Calculate expected bp_stamp
    bp_stamp = BluePay.calc_trans_notify_TPS(secret_key,
        trans_id,
        trans_status,
        trans_type,
        amount,
        batch_id,
        batch_status,
        total_count,
        total_amount,
        batch_upload_id,
        rebill_id,
        rebill_amount,
        rebill_status)

    # check if expected bp_stamp = actual bp_stamp
    if bp_stamp == vars["bp_stamp"]:

        # Get response from BluePay
        print 'Transaction ID: ' + trans_id
        print 'Transaction Status: ' + trans_status
        print  'Transaction Type: ' + trans_type
        print  'Transaction Amount: ' + amount
# This code sample runs a report that grabs data from the
# BluePay gateway based on certain criteria.
# If using TEST mode, only TEST transactions will be returned.
##
from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

report = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode 
)

report.get_transaction_report(
    report_start = '2015-01-01', # Report Start Date: Jan. 1, 2015
    report_end = '2015-04-30', # Report End Date: Aprl. 30, 2015
    subaccounts_searched = '1', # Also search subaccounts? Yes
    do_not_escape = '1', # Output response without commas? Yes
    exclude_errors = '1' # Do not include errored transactions? Yes
)

# Makes the API request to BluePay
report.process()

# Reads the response from BluePay
Example #8
0
# BluePay Python Sample code.
#
# This code sample creates a recurring payment charging $15.00 per month for one year.
##
from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

# Set ACH Payment Information
Example #9
0
# through their BluePay gateway account.
##
from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay
import cgi

vars = cgi.FieldStorage()

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

tps = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

try:
    # Assign values
    trans_id = vars["trans_id"]
    trans_status = vars["trans_status"]
    trans_type = vars["trans_type"]
    amount = vars["amount"]
    rebill_id = vars["rebill_id"]
    rebill_amount = vars["reb_amount"]
    rebill_status = vars["status"]
    tps_hash_type = vars["TPS_HASH_TYPE"]
    bp_stamp = vars["BP_STAMP"]
    bp_stamp_def = vars["BP_STAMP_DEF"]

    # Calculate expected bp_stamp
Example #10
0
#
# This code sample runs a $3.00  sales transaction using the payment information obtained from a credit card swipe.
# If using TEST mode, odd dollar amounts will return an approval and even dollar amounts will return a decline.
##

import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
) 

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

# Set payment information for a swiped credit card 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.
##
from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

payment.set_cc_information(
# and creates a customer token using test payment information,
# which is then used to run a separate $3.99 sale.
##

from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

store_payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

store_payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

store_payment.set_cc_information(
# Optional transaction data is also sent.
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##

import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

payment.set_cc_information(
Example #14
0
# BluePay to be used for further transactions.
# Note: THIS DOES NOT ENSURE THAT THE CREDIT CARD OR ACH
# ACCOUNT IS VALID.
##
from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

store_payment = BluePay(account_id=account_id,
                        secret_key=secret_key,
                        mode=mode)

store_payment.set_customer_information(
    name1="Bob",
    name2="Tester",
    addr1="123 Test St.",
    addr2="Apt #500",
    city="Testville",
    state="IL",
    zipcode="54321",
    #stored_indicator = 'F',
    #stored_type = 'C',
    #stored_id = 'TESTID526957756',
    country="USA")
# BluePay Python Sample code.
#
# This code sample runs a $3.00 CC Sale transaction
# against a customer using test payment information.
##
from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(
    name1="Bob",
    name2="Tester",
    addr1="123 Test St.",
    addr2="Apt #500",
    city="Testville",
    state="IL",
    zipcode="54321",
    #stored_indicator = "F",
    #stored_type = "C",
    #stored_id = "TESTID526957756",
    country="USA")

payment.set_cc_information(card_number="4111111111111111",
print("Content-type:text/html\r\n\r\n")
print("<html><head></head><body>")

response = cgi.FieldStorage()

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  


if "BP_STAMP" in response: # Check whether BP_STAMP is provided

    bp = BluePay(
        account_id = account_id, 
        secret_key = secret_key, 
        mode = mode 
    )

    bp_stamp_string = ''
    for field in response["BP_STAMP_DEF"].value.split(' '): # Split BP_STAMP_DEF on whitespace
        bp_stamp_string += response[field].value # Concatenate values used to calculate expected BP_STAMP

    expected_stamp = bp.create_tps_hash(bp_stamp_string, response["TPS_HASH_TYPE"].value).upper() # Calculate expected BP_STAMP using hash function specified in response
    if expected_stamp == response['BP_STAMP'].value: # Compare expected BP_STAMP with received BP_STAMP
        # Validate BP_STAMP and reads the response results
        print("VALID BP_STAMP: TRUE<br/>")
        for key in response.keys():
            print(key + ': ' + response[key].value + "<br/>")
    else:
        print("ERROR: BP_STAMP VALUES DO NOT MATCH<br/>")
# This code sample runs a report that grabs data from the
# BluePay gateway based on certain criteria.
# If using TEST mode, only TEST transactions will be returned.
##
from __future__ import print_function
import os.path, sys

sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

report = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

report.get_transaction_report(
    report_start='2015-01-01',  # Report Start Date: Jan. 1, 2015
    report_end='2015-04-30',  # Report End Date: Aprl. 30, 2015
    subaccounts_searched='1',  # Also search subaccounts? Yes
    do_not_escape='1',  # Output response without commas? Yes
    exclude_errors='1'  # Do not include errored transactions? Yes
)

# Makes the API request to BluePay
report.process()

# Reads the response from BluePay
print(report.response)
# Once the rebilling cycle is created, this sample shows how to
# update the rebilling cycle. See comments below
# on the details of the initial setup of the rebilling cycle as well as the
# updated rebilling cycle.
##

import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

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)

rebill.set_customer_information(name1="Bob",
                                name2="Tester",
                                addr1="1234 Test St.",
                                addr2="Apt #500",
                                city="Testville",
                                state="IL",
                                zipcode="54321",
                                country="USA")

rebill.set_cc_information(card_number="4111111111111111",
                          card_expire="1215",
                          cvv2="123")

# Set Recurring Payment Information
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##

from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
) 

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

payment.set_cc_information(
# BluePay Python Sample code.
#
# This code sample creates a recurring payment charging $15.00 per month for one year.
##

import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

payment.set_cc_information(
# using a token from a previous transaction.
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##

import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"
token = "Transaction ID here"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

# Charges a customer $3.00 using the payment information from a previous transaction.
payment.sale(amount='3.00', transaction_id=token)

# Makes the API Request
payment.process()

# Read response from BluePay
if payment.is_successful_response():
    print 'Transaction Status: ' + payment.status_response
    print 'Transaction Message: ' + payment.message_response
    print 'Transaction ID: ' + payment.trans_id_response
    print 'AVS Result: ' + payment.avs_code_response
    print 'CVV2 Result: ' + payment.cvv2_code_response
    print 'Masked Payment Account: ' + payment.masked_account_response
Example #22
0
# against a customer using test payment information.
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##

from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(
    name1="Bob",
    name2="Tester",
    addr1="123 Test St.",
    addr2="Apt #500",
    city="Testville",
    state="IL",
    zipcode="54321",
    #stored_indicator = 'F',
    #stored_type = 'C',
    #stored_id = 'TESTID526957756',
    country="USA")

payment.set_cc_information(card_number="4111111111111111",
Example #23
0
# against a customer using test payment information.
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##

import os.path, sys

sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(name1="Bob",
                                 name2="Tester",
                                 addr1="123 Test St.",
                                 addr2="Apt #500",
                                 city="Testville",
                                 state="IL",
                                 zipcode="54321",
                                 country="USA")

payment.set_cc_information(card_number="4111111111111111",
                           card_expire="1215",
                           cvv2="123")

payment.auth(amount='3.00')
import sys
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  # Transaction Mode: TEST (can also be LIVE)

test = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

generated_url = test.generate_url(merchant_name='Test Merchant',
                                  return_url='www.google.com',
                                  transaction_type='SALE',
                                  accept_discover='Yes',
                                  accept_amex='Yes',
                                  amount='99.99',
                                  protect_amount='Yes',
                                  rebilling='Yes',
                                  reb_protect='Yes',
                                  reb_amount='50',
                                  reb_cycles='12',
                                  reb_start_date='1 MONTH',
                                  reb_frequency='1 MONTH',
                                  custom_id='MyCustomID1.1234',
                                  protect_custom_id='Yes',
                                  custom_id2='MyCustomID2.12345678910',
                                  protect_custom_id2='Yes',
                                  payment_template='mobileform01',
                                  receipt_template='defaultres2',
                                  receipt_temp_remote_url='')

print "Hosted Payment Form URL: " + generated_url
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##
from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  
token = "Transaction ID here" 

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

# Charges a customer $3.00 using the payment information from a previous transaction.
payment.sale(
    amount = '3.00', 
    transaction_id = token 
)

# Makes the API Request 
payment.process()

# Read response from BluePay
if payment.is_successful_response():
    print('Transaction Status: ' + payment.status_response)
Example #26
0
# BluePay Python Sample code.
#
# This code sample runs a $3.00  sales transaction using the payment information obtained from a credit card swipe.
# If using TEST mode, odd dollar amounts will return an approval and even dollar amounts will return a decline.
##
from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(name1="Bob",
                                 name2="Tester",
                                 addr1="123 Test St.",
                                 addr2="Apt #500",
                                 city="Testville",
                                 state="IL",
                                 zipcode="54321",
                                 country="USA")

# Set payment information for a swiped credit card transaction
payment.swipe(
    "%B4111111111111111^TEST/BLUEPAY^2511101100001100000000667000000?;4111111111111111=251110110000667?"
)
# BluePay Ruby Sample code.
#
# This code sample runs a report that grabs a single transaction
# from the BluePay gateway based on certain criteria.
# See comments below on the details of the report.
# If using TEST mode, only TEST transactions will be returned.
##
from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

report = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

report.get_single_trans_query(
    transaction_id='ID of previous transaction',  # Transaction ID
    report_start="2015-01-01",  # Query Start Date: Jan. 1, 2013
    report_end="2018-12-31",  # Query End Date: Jan. 15, 2015
    exclude_errors="1"  # Do not include errored transactions? Yes
)

# Makes the API Request with BluePay
report.process()

# Reads the response from BluePay
print(report.response)
# BluePay Python Sample code.
#
# This code sample runs a $3.00 ACH Sale transaction
# against a customer using test payment information.
##

import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(name1="Bob",
                                 name2="Tester",
                                 addr1="123 Test St.",
                                 addr2="Apt #500",
                                 city="Testville",
                                 state="IL",
                                 zipcode="54321",
                                 country="USA")

# Set ACH Payment Information
payment.set_ach_information(
    routing_number="123123123",  # Routing Number
    account_number="05125121",  # Account Number
    account_type="C",  # Account Type: Checking
# against a customer using test payment information.
# If using TEST mode, odd dollar amounts will return
# an approval and even dollar amounts will return a decline.
##
from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

payment = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode
)

payment.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "123 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

payment.set_cc_information(
# against a customer using test payment information, sets up
# a rebilling cycle, and also shows how to cancel that rebilling cycle.
# See comments below on the details of the initial setup of the
# rebilling cycle.
##
from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(name1="Bob",
                                 name2="Tester",
                                 addr1="123 Test St.",
                                 addr2="Apt #500",
                                 city="Testville",
                                 state="IL",
                                 zipcode="54321",
                                 country="USA")

payment.set_cc_information(card_number="4111111111111111",
                           card_expire="1225",
                           cvv2="123")

# Set Recurring Payment Information
Example #31
0
##
# BluePay Python Sample code.
#
# This code sample creates a recurring payment charging $15.00 per month for one year.
##

import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(name1="Bob",
                                 name2="Tester",
                                 addr1="123 Test St.",
                                 addr2="Apt #500",
                                 city="Testville",
                                 state="IL",
                                 zipcode="54321",
                                 country="USA")

payment.set_cc_information(card_number="4111111111111111",
                           card_expire="1215",
                           cvv2="123")

payment.auth(amount='0.00')
# update the rebilling cycle. See comments below
# on the details of the initial setup of the rebilling cycle as well as the
# updated rebilling cycle.
##

import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

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
)

rebill.set_customer_information(
    name1 = "Bob",
    name2 = "Tester",
    addr1 = "1234 Test St.",
    addr2 = "Apt #500",
    city = "Testville",
    state = "IL",
    zipcode = "54321",
    country = "USA"
)

rebill.set_cc_information(
    trans_status = vars["trans_status"]
    trans_type = vars["trans_type"]
    amount = vars["amount"]
    batch_id = vars["batch_id"]
    batch_status = vars["batch_status"]
    total_count = vars["total_count"]
    total_amount = vars["total_amount"]
    batch_upload_id = vars["batch_upload_id"]
    rebill_id = vars["rebill_id"]
    rebill_amount = vars["reb_amount"]
    rebill_status = vars["status"]

    # Calculate expected bp_stamp
    bp_stamp = BluePay.calc_trans_notify_TPS(secret_key, trans_id,
                                             trans_status, trans_type, amount,
                                             batch_id, batch_status,
                                             total_count, total_amount,
                                             batch_upload_id, rebill_id,
                                             rebill_amount, rebill_status)

    # check if expected bp_stamp = actual bp_stamp
    if bp_stamp == vars["bp_stamp"]:

        # Get response from BluePay
        print 'Transaction ID: ' + trans_id
        print 'Transaction Status: ' + trans_status
        print 'Transaction Type: ' + trans_type
        print 'Transaction Amount: ' + amount
        print 'Rebill ID: ' + rebill_id
        print 'Rebill Amount: ' + rebill_amount
        print 'Rebill Status: ' + rebill_status
    else:
Example #34
0
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay
import cgi

print("Content-type:text/html\r\n\r\n")
print("<html><head></head><body>")

response = cgi.FieldStorage()

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

if "BP_STAMP" in response:  # Check whether BP_STAMP is provided

    bp = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

    bp_stamp_string = ''
    for field in response["BP_STAMP_DEF"].value.split(
            ' '):  # Split BP_STAMP_DEF on whitespace
        bp_stamp_string += response[
            field].value  # Concatenate values used to calculate expected BP_STAMP

    expected_stamp = bp.create_tps_hash(
        bp_stamp_string, response["TPS_HASH_TYPE"].value
    ).upper(
    )  # Calculate expected BP_STAMP using hash function specified in response
    if expected_stamp == response[
            'BP_STAMP'].value:  # Compare expected BP_STAMP with received BP_STAMP
        # Validate BP_STAMP and reads the response results
        print("VALID BP_STAMP: TRUE<br/>")
# 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.
##
from __future__ import print_function
import os.path, sys
sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"

payment = BluePay(account_id=account_id, secret_key=secret_key, mode=mode)

payment.set_customer_information(name1="Bob",
                                 name2="Tester",
                                 addr1="123 Test St.",
                                 addr2="Apt #500",
                                 city="Testville",
                                 state="IL",
                                 zipcode="54321",
                                 country="USA")

payment.set_cc_information(card_number="4111111111111111",
                           card_expire="1225",
                           cvv2="123")

payment.sale(amount='3.00')  # Sale Amount: $3.00
    ##
from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from BluePay import BluePay
import cgi

vars = cgi.FieldStorage()

account_id = "Merchant's Account ID Here"
secret_key = "Merchant's Secret Key Here"
mode = "TEST"  

tps = BluePay(
    account_id = account_id, 
    secret_key = secret_key, 
    mode = mode 
)

try:
    # Assign values
    trans_id = vars["trans_id"]
    trans_status = vars["trans_status"]
    trans_type = vars["trans_type"]
    amount = vars["amount"]
    rebill_id = vars["rebill_id"]
    rebill_amount = vars["reb_amount"]
    rebill_status = vars["status"]
    tps_hash_type = vars["TPS_HASH_TYPE"]
    bp_stamp = vars["BP_STAMP"]
    bp_stamp_def = vars["BP_STAMP_DEF"]