Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
BluePay-Sample-Code/Python/Transactions/Charge_Customer_CC.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
59 lines (52 sloc)
1.68 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# 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", | |
card_expire = "1225", | |
cvv2 = "123" | |
) | |
payment.sale(amount = '3.00') # Sale Amount: $3.00 | |
# 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) | |
print('Card Type: ' + payment.card_type_response) | |
print('Auth Code: ' + payment.auth_code_response) | |
#print('Stored ID: ' + payment.stored_id_response) | |
else: | |
print(payment.message_response) |