Documentation
MASTERGATE

authnet.gif (6418 bytes)


System Requirements

Preliminaries

  • Determine the path to PERL 5 on your web server host.  Note that some web hosting companies run both PERL 4 and PERL 5.  Make ABSOLUTELY sure you are not setting this up under PERL 4.  Ask your administrator if you are not sure.
  • Download the tarfile for this program and save it to your desktop.
  • Unpack the tar archive on your desktop using a program that unpacks UNIX TAR ARCHIVES. If you don't have such a program then download WINZIP FREE from SHAREWARE.COM
  • After you have unpacked the TAR archive you will have a collection of folders and files on your desktop.  Now you have to do some basic editing of each of these files (or at least some of them).  Use a text editor such as wordpad, notepad, BBEdit, simpletext, or teachtext to edit the files.  These are NOT WORD PROCESSOR DOCUMENTS they are just simple TEXT files so don't save them as word processor documents or save them with extentions such as .txt or they will NOT WORK.   Note that there may be a some files inside of folders which are "blank".   This is normal.

Preparing the CGI scripts

Define Path To PERL 5

The first step is to open up each and every file that has a .cgi extention and edit line number one of each script.  Each of the cgi scripts is written in perl 5. For your scripts to run they must know where perl 5 is installed on your web server. The path to perl 5 is defined to a cgi script in the first line of the file. In each of the cgi scripts the first line of code looks something like this:

#!/usr/bin/perl

If the path to perl 5 on your web server is different from /usr/bin/perl you must edit the first line of each cgi script to reflect the correct path. If the path to perl 5 is the same no changes are necessary. If you do not know the path to perl 5 ask the webmaster or system administrator at your server site.  

Configure the .cgi files

configure.cgi (for accountcreate.cgi and admin tools)

Below are the variables used for mastergate in ALL of the other cgi scripts.  All of the other cgi programs USE configure.cgi to figure out where certain things are.  The configure.cgi script located inside the cgibin when you unpack is to be placed inside the same directory as accountcreate.cgi and the rest of the admin tools.  If you are using IBILL basic TP or AUTHORIZE NET there is a SECOND configure.cgi script that you will use which is located in a respective folder (authorizenet or ibill basic tp).  The second configure.cgi script is described later in this documentation.  If you are using syntax verification you do not need any other configure.cgi script except for this one.

  • $date_command = "/path/to/date";  Path to the date function on your webserver
  • $sendmail= "/path/to/sendmail";   This is the path to sendmail on your webserver
  • $databasefile = "/path/to/cgi-bin/mastergate/database";  This is the path to the database file
  • $passwordfile = "/path/to/cgi-bin/mastergate/passwords";  This is the path to the passwords file
  • $logfile = "/path/to/cgi-bin/mastergate/log";  This is the path to the log file
  • $localurl = "webserverdomain.com";  Your domain name
  • $remoteurl = "secureserverdomain.com";  Domain name of your secure server if you are using one
  • $adminemail = "you\@yourdomain.com";  Your email address (MUST INCLUDE BACKSLASH!)
  • $accountcreatecgi = "http://www.yourdomain.com/cgi-bin/mastergate/accountcreate.cgi"; URL to accountcreate.cgi
  • $modifyurl = "http://www.yourdomain.com/cgi-bin/mastergate/modify.cgi"; URL to modify.cgi
  • $deleteurl = "http://www.yourdomain.com/cgi-bin/mastergate/delete.cgi"; URL to delete.cgi

Interfacing to Authorize Net (optional)

If you are planning to use this with AUTHORIZE NET you will need to use the mastergate.cgi, configure.cgi and the index.html page plus add the the badcard.html page that are included in the authorize.net folder.   The index.html page is the order form you will use to process orders, the cgi files should go in a SEPERATE directory than the rest of the cgifiles associated with accountcreate.cgi and unpacked in the cgibin.  These may also reside on a remote secure server.   There are some new variables to deal with plus you have to set amounts for the transaction inside of configure.cgi.

  • $date_command = "/path/to/date";  Path to the date function on your webserver
  • $mailprog = '/var/qmail/bin/sendmail';  This is the path to sendmail on your webserver
  • $adminemail = "info\@yourdomain.com";  Your email address (MUST INCLUDE BACKSLASH!)
  • $accountcreatecgi = "http://www.yourdomain.com/cgi-bin/mastergate/accountcreate.cgi";  URL to accountcreate.cgi
  • $badcard = "/path/to/badcard.html";  Path to badcard.html
  • $referer = "yourdomain.com"; Your domain name
  • $remote = "www.authorize.net";  do not change
  • $script = "/scripts/authnet25/AuthRequest.asp";  do not change
  • $port = "80"; do not change
  • $LOGIN="provided by authorize.net"; see below
  • $PASSWORD="provided by authorize.net"; see below
  • $DESCRIPTION = "whatever"; see below
  • $TYPE = "PA"; see below
  • $AUTHCODE = "whatever"; see below
  • $EMAILCUSTOMER = "TRUE"; see below
  • $ECHODATA = "TRUE"; see below
  • $REJECTAVSMISMATCH = "TRUE"; see below
  • $TESTREQUEST = "TRUE"; see below
  • $DELIMCHARACTER = "|"; see below
  • $ENCAPSULATE = "FALSE"; see below

LOGIN
Required for transactions other than test transactions.  This is the assigned Authorize.Net login id.

PASSWORD
Required for Credit or Post Authorization transactions. For details on the use of transaction types, see the Authorize.Net User's Guide.

TYPE
May be one of: NA (means Normal Authorization)
 AO (means Authorization Only)
 CR (means Credit)
 PA (means Post Authorization)

EMAILCUSTOMER
Set this value to "TRUE" if you want an email sent to the Buyer's E-mail(the value specified in the EMAIL field) notifying him of the transaction details.(The fields INVOICE AMOUNT METHOD DESCRIPTION CUSTID NAME ADDRESS CITY STATE ZIP COUNTRY PHONE FAX EMAIL and their values will be included in the email)

ECHODATA
If this field is not provided with a value of "TRUE", only the first 5 RESPONSE fields (see below) will be returned, otherwise all allowed fields provided in the request will be returned in the response.

REJECTAVSMISMATCH
If this field is not provided with a value of "TRUE", the transaction will be accepted if it is authorized by FDC, even if the AVS response is a mismatch.   Otherwise, the transaction must pass the "AVS test" with either a matching zip code, address, or both.

TESTREQUEST
If this field is provided with a value of "TRUE" the script will perform all validation functions except actually authorizing the transaction and storing it in the merchant's batch, regardless of whether the merchant's configuration is set to LIVE or TEST mode. In other words, the response would be equivalent to the merchant being in TEST mode

DELIMCHARACTER
If you want the RESPONSE FIELDS delimited by something other than the default (comma), provide the DELIMCHARACTER here.

ENCAPSULATE
If you want the response fields encapsulated in double quotes (ex. "response data"), provide this request field set to "TRUE"; otherwise, the response fields will not be encapsulated.

Edit mastergate.cgi (Interfacing to IBILL Basic TP - optional)

If you are doing real-time validation through IBILL Basic TP you have to do a little editing inside the replacement mastergate.cgi file located inside the onlinetools directory.  You will be using this mastergate.cgi file in place of the default mastergate.cgi file.  You dont need to replace the configure.cgi file but a copy is provided inside the ibill.basic.tp folder for convenience.

  • $remote = "secure.logicom.com";
  • $script = "/cgi-win/ccard/tpcard.exe?";
  • $port = "80";

Upload your Edited files to your server

Create a directory inside your cgi-bin called mastergate and upload all the non-html files here. The html files go in your webspace.   You should password protect the admin directory.

Set Your Script Permissions

File access permissions must be set correctly for this program to run. The table below lists the permissions of each file which are to be set by the unix command (chmod) used to set the correct access permissions. You must set the access permissions for each of these files.  If you are using WS_FTP then right click on the files located on your webserver.  Then you will see a hidden menu pop up.  Click on CHMOD(UNIX).  Then a box pops up with 9 checkboxes. 

 CHMOD 755

 CHMOD 777

accountcreate.cgi

delete.cgi

add.cgi

mastergate.cgi

expire.cgi

modify.cgi

search.cgi

configure.cgi

restore.cgi

passwords

database

log

badcard.html (if used)

 

Editing the HTML forms

Edit the form actions in the admin (index.html) and the order form (index.html) files to point to the correct urls of each cgi file.  You will also need to edit the MEMBERSHIP FIELD VALUES on your signup form

MEMBERSHIP FIELD VALUES  SYNTAX VERIFICATION & IBILL BASIC TP

<select name="membership">

<option value="30">1 Month - $20

<option value="180">6 Months - $100

<option value="365">1 Year - $150

</select>

The VALUE equals the NUMBER OF DAYS this account is valid for (30 days, 180 days, and 365 days in this example).  The other part (1 Month - $20) can say anything but the VALUE="" MUST be a NUMBER.
 
MEMBERSHIP FIELD VALUES  AUTHORIZE NET

<select name="membership">

<option value="1">1 Month - $9.95

<option value="2">6 Months - $19.95

<option value="3">1 Year - $29.95

</select>

Set each membership option to a unique number.   Then go inside of the configure.cgi script and edit the following to reflect the $ per membership and the number of days ($expire) each membership is worth.
  • if ($MEMBERSHIP eq "1"){
  • $EXPIRE = "30";
  • $AMOUNT = "9.95";
  • }
  • if ($MEMBERSHIP eq "2"){
  • $EXPIRE = "60";
  • $AMOUNT = "19.95";
  • }
  • if ($MEMBERSHIP eq "3"){
  • $EXPIRE = "90";
  • $AMOUNT = "29.95";
  • }

UPLOAD THE HTML FORMS

When you have uploaded all of your HTML files you should see...

http://www.yourdomain.com/mastergate/admin/index.html

YOUR ADMIN PAGE

http://www.yourdomain.com/mastergate/order.html

YOUR ORDER PAGE (or if you have SSL)...

https://www.secureserver.com/order.html

Finally you need to create one more directory inside the mastergate folder called members.  This is what you are selling passwords to.

http://www.yourdomain.com/mastergate/members/

The password control file for this directory should map to the /cgi-bin/mastergate/passwords file