While the focus of this article is on connecting to the Authorize.net system through a request / response interface, a discussion of eCommerce connections with PHP would not be complete without discussing CyberCash, given that there is a PHP module devoted to it. However, one of the major differences between the CyberCash system and the Authorize.net system is that the latter does not require anything to be setup or installed -- it’s a completely script-based interface.
To connect with the CyberCash system, you will have to register at their website and download and install a copy of their Merchant Connection Kit (MCK) at your web host. Then, you will have to recompile PHP with the embedded CyberCash support to be able to access PHP’s API for CyberCash. If you’re not hosting your own site, this means being dependent on your ISP for this functionality, though more and more providers are offering it in a standard package.
After compiling PHP with the CyberCash extensions installed, you will be able to access 'CyberLib', a set of functions for use with the CyberCash system. However, research has shown these functions to be poorly documented and even less poorly understood by the PHP development community. The main method of integration with CyberCash is through the direct socket interface, and the purpose of CyberLib is to provide a convenient programming interface so you don't have to get your hands dirty with socket programming. A sample transaction using the CyberLib interface to CyberCash's CashRegister (taken straight from the PHP source code documentation) is shown below.
$merchant=""; /* Your merchant ID goes here. */
$merchant_key=""; /* Your merchant key goes here. */
"Order-ID" => "2342322",
"Amount" => "usd 11.50",
"Card-Number" => "4111111111111111",
"Card-Address" => "1600 Pennsylvania Avenue",
"Card-City" => "Washington",
"Card-State" => "DC",
"Card-Zip" => "20500",
"Card-Country" => "USA",
"Card-Exp" => "12/99",
"Card-Name" => "Bill Clinton"));
echo $key ."=" .$val ." ";
As stated earlier, these built-in functions are poorly documented and difficult to use, and this sentiment is echoed in the user commentary with the online PHP manual at www.php.net. In an attempt to de-mystify the process of connecting to the CyberCash CashRegister, PHP developer Nathan Cassano has written an excellent article on connecting with his 'CyberClass', an adaptation of the standard CyberLib. The article, and other information about connecting to CyberCash, can be found at http://www.phpbuilder.com/columns/nathan20001225.php3.
blog comments powered by Disqus