Setting up CyberCash
The next step is to setup your CyberCash merchant server by installing software from
CyberCash and compiling CyberCash support into PHP.
CyberCash and compiling CyberCash support into PHP.
CyberCash provides the Merchant Connection Kit (MCK). This is used to connect you (the merchant)
to the CyberCash servers (found here).
You will need to download and install this package onto your server. When you install the MCK package
it will create a mck-3.2.* directory. Change into this directory and run it’s ./configure script.
MCK will then prompt you for your configuration information. Most of the script inputs are unused
by CyberClass. The prompts important to CyberClass for you to input are your CyberCash ID (Merchant ID),
your Merchant Key and whether the configured files should be installed; you can enter ‘no’. When the
script is finished it will have created a merchant configuration file located in
/path_to/mck-3.2.*/your_merchant_id/conf/merchant_conf. This will be used by CyberClass later.
to the CyberCash servers (found here).
You will need to download and install this package onto your server. When you install the MCK package
it will create a mck-3.2.* directory. Change into this directory and run it’s ./configure script.
MCK will then prompt you for your configuration information. Most of the script inputs are unused
by CyberClass. The prompts important to CyberClass for you to input are your CyberCash ID (Merchant ID),
your Merchant Key and whether the configured files should be installed; you can enter ‘no’. When the
script is finished it will have created a merchant configuration file located in
/path_to/mck-3.2.*/your_merchant_id/conf/merchant_conf. This will be used by CyberClass later.
Next comes task of compiling CyberCash library support into PHP. This requires that you
download and compile the PHP source code.
If you are not familiar with compiling PHP from the source, get more information at the
Getting Started – Installation section
in the PHP Manual. To include CyberCash support, add ‘–with-cybercash=/path_to/mck-3.2.*’ to the
list of ./configure arguments. Make sure as the script is running you see the status line ‘checking
for CyberCash support… yes’. Finally, do the standard make, make install and any other external configuration.
download and compile the PHP source code.
If you are not familiar with compiling PHP from the source, get more information at the
Getting Started – Installation section
in the PHP Manual. To include CyberCash support, add ‘–with-cybercash=/path_to/mck-3.2.*’ to the
list of ./configure arguments. Make sure as the script is running you see the status line ‘checking
for CyberCash support… yes’. Finally, do the standard make, make install and any other external configuration.
CashRegister comes with plenty of documentation which you will need to get most of. Go to the CashRegister Documentation page
and begin downloading. At least get the Command API Developer’s Guide, the Message Block API Developer’s
Guide and the Error Message Guide to aid you in development.
and begin downloading. At least get the Command API Developer’s Guide, the Message Block API Developer’s
Guide and the Error Message Guide to aid you in development.
Lastly, download CyberClass,
the PHP library interface to CashRegister.
the PHP library interface to CashRegister.
Developing with CyberCash
The focus of this next section is to introduction you to the CyberCash development model. This is
not a complete development guide but a means to understand how CyberCash development in done with
PHP and CyberClass. At this stage your account should be in testing mode. Testing mode is used to
simulate the processing environment. This allows you to test and develop your CyberCash enabled web
site while billing remains inactive. Later, when you are ready go live with your site, go to the Merchant
Control Panel, click on the “Go Live” option and your site will be financially activated (given all the
necessary step are completed).
not a complete development guide but a means to understand how CyberCash development in done with
PHP and CyberClass. At this stage your account should be in testing mode. Testing mode is used to
simulate the processing environment. This allows you to test and develop your CyberCash enabled web
site while billing remains inactive. Later, when you are ready go live with your site, go to the Merchant
Control Panel, click on the “Go Live” option and your site will be financially activated (given all the
necessary step are completed).
The CyberCash SendCC2_1Server() function is the primary method for sending requests to the
CyberCash servers. Through this function you can send API Commands. API Commands are a set of
commands used for executing financial transactions and functions; they require a specific list of
key/values and return a list of key/values. I find it is easiest to learn from example so lets get
down to business and make an authorization with CyberClass.
CyberCash servers. Through this function you can send API Commands. API Commands are a set of
commands used for executing financial transactions and functions; they require a specific list of
key/values and return a list of key/values. I find it is easiest to learn from example so lets get
down to business and make an authorization with CyberClass.
<?php
/*
CyberCash PHP CyberClass authorization example
*/
/* Include the CyberClass module */
include("class.cyberclass.php");
/* A CyberClass instance is created with the first
argument pointing to your 'merchant_conf' file */
$transaction = new cyberclass("/path_to/merchant_conf");
/* The SendCC2_1Server() member function is called */
$response = $transaction->SendCC2_1Server(
/* The Command API 'mauthonly' is called to
perform an authorization */
'mauthonly',
/* mauthonly's array of key/value argument pairs */
array(
'order-id' => '11223344',
'amount' => 'usd 12.50',
'card-number' => '4111111111111111',
/* The credit card number '4111111111111111' is the VISA testing number */
'card-exp' => '12/05', /* MM/YY date format */
'card-name' => 'Bill Clinton',
'card-address' => '1600 Pennsylvania Avenue',
'card-city' => 'Washington',
'card-state' => 'DC',
'card-zip' => '20500',
'card-country' => 'USA'
);
/* Print the result */
foreach($response as $key => $val){
echo "response['$key'] = $val<br>n";
}
?>
The script should produce something like the following output.
<?php
response
['cust-txn'] = 404909166
response['merch-txn'] = 404909166
response['avs-code'] = z
response['ref-code'] = 009600123491
response['auth-code'] = AC7435
response['action-code'] = 000
response['MStatus'] = success
response['paid-amount'] = usd 12.50
response['card-number'] = 411111
response['card-type'] = vs
response['order-id'] = 11223344
response['card-exp'] = 12/05
response['aux-msg'] = Financial Institution Response: authorization approved.
?>
This example is fairly straight forward and should give you a taste
of CyberCash development. You send your request to CyberCash and receive
a response. The MStatus variable is present in all responses and returns
the status of the issued command. This is the first variable you should
consider in determining the success of a command.
of CyberCash development. You send your request to CyberCash and receive
a response. The MStatus variable is present in all responses and returns
the status of the issued command. This is the first variable you should
consider in determining the success of a command.
There are many CyberCash API commands besides mauthonly. However in most cases it is not
necessary to develop with them. CyberCash provides the
Merchant Manager, a web based merchant administration
interface. It pretty much does everything possible in CyberCash, with the exception of integration
with your web site. So most of your CyberCash tasks can be taken care of through the Merchant Manager.
If you still need more and power develop your own CyberCash application. Examine the appropriate API
command documentation, do some experimentation with it until you’ve figured it out and develop an
application. For a complete list of the Command API check out the Command API Developer’s Guide Chapter 2.
necessary to develop with them. CyberCash provides the
Merchant Manager, a web based merchant administration
interface. It pretty much does everything possible in CyberCash, with the exception of integration
with your web site. So most of your CyberCash tasks can be taken care of through the Merchant Manager.
If you still need more and power develop your own CyberCash application. Examine the appropriate API
command documentation, do some experimentation with it until you’ve figured it out and develop an
application. For a complete list of the Command API check out the Command API Developer’s Guide Chapter 2.