XIX. Cybercash Payment Functions


These functions are only available if the interpreter has been compiled with the --with-cybercash=[DIR].

This extension has been moved from PHP as of PHP 4.3.0 and now CyberCash lives in PECL.

If you have questions as to the latest status of CyberCash then the following CyberCash Faq will be helpful. In short, CyberCash was bought out by VeriSign and although the CyberCash service continues to exist, VeriSign encourages users to switch. See the above faq and PECL link for details.

cybercash_base64_decode -- base64 decode data for Cybercash
cybercash_base64_encode -- base64 encode data for Cybercash
cybercash_decr -- Cybercash decrypt
cybercash_encr -- Cybercash encrypt

add a note add a note User Contributed Notes
hostmaster at shupp dot org
28-May-2005 09:51
Here's how to install cybercash dynamically into PHP

1. Make sure you have the php dev tools installed, like pear and phpize.

2. Download the cybercash module:

pear download cybercash

3. Untar the module:

tar -xzf cybercash-<version>.tgz

4. Download and install my updated config.m4 file, the current one (as of version 1.18p1) doesn't work:

wget http://shupp.org/patches/cybercash.config.m4
cd cybercash-<version>
mv ../cybercash.config.m4 config.m4

5. Setup/compile module

./configure --with-cybercash=/path/to/cybercash-source/c-api

6. Install module.  For Debian Sarge, the modules directory is /usr/lib/php4/20020429/:

cp modules/cybercash.so /usr/lib/php4/20020429/
(make install may work also)

7. Enable the module in php.ini, restart apache.

Hope this saves someone else some time.

Bill Shupp
chris at scootersoftware dot com
07-Jan-2005 01:15
How to compile Cybercash support statically into PHP

Verisign did not force migration from Cybercash to Payflow Pro.  Cybercash is still alive and well for existing customers.

The Cybercash in PECL does not work at this time (see http://pecl.php.net/bugs/bug.php?id=1296 ).  The work around listed in the bug report didn't work on my system.

Here's how I compiled Cybercash support into php 4.3.10:
(I used autoconf 2.13, automake 1.5, and libtool 1.4.3, but I don't know if they are required)

Download source tarballs for php 4.2.3 (the last version with Cybercash support) and php 4.3.10.

Copy the ext/cybercash directory from the 4.2.3 source tarball into the php 4.3.10 source.

From the root of the PHP 4.3.10 source run:
./buildconf --force

Configure pointing to your Cybercash MCK libraries:
./configure --with-cybercash=/opt/local/src/mck-vernum --with-your-other-options


make install

Restart Apache to pick up the changes.
david at azcode dot com
10-Mar-2004 10:53
I am suprised to see recent posting for CyberCash implementation considering they haven't been a company for almost four years now.  When VeriSign bought them, they force migrated everyone to Payflow Pro - which is why I switched to iBill.com (now InterCept's iPay) gateway.  Either way, the below code (using cURL) should allow a transaction to post without a local COM obj to a secure payment server via SSL.  check it out...

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://secure.ibill.com/cgi-win/ccard/tpcard.exe");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line make is work under https

curl_setopt($ch, CURLOPT_TIMEOUT, 90);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);

$RECEIPT = curl_exec($ch);

$RECEIPT = preg_replace("/\n?\r?/","",$RECEIPT);   
curl_close ($ch);

$receipt_fields = preg_split("/\",\"/", $RECEIPT, -1, PREG_SPLIT_NO_EMPTY);
$authorization = $receipt_fields[0];
$authorization = preg_replace("/]^a-z0-9]/i","",$authorization);
   $authcode = $receipt_fields[1];
   $rDate = $receipt_fields[2];
   $rTime = $receipt_fields[3];
   $rTran = $receipt_fields[4];
   $rcRef = $receipt_fields[5];
   $avscode = $receipt_fields[6];
   $psdata = $receipt_fields[7];
   if(!isset($receipt_fields[8])) { 
       $revsh = "none";
   }else { $revsh = $receipt_fields[8]; }
   if(!isset($receipt_fields[9])) {   
       $fraud = "none";
   }else { $fraud = $receipt_fields[9]; }
nathan at cjhunter dot com
01-Aug-2000 08:18
We use cybercash and php for all our website's financial transactions. I developed CyberClass (http://www.zend.com/codex.php?id=115&single=1) as a clean up and extension of CyberLib. I recommend that you use CyberClass over CybeLib.
mikebabcock at pobox dot com
18-Jul-2000 12:34
The cyberlib.php file is a library of functions for use with your Cybercash transaction php files.  The test.php file contains an example transaction that is very simple:

 $merchant=""; /* Your merchant ID goes here. */
 $merchant_key=""; /* Your merchant key goes here. */

               $auth_type,array("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."<br>";

For all those without source; hope this helps.
dave at bcdei dot com
07-Jul-2000 10:54
**Posted to the newgroup by Mike Robinson <mgrphp3@cgocable.net> **

In the php4 source, under ext/cybercash, you'll see a couple of files with
sample snippets in them, cyberlib.php and test.php. The mck comes with some
documentation as well. (Note, in the php3 source, the dir is extra/cyberlib)
Other than that, I've seen very little.