MikeHeuss.com - The eclectic repository of my life. Programming, writing, and other stuff.

ProPayClass

I am a partner in - and lead developer at - Quick Vault LLC. Our product is called JumpVault, and is a USB based backup application. Speaking of which, we just added U3 compatibility. I think we may be the first 100% U3 compatible product. Anyway, for that website, I needed to integrate ProPay to process credit card transactions. I found they did not, at that time, have a PHP interface to their XML based engine.

So I wrote one.

This script takes care of all the basics - it will generate the XML request, and parse the XML results.

Below is an example of a credit card transaction:

Example:

require_once ("ProPayClass.php");

$propay = new ProPayClass("http://devtst.propay.com/xml/xml.exe/process",
   "12121212",
   "TestStringaaaaaaaaaaaaaa", true);

$propay->SetElement ("amount", 110);

$propay->SetElement ("ccNum", "4331000000000000");
$propay->SetElement ("expDate", "0606");

$results = $propay->DoTransaction("04");

print ("<h2>$results<br>".
  $propay->StatusLookup($propay->GetReturnedValues("status")).
  "</h2>");

We created an instance of ProPay, passing in the URL, Account Number, and Certification String. You can also specify true for the debug, which proceeds to print out information useful for testing/debugging.

Set a few of the required elements (see ProPay's documentation), and then throw in a DoTransaction. For varying types, again, consult your documentation.

By using GetReturnedValues, you get access to the values passed back in the XML file.

Download

To download: Tar.gz Zip

My disclaimer: I don't guarantee that it will work or do anything, it is provided as is. ProPayClass.php is made available under the BSD License.

Function Reference

function ProPayClass ($arg_url, $arg_account_number, $arg_cert_string, $arg_debug=false) {

The Account Number and Cert String will be provided with your account. Turn on debug for more information

function SetElement($arg_tag, $arg_value) {

Set Elements allows the loading of elements into the system. It alssumes the elements have already been validated

function GetReturnedValues ($arg_tag) {

Allows the program to pull out arbitrary return values

function GetReturnedStatus () {

Uses GetReturnedValues to return the status

function DoTransaction ($arg_trans_type) {

Executes Transaction - returns a curl error - if any, otherwise returns true.

function StatusLookup ($arg_id) {

Returns plain english for the status values returned.

Last Updated: 12 Aug 2005

© 1998 - 2010 Mike Heuss   |   mike@mikeheuss.com  |  386 418 0075  |  6823 NW 218th Street Alachua FL 32615