List Info

Thread: using innovativegateway.com in php




using innovativegateway.com in php
user name
2006-12-09 08:54:22
Hi All,
I am using innovativegateway.com in php for credit card
payment.I
downloaded a function file from   innovativegateway.com in
php.
When i trying to test it its returning NULL
No error or approveid.
plz help if you has been used this gateway.

Thanx in advance

vinay kant

Thereis the code
////////////////////////////
File name example.php
<?

//---------------------------------------------------------
// Payment Authorization Gateway via PHP (v0.1-0)
// ----------------
// Written by: John M. Brown <jmbrownipupdater.com>
//             IWAS2 Tech's Dynamic DNS Services
//             http://www.ipupdater.com
// ----------------
// Purpose:    Interface with the Payment Gateway in order
//             to verify credit card numbers and payments.
//---------------------------------------------------------
//
// Most of this file should be straightforward so make sure
// you read the entire file before sending an email.
//
//---------------------------------------------------------


include("PostGateway.function"); // REQUIRED:
				 // This is the location of
				 // the "function" file.


//--< SETUP >---------------------------
//	You may add as many variables as you need in order
//	to post to the authorization gateway.  Just add
//	them in the form:
//
//		 $transaction["VARIABLE"] = "VALUE";
//
//	All of the data returned from the server is provided
//	in an array and passed back from the
//	PostTransaction() function.
//
//		$response = PostTransaction($transaction);
//
//	You can access each of the variables returned from
//	the server using:
//
//		$response["VARIABLE"]
//
//	This will contain the value for the respective
//	variable.

//--< GLOBAL VARIABLES >-----------------
//	These are the required variables for the function
//	to work correctly.  You may want to include these
//	along with your username/password for the gateway
//	in a "global" include file (and even possibly
//	the include statement above).

	// Required variables for authorization gateway
	$transaction["target_app"] =
"WebCharge_v5.06";
	$transaction["response_mode"] =
"simple";
	$transaction["response_fmt"] =
"delimited";
	$transaction["upg_auth"] = "zxcvlkjh";
	$transaction["delimited_fmt_field_delimiter"] =
"=";
	$transaction["delimited_fmt_include_fields"] =
"true";

	$transaction["delimited_fmt_value_delimiter"] =
"|";
		// Changing the "delimited_fmt_value_delimiter
		// may require a change in the function logic.
		// I recommend that you do not make changes
		// to the global variables EXCEPT to the
		// username and password.

//--< LOGIN INFO >----------------------

	// Your Gateway Authorization Credentials:
	$transaction["username"] =
"gatewaytest";
	$transaction["pw"] = "GateTest2002";

//--< PER TRANSACTION DATA >------------
//	You should change these variables dynamically
//	according to the type of transaction you want to
//	complete.

        $transaction["trantype"] =
"sale";
        // Allowable Transaction Types:
        // Options:  preauth, postauth, sale, credit, void

        $transaction["reference"] = ""; 
// Blank for new sales...
                            // required for VOID, POSTAUTH,
and
CREDITS.
                            // Will be original Approval
value.

        $transaction["trans_id"] = "";  
// Blank for new sales...
                            // required for VOID, POSTAUTH,
and
CREDITS.
                            // Will be original ANATRANSID
value.

        $transaction["authamount"] = "";
// Only valid for POSTAUTH and

					 // is equal to the original
					 // preauth amount.

        $transaction["cardtype"] =
"visa";
        // Allowable Card Types:
        //      visa, mc, amex, diners, discover, jcb

	// Credit Card information
        $transaction["ccnumber"] =
"0000000000000000";
	// CC# may include spaces or dashes.

        $transaction["month"] = "01"; //
Must be TWO DIGIT month.
        $transaction["year"] =  "2004";
// Must be TWO or FOUR DIGIT
year.

        $transaction["fulltotal"] =
"100.00"; // Total amount WITHOUT
dollar sign.

        $transaction["ccname"] = "Joe
Smoe";
	$transaction["baddress"] = "123
Somwhere";
	$transaction["baddress1"] = "";
	$transaction["bcity"] = "MyTown";
	$transaction["bstate"] = "NC";
	$transaction["bzip"] = "90210";
	$transaction["bcountry"] = "US"; // TWO
DIGIT COUNTRY (United States =
"US")
	$transaction["bphone"] =
"336.123.1234";
	$transaction["email"] = "useruser.com";

//--< POST THE TRANSACTION >-----------------------

        $response = PostTransaction($transaction);

//--< PARSE THE RESPONSE >-------------------------
//	As stated above.  The values are returned in the format:
//
//		$response["VARIABLE"]
//
//	So if you want to see if you're approved you should check
//	for a variable $response["approved"] and if it
exists
//	then its value is the approval number.
//
//	If there was an error it will be in the
//	$response["error"] field.
//
//	NOTE: All response field names are in lowercase.

	if ($response["approved"] != "")
	{
		print "Approved: " .
$response["approved"] . "n";
		print "n";
	} else {
		print "Error: " . $response["error"] .
"n";
		print "n";
	}

//--< END >----------------------------------------
?>


///////////////////////////
file name : PostGateway.function
<?php

// NOTE:
// UNLESS YOU HAVE A REALLY ODD SETUP YOU SHOULD
//
//                     NOT
//
// CHANGE THIS FILE FOR ANY REASON.

//---------------------------------------------------------
// Payment Authorization Gateway via PHP (v0.1-0)
// ----------------
// Written by: John M. Brown <jmbrownipupdater.com>
//             IWAS2 Tech's Dynamic DNS Services
//             http://www.ipupdater.com
// ----------------
// Purpose:    Interface with the Payment Gateway in order
//             to verify credit card numbers and payments.
//---------------------------------------------------------
//
// Most of this file should be straightforward so make sure
// you read the entire file before sending an email.
//
//---------------------------------------------------------

function PostTransaction ($transaction) {
//	This function accepts one variable as an array.
//	That array should contain all of the variables
//	required to connect to and authorized payments in
//	the payment gateway.
//
//	You can create as many "object arrays" as you
like
//	and when ready send them through the PostTransaction()
//	function to perform the appropriate action.

//--< GATEWAY/ISP OPTIONS >------------------

	$url =
"https://transactions.innovativegate
way.com/servlet/com.gateway.aai.Aai";
	$user_agent = "Mozilla/4.0";
	$proxy = ""; // If you use a proxy server to
connect
		     // your server to the Internet then put
		     // in its address here.

	// Create the POST form to send to the gateway using
	// the incoming array.
	$data = "";
	foreach ($transaction as $name => $value) {
	    $data .= "&" . $name . "=" .
urlencode($value);
	}

	$data = substr($data,1);

	// Create the connection through the cURL extension
        $ch = curl_init();
        curl_setopt ($ch, CURLOPT_URL, $url);

	if ($proxy != "")
		curl_setopt ($ch, CURLOPT_PROXY, $proxy);

        curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
	curl_setopt ($ch, CURLOPT_POST, 1);
	curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
        $result = curl_exec ($ch);
        curl_close($ch);

	// Now we've got the results back in a big string.

	// Parse the string into an array to return
	$rArr = explode("|",$result);

	$returnArr="";
	for($i=0;$i<count($rArr);$i++)
	{
		$tmp2 = explode("=", $rArr[$i]);

		// YES, we put all returned field names in lowercase
		$tmp2[0] = strtolower($tmp2[0]);

		// YES, we strip out HTML tags.
		$returnArr[$tmp2[0]] = strip_tags($tmp2[1]);
	}

	// Return the array.
	return $returnArr;
}

?>


////////////////////////////////


--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the
Google Groups "Professional PHP Developers" group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )