示例#1
0
    def POST(self):	
	#Set the QuickPayAPI credentials
	username = "******"
	apikey   = "QuickPayAPIKey"

	api = QuickPayAPI(username, apikey)

	try:

            form = web.input()	
	    #form = cgi.FieldStorage()
	    #token = form["Token"]
	
	    date = time.strftime("%Y-%m-%d %X") #datetime.now()
	
	    print 'Date: ', date
	    referenceNo = date
	    orderInfo = date
	    amount = '10'
            print "Form: ",form
	    card = form["Card Number"].encode("ascii","ignore")
	    expiry = form["Card Expiry Date"].encode("ascii","ignore")
	    cvv = form["Card CVV/CVV2"].encode("ascii","ignore")
	    currency = 'KES'
	
	    #print 'date: %s, referenceNo: %s, orderInfo: %s, amount: %s, card: %s, currency: %s' % (date, referenceNo, orderInfo, amount, card, currency)
	
	    results = api.sendRequest(referenceNo, orderInfo, amount, card, currency,expiry,cvv)
	
	    return 'responseCode: %s, authId: %s, receiptNo: %s' % (results['responseCode'], results['authId'], results['receiptNo'])
		
	except QuickPayAPIException, e:
	    return 'Encountered an error while sending: %s' % str(e)
示例#2
0
# Import the QuickPayAPI class
from QuickPayAPI import QuickPayAPI, QuickPayAPIException
from datetime import datetime
import cgi
import time

#Set the QuickPayAPI credentials
username = "******"
apikey = "QuickPayAPIKey"

api = QuickPayAPI(username, apikey)

try:
    #form = cgi.FieldStorage()
    #token = form["Token"]

    date = time.strftime("%Y-%m-%d %X")  #datetime.now()

    print 'Date: ', date
    referenceNo = date
    orderInfo = date
    amount = '1225'
    card = date  #token
    currency = 'KES'

    #print 'date: %s, referenceNo: %s, orderInfo: %s, amount: %s, card: %s, currency: %s' % (date, referenceNo, orderInfo, amount, card, currency)

    results = api.sendRequest(referenceNo, orderInfo, amount, card, currency)

    print 'responseCode: %s, authId: %s, receiptNo: %s' % (
        results['responseCode'], results['authId'], results['receiptNo'])
# Import the QuickPayAPI class
from QuickPayAPI import QuickPayAPI, QuickPayAPIException
from datetime import datetime
import cgi
import time

#Set the QuickPayAPI credentials
username = "******"
apikey   = "QuickPayAPIKey"

api = QuickPayAPI(username, apikey)

try:
	#form = cgi.FieldStorage()
	#token = form["Token"]
	
    date = time.strftime("%Y-%m-%d %X") #datetime.now()
	
    print 'Date: ', date
    referenceNo = date
    orderInfo = date
    amount = '1225'
    card = date #token
    currency = 'KES'
	
    #print 'date: %s, referenceNo: %s, orderInfo: %s, amount: %s, card: %s, currency: %s' % (date, referenceNo, orderInfo, amount, card, currency)
	
    results = api.sendRequest(referenceNo, orderInfo, amount, card, currency)
	
    print 'responseCode: %s, authId: %s, receiptNo: %s' % (results['responseCode'], results['authId'], results['receiptNo'])