Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg

PHP : Function Reference : Cybercash Payment Functions

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.

Table of Contents

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

Code Examples / Notes » ref.cybercash


We use cybercash and php for all our website's financial transactions. I developed CyberClass ( as a clean up and extension of CyberLib. I recommend that you use CyberClass over CybeLib.


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."
For all those without source; hope this helps.


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 (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,"");
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]; }


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 ).  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.


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:
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/ /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


**Posted to the newgroup by Mike Robinson <> **
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.

Change Language

Follow Navioo On Twitter
.NET Functions
Apache-specific Functions
Alternative PHP Cache
Advanced PHP debugger
Array Functions
Aspell functions [deprecated]
BBCode Functions
BCMath Arbitrary Precision Mathematics Functions
PHP bytecode Compiler
Bzip2 Compression Functions
Calendar Functions
CCVS API Functions [deprecated]
Class/Object Functions
Classkit Functions
ClibPDF Functions [deprecated]
COM and .Net (Windows)
Crack Functions
Character Type Functions
Cybercash Payment Functions
Credit Mutuel CyberMUT functions
Cyrus IMAP administration Functions
Date and Time Functions
DB++ Functions
Database (dbm-style) Abstraction Layer Functions
dBase Functions
DBM Functions [deprecated]
dbx Functions
Direct IO Functions
Directory Functions
DOM Functions
DOM XML Functions
enchant Functions
Error Handling and Logging Functions
Exif Functions
Expect Functions
File Alteration Monitor Functions
Forms Data Format Functions
Fileinfo Functions
filePro Functions
Filesystem Functions
Filter Functions
Firebird/InterBase Functions
Firebird/Interbase Functions (PDO_FIREBIRD)
FriBiDi Functions
FrontBase Functions
FTP Functions
Function Handling Functions
GeoIP Functions
Gettext Functions
GMP Functions
gnupg Functions
Haru PDF Functions
hash Functions
Hyperwave Functions
Hyperwave API Functions
i18n Functions
IBM Functions (PDO_IBM)
iconv Functions
ID3 Functions
IIS Administration Functions
Image Functions
Imagick Image Library
Informix Functions
Informix Functions (PDO_INFORMIX)
Ingres II Functions
IRC Gateway Functions
PHP / Java Integration
JSON Functions
LDAP Functions
libxml Functions
Lotus Notes Functions
LZF Functions
Mail Functions
Mailparse Functions
Mathematical Functions
MaxDB PHP Extension
MCAL Functions
Mcrypt Encryption Functions
MCVE (Monetra) Payment Functions
Memcache Functions
Mhash Functions
Mimetype Functions
Ming functions for Flash
Miscellaneous Functions
mnoGoSearch Functions
Microsoft SQL Server Functions
Microsoft SQL Server and Sybase Functions (PDO_DBLIB)
Mohawk Software Session Handler Functions
mSQL Functions
Multibyte String Functions
muscat Functions
MySQL Functions
MySQL Functions (PDO_MYSQL)
MySQL Improved Extension
Ncurses Terminal Screen Control Functions
Network Functions
Newt Functions
NSAPI-specific Functions
Object Aggregation/Composition Functions
Object property and method call overloading
Oracle Functions
ODBC Functions (Unified)
ODBC and DB2 Functions (PDO_ODBC)
OpenAL Audio Bindings
OpenSSL Functions
Oracle Functions [deprecated]
Oracle Functions (PDO_OCI)
Output Control Functions
Ovrimos SQL Functions
Paradox File Access
Parsekit Functions
Process Control Functions
Regular Expression Functions (Perl-Compatible)
PDF Functions
PDO Functions
Phar archive stream and classes
PHP Options&Information
POSIX Functions
Regular Expression Functions (POSIX Extended)
PostgreSQL Functions
PostgreSQL Functions (PDO_PGSQL)
Printer Functions
Program Execution Functions
PostScript document creation
Pspell Functions
qtdom Functions
Rar Functions
GNU Readline
GNU Recode Functions
RPM Header Reading Functions
runkit Functions
SAM - Simple Asynchronous Messaging
Satellite CORBA client extension [deprecated]
SCA Functions
SDO Functions
SDO XML Data Access Service Functions
SDO Relational Data Access Service Functions
SESAM Database Functions
PostgreSQL Session Save Handler
Session Handling Functions
Shared Memory Functions
SimpleXML functions
SNMP Functions
SOAP Functions
Socket Functions
Standard PHP Library (SPL) Functions
SQLite Functions
SQLite Functions (PDO_SQLITE)
Secure Shell2 Functions
Statistics Functions
Stream Functions
String Functions
Subversion Functions
Shockwave Flash Functions
Swish Functions
Sybase Functions
TCP Wrappers Functions
Tidy Functions
Tokenizer Functions
Unicode Functions
URL Functions
Variable Handling Functions
Verisign Payflow Pro Functions
vpopmail Functions
W32api Functions
WDDX Functions
win32ps Functions
win32service Functions
xattr Functions
xdiff Functions
XML Parser Functions
XML-RPC Functions
XMLReader functions
XMLWriter Functions
XSL functions
XSLT Functions
YAZ Functions
YP/NIS Functions
Zip File Functions
Zlib Compression Functions
eXTReMe Tracker