EasyAuthNet Documentation

PRODUCT INFO

INSTALLATION

IONCUBE INSTALLATION

CONFIGURATION

SECURITY

LICENSE

OBJECT MODEL REFERENCE


PRODUCT INFO

Name

EasyAuthNet

Description

EasyAuthNet is a set of PHP class objects that allow for quick and easy website integration into the Authorize.net (and other Authorize.net API) gateway and allow you to accept customer credit card transaction information from your website, and post it via SSL to the authorize.net gateway without ever leaving your website.

Version

Version 1.1.2

Author

SNP Enterprises

Copyright

Copyright 2003 - 2004 © SNP Enterprises. All rights reserved.

Requirements

The following is required to use EasyAuthNet:

  • PHP 4.2+
  • CURL libcurl/7.10.4-pre1 OpenSSL/0.9.6i zlib/1.1.3
  • mcrypt Version 2.4.x
  • mhash API Version 20011020
  • ionCube Loaders (packaged with this product)
  • Authorize.net or Authorize.net API Merchant Account
  • Some knowledge of the Authorize.net API
  • Knowledge of the Authorize.net Merchant Account Interface

Authorizenet Integration Guides:

It is imprtant that you understand the API fields used when submitting transactions to the Authorizenet gateway. Please review the guides below. 

Although the scripts provided should help you get started, realize that the EasyAuthNet classes are designed to assist you in writing your own scripts. It is helpful to have some oop programming and debugging  knowledge.

Support

Support can be obtained  via our Support Forum available 24/7. Replies are usually within 24 hours.

INSTALLATION

Package Contents

  • snp/easyauthnet/encodestring.php      (Script used to encrypt secure key data)
  • snp/easyauthnet/snp_easyauthnet.php      (EasyAuthNet class file)
  • snp/easyforms/snp_forms.php      (Forms class file)
  • snp/easyforms/snp_orderform.css     (Forms cascading style sheet file)
  • snp/easyforms/snp_form_controls.php      (Form control class file)
  • snp/easyforms/snp_validate.php    (Validation class file)
  • snp/snp_utils.php     (Some utility functions)
  • snp/snp_easycrypt.php     (Encryption functions)
  • snp/easyauthnet_docs/easyauthnetdocs.htm     (Documentation file)
  • snp/easyauthnet_docs/eanlogo.gif
  • snp/easyauthnet_docs/eforms.gif
  • snp/easyauthnet_examples/demosim.req (Setup file for SIM transactions)
  • snp/easyauthnet_examples/demoaim.req (Setup file for AIM transactions)
  • snp/easyauthnet_examples/greencheck.gif
  • snp/easyauthnet_examples/aimexample.php      (AIM transaction example)
  • snp/easyauthnet_examples/simexample.php      (SIM transaction example)
  • snp/easyauthnet_examples/receipt_example.php     (ReceiptPage)
  • snp/easyauthnet_examples/order_form_example_3in1.php (Pay Method Form, Main Form, Confirm Form)
  • License

Extracting & Uploading

After downloading the EasyAuthNet package, extract the files.  The zip package will create 2 directories,  'snp', which contains the EasyAuthNet classes,  and 'ioncube' which contains the ioncube run-time loaders.  Upload these directories to your web server.

If you are using EasyAuthNet for a single website, you can save both folders to the document root. To use EasyAuthNet for virtually hosted clients, you should save the folders to a directory above, such as: '/user/local'. You can then copy the example, and doc folders to the document root of the hosted client.

The 'ioncube' directory contains the loaders needed to decode the encoded easyauthnet files. You must save the' ioncube' folder to the same level as the 'snp' folder or above. See the README and  USER-GUIDE located in the 'ioncube' folder for more information regarding installation of the 'ioncube' loaders. Before you can start using EasyAuthNet, you will need to adjust some settings in the configuration file. See the Configuration section below for an explanation of these settings.

IONCUBE INSTALLATION

Because of the secure nature of passing credit card and other sensitive data over the internet,  EasyAuthNet uses the ionCube® encoder to reduce the risk of compromising your data including account login information. The package contains a full range of loaders for a variaty of hardware. Instructions for installing and running the correct loader is located in the ionCube folder. The latest loaders can be downloaded for free from the ionCube Website.

CONFIGURATION

To successfully use EasyAuthNet, you must configure the system for your particular needs and installation.  You will need to make changes to one of the included  'setup.req' files; such as the 'demoaim.req' file located in the example folder. This file will be used to configure the EasyAuthNet transaction object at run-time.

Setup File

The 'setup.req' file contains some default settings.  The following list will give you a quick overview of these settings.

  • $map_paths- If this value is true, the system will map relative paths to physical mappings for your secure key data files. See below for further info.
  • $pk_path - This is the path to your private key. This is used when decoding your secure key data. The Private Key is generated when you use the 'encodestring.php' script. See the section on Security for further details on this setting. This should be from the root to the file. For example if $map_paths is set to false then you would use something like: '/usr/local/secure/PK.key'. If $map_paths is set to true, then you would use: '../../../PK.key'
  • $iv_path - This is the path to your initial vector key. This is used when decoding your secure key data. Initial Vector is generated when you use the 'encodestring.php' script. See the section on Security for further details on this setting.
  • $an_securekeys_path - This is the path to your encoded data key. The encoded data is generated when you use the 'encodestring.php' script. See the section on Security for further details on this setting.
  • $api_version - This is the api version to use when submitting transactions.  The value entered here is the same that is used in the Authorizenet Merchant Account Interface. See the Authorizenet Integration Guides for further explanation. Also see Setup File for further info.
  • $response_delimiter - This is the delimiter that will be used for an AIM transaction delim_data response.  The value entered here is the same that is used in the Authorizenet Merchant Account Interface. See the Authorizenet Integration Guides for further explanation. This value can also be sent on a per transaction basis from either the setup.req file,  or your Authorizenet Merchant Account settings. See Setup File for further info.
  • $confirmhash - If you are using the MD5 Hash function, set this to True. This will check for a valid hash from the Authorizenet gateway response.   See the Authorizenet Integration Guides for further explanation.
  • $continueonerror - This indicates whether or not to continue if there has been a EasyAuthNet system error.
  • $displaykeys - Indicates whether or not to display sensitive data as a series of astrix (*****). This defaults to True, and should probably not be changed.
  • $userequired - This value indicates if you want to load the required fields from the setup.req file. default is true.
  • $use_req_image - Indicates if you want to display an image for required form fields. Value defaults to true.
  • $req_image_path - The reletive path to the image file you want to use for required fields.

When you instantiate a new AIM, or SIM transaction object, you can pass the name of a user defined file which holds field information you initially want used for your transaction. The data from the $Required array located in either the 'default.req' file, or  another user defined setup file such as 'sim.req', or 'aim.req', which is supplied in the package, is loaded into the Fields collection. After that, all Posted Request fields are loaded. If the Request field is already in the Fields collection, only the value is used. To have a field automatically loaded, set   the Used flag to True in the setup file, then adjust the other values as needed. If you do not pass the name of a user defined setup file, the 'default.req' file is used. See one of the included setup files for more information. The $Required array contains all Authorizenet API fields. Before using EasyAuthNet you must set parameters for the fields you want to use.

The $Required array has the following parameters:

Field Name => array(Use,Hidden,Required,Value,Section,Control Type,Control Size)

  • Use - Load this field. True or False.
  • Hidden - Hidden  input type. True or False.
  • Required - Create client side validation and display required image(green check). True or False.
  • Value - Initial value for the field.
  • Section - An integer indicating the section to place the field on the form. defaults to 0.
  • Control Type - The control type to use for this field. See SetControl() method for valid types.
  • Control Size - The size of the control.

The x_type field value is defaulted to AUTH_CAPTURE. Change this if you would like to use another setting.

All setup files packaged with EasyAuthNet use the x_test_request field value set to true. When you are ready to authorize transactions, you must set this field value to false, or set the Use flag to false.

The following fields will automatically be added to the Fields collection when needed, even if not set in the setup file:

  • x_customer_ip
  • x_bank_aba_code
  • x_bank_acct_num
  • x_bank_acct_type
  • x_bank_name
  • x_bank_acct_name
  • x_echeck_type
  • x_card_num
  • x_exp_date
  • x_card_code
  • x_trans_id
  • x_auth_code
  • x_login
  • x_password
  • x_tran_key
  • x_hash_value
  • x_fp_hash
  • x_fp_sequence
  • x_fp_timestamp

The included setup files contain all valid Authorizenet API fields, so you should not need to add any fields to the array other then user defined fields. If you do not want or need a particular field, it is best not to remove them from the array. Instead, simply set the Use Flag to false.

Note: Fields passed to the Authorizenet gateway via the setup file, or by manually adding it to the Fields collection, will override Merchant Account settings.

Encoding Authorizenet Account Info

EasyAuthNet uses encrypted files to store your  Authorizenet Account information. Before you can use EasyAuthNet, you will need to create the files using the included 'encodestring.php' script. See the section 'Using Encode String Script' for more information on creating these files.

SECURITY

Overview

When sending sensitive,  personal, or credit card information over the internet, it is imperative that you conceal the data from prying eyes.  This includes both Client information, as well as system account information located on your web server, such as login id's, and passwords. For client information such as form data, this is done through the use of Secure Socket Layer (SSL).  SSL encrypts the data before it is passed over the internet so it is not accessible to malicious hackers.

EasyAuthNet uses SSL to post all AIM transaction data to the Authorizenet gateway.  According to the Authorizenet Integration Guide, the Authorizenet gateway will only accept AIM tranasactions if they are sent via SSL / https protocol.

When using a SIM transaction it is not nessesary to have SSL installed on your server.  That is because a SIM transaction allows you to have the client enter all sensitive data on the Authorizenet Paymernt Form which is hosted on an Authorizenet secure server. Then redirect the client to a Receipt Page also hosted on Authorizenet's secure server. EasyAuthNet allows you to still pass non sensitive information to the payment form if needed. If you do pass sensitive data to the Authorizenet Payment Form, you should use SSL.

For System information, such as your Authorizenet Account Login ID, Password, Transaction Key, MD5 Hash, and Fingerprint (SIM only), EasyAuthNet uses a Layered Encryption Scheme. The accompanying 'encodestring.php' script will allow you to generate your sensitive account information to three distinct encrypted files which can be saved to the location/s of your choice. See Using Encode String Script for further information about using the 'encodestring.php' script.

 

Using Encode String Script

After uploading the package to your web server, open your browser and type in the location of the 'encodestring.php' script. If you installed EasyAuthNet to a location outside the document root, you will need to copy the file somewhere in your doc root to use. If your server has SSL enabled, then it is advised you use 'https://'. If your workstation or development machine has PHP and other requirements listed above, you can generate the files there and move them to your web server afterwards. You must have write access to the folders you will be saving the generated files to. This documentation assumes you have the ability to manage permissions on your website, or server.

Private Key
The private Key is a random sequence of 8 Alphanumeric characters   This key is used when encoding and decoding your secure information.

Path
This is the location to which you want to save the generated files.

Encoded String
The string consists of 4 pieces of information seperated by the | (pipe) character. This information is obtained from your Authorizenet Account Interface settings. They are (in this order):

TransactionKey|HashValue|AccountLoginID|AccountPassword

You may, or may not be using the HashValue depending on your Authorizenet account settings. If not, then enter your string as:

TransactionKey||AccountLoginID|AccountPassword

See the Authorizenet Integration Guides for further explanation on these.

Validate Encoding
Check this box if you want to display the encoded strings to your browser.

Clicking on the Encode button will produce the following files:

PK.key - Your encoded Private Key.
init.key - A random encoded initialization key generated and used while encoding your secure data.
secure.dat - Your encoded data.

These files are saved to the path specified.

Note: You must have write permission to the directory you specify as the save path.

 

Saving Encoded Files

After you generate and save the encoded file, it is a good idea to relocate them. Store them in different locations. Preferably outside the document root. Make sure you update the configuration file as to there location.

LICENSE

You may download and install this Software on up to 2 computers (1 Web Server and 1 Development Machine) for your own personal non-exclusive use only.

Redistribution of this Software in any media, either known or in the future is strictly prohibited without prior written approval.

You may not resell this Software or any derived work from it alone or as part of any other commercial Software product without prior written approval.

All title and copyrights to the Software, and any accompanying printed materials, and any copies of the Software are owned by SNP ENTERPRISES.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SNP ENTERPRISES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

OBJECT MODEL REFERENCE

AIM Object (Advanced Integration Method)

AIM

Instantiate a new AIM object

Usage:

$ta = new AIM([string setupfile], [int gateway], [bool securesource])

Parameters:

string setupfile - Optional - Path to a valid setup file.
int gateway - Optional - Which gateway to use. Default is 0.
bool securesource - Optional - Wells Fargo / SecureSource transaction. Default is false.

 

Gateway Constants

AUTHORIZENET 0
PLANETPAYMENT 1
QUICKCOMMERCE 2

 

Returns:

A reference to the AIM object.
AIM Object  Methods:
Authorize: Send transaction to the Authorize.net gateway, and fill response fields. See below for a list of Response object Methods and Properties.
Usage: if ($ta->Authorize())
{
}
Parameters: None
Returns: True on success, or False if failed.

IsPostBack Checks to see if this page was posted to itself.  This is used if you use the same page as the handler page.
Usage: if($ta->IsPostBack())
{
}
Parameters: None
Returns: True or False

FormToHTML Create Form as HTML formatted string
Usage: echo $ta->FormToHTML()
Parameters: None
Returns: An HTML formatted string

AddShipping Adds Shipping Fields to the Fields collection
Usage: $ta->AddShipping()
Parameters: None
Returns: N/A

AddField This method adds a new Field object to the Fields collection.  See below for a list of Field object Methods, and Properties.
Usage: $ta->AddField(string field,int sortorder,[bool required],[bool hidden],[string value][int row],[int col],[int section])
Parameters: string field – The name of the new field.
int sortorder – The sort order of the new field
bool required – Optional - If the field is required. Default is False.
bool hidden – Optional – If the field is displayed as a hidden input type. Default is False
string value – Optional – The initial value of the field
int row – Optional – in what section row will this field be placed
int col – Optional – in what section column will this field be placed
int section – Optional – in what section will this field be placed
Returns: N/A

AddForm This method creates a new Form object.  See below for a list of Form Methods and Properties.
Usage: $ta->AddForm(string name, [string id], [bool showsectionheaders])
Parameters: string name– The name of the new field.
int id – Optional - The id of the form. Default is the name value
bool showsectionheaders – Optional - If section headers are displayed. Default is True.
Returns: N/A

DisplayFieldInfo Display Field info in a formatted HTML table.
Usage: $ta->DisplayFieldInfo([bool showall], [bool showkeys])
Parameters: bool showall – Optional – Show all field information, or just names.
bool showkey – Optional – Show sensitive information as ****

Returns:

A formatted HTML string.

DisplayResponseInfo Display Response info in a formatted HTML table.
Usage: $ta->DisplayResponseInfo()
Parameters: None
Returns: A formatted HTML string

 


GetFieldIndexByKey Returns the index of a field based on its key name.
Usage: $ta->GetFieldIndexByKey(string key)
Parameters: string key - the key (name) of the field.
Returns: An Integer number representing the index.

 


ChangeFieldOrder Changes the sort order of a field.
Usage: $ta->ChangeFieldOrder(int fieldindex, int newindex)
Parameters: int fieldindex - The index of the field you want to change.
int newindex - The new index where you want the field placed.
Returns: N/A

RemoveField Removes a Field from the Fields array.
Usage: $ta->RemoveElement(int fieldindex)
Parameters: int fieldindex - The index of thefield you want to remove.

Returns: N/A

HideAll Sets all Fields Hidden property to True.
Usage: $ta->HideAll()
Parameters: None

Returns: N/A

ShowAll Sets all Fields Hidden property to False.
Usage: $ta->ShowAll()
Parameters: None

Returns: N/A

 

AIM Object Properties:
APIMethod Get the transaction API method. Read Only
Usage: $ta->APIMethod()
Parameters: None – This property is read only and is set automatically when the AIM object is instantiated.
Returns: The current API Method “AIM”, or “SIM”

APIVersion Set or Get the API version
Usage: $ta->APIVersion([sgl version])
Parameters: single version - Optional – 3.1, or 3.0. Default is 3.1.
Returns: The current API Version.

ClientIP Set or Get the client IP
Usage: $ta->ClientIP([string ip])
Parameters: string ip – Optional – A valid IP address string
Returns: The current Client IP address

Gateway Set or Get the Authorize.net gateway, and the gateway post URL
Usage: $ta->Gateway([int gateway])
Parameters: int gateway - Optional - which gateway to use. Default is 0.

 

Gateway Constants

AUTHORIZENET 0
PLANETPAYMENT 1
QUICKCOMMERCE 2

Note: This automatically sets the gateway post URL to the correct path (see GatewayURL).

Returns: The current gateway being used.

GatewayURL Set or Get the Authorize.net gateway post URL
Usage: $ta->GatewayURL([string url]}
Parameters: string url - Optional - Gateway URL to post transaction to.

 

Gateway URL Constants

AUTHORIZENET_PATH https://secure.authorize.net/gateway/transact.dll
PLANETPAY_PATH https://secure.planetpay.com/gateway/transact.dll
QUICKCOMMERCE_PATH https://secure.quickcommerce.com/gateway/transact.dll

 

Returns: The current gateway post URL.

Login Set or Get the Authorize.net account login id
Usage: $ta->Login([string id])
Parameters: string id – Optional – A valid Authorize.net account login id.
Returns: The current Authorize.net account login id.

ReqImagePath Set or Get the path to the Required Image file.
Usage: $ta->ReqImagePath([string path])
Parameters: string path – Optional – A valid system path.
Returns: The current Required Image path.

SecureSource Set or Get if this is a Wells Fargo / SecureSource transaction
Usage: $ta->SecureSource ([bool securesource])
Parameters: bool securesource - Optional – True or False. Default is False
Returns: True or False

TransID Set or Get ID of a transaction previously authorized by the gateway.
Usage: $ta->TransID ([int id])
Parameters: int id - Optional – A valid transaction ID.
Returns: The current Transaction ID.

TransMethod Set or Get the authorization method to use.
Usage: $ta->TransMethod([string method])
Parameters: string method – Optional – The transaction method to use. Default is ‘CC’.


Transaction Method Constants

CREDIT_CARD CC
E_CHECK ECHECK

 

Returns: The current transaction method.

UseReqImage Set or Get the if you want to use a required Image file.
Usage: $ta->UseReqImage([bool use])
Parameters: bool use – Optional – True or False.
 
Returns: True or False.

UseLink Set or Get the if you want to use a hypertext link instead of a button.
Usage: $ta->UseLink([bool use])
Parameters: bool use – Optional – True or False.
 
Returns: True or False.

AuthType Set or Get the authorization type to use.
Usage: $ta->AuthType([string type])
Parameters: string type – Optional – The type of authorization to use. Default is ‘AUTH_CAPTURE’.

 

Auth Type Constants

AUTH_CAPTURE
AUTH_ONLY
PRIOR_AUTH_CAPTURE
CREDIT
CAPTURE_ONLY
VOID

The values for these constants are the same as the constant names, so you can either use the constant without double quotes or with quotes.

Returns: The current authorization type.

FieldCount Get the number of fields in the Fields collection
Usage: $fc = $ta->FieldsCount()

OR

For ($i=0;$i<=$ta->FieldCount();$i++)
{
}

Parameters: None
Returns: The number of fields in the Fields collection.

 

AIM Object Collections:
Fields This collection object is created automatically when you instantiate a new SIM object, and is initially filled with required fields from the config file, then with any request fields. This collection is accessed via a zero based index.

See below for a list of Field object Methods and Properties.

$ta->Fields[0]->Value()

OR

for ($i=0;$i<=sizeof($ta->Fields);$i++)
{
    echo $ta->Fields[I]->Value();
}

OR

foreach ($ta->Fields as $fld)
{
    echo $ta->$fld->Value();
}

FieldsKey Same as above only collection is accessed via the fields key (display name)
echo $ta->$FieldsKey[x_first_name]->Value();

 

SIM Object (Simple Integration Method)

SIM

Instantiate a new SIM object

Usage:

$ta = new SIM([string setupfile], [int gateway], [bool securesource])

Parameters:

string setupfile - Optional - Path to a valid setup file.
int gateway - Optional - Which gateway to use. Default is 0.
bool securesource - Optional - Wells Fargo / SecureSource transaction. Default is false.

 

Gateway Constants
AUTHORIZENET 0
PLANETPAYMENT 1
QUICKCOMMERCE 2

 

Returns:

A referrence to the SIM object.
Sim Object Methods:
CheckForResponse Check for gateway response, and fill response fields. See below for a list of Response object Methods, and Properties.
Usage: if ($ta->CheckForResponse())
{
}
Parameters: None
Returns: True on success, or False on failure.

FormToHTML Create Form as HTML formatted string
Usage: echo $ta->FormToHTML()
Parameters: None
Returns: An HTML formatted string

ReceiptToHTML Create Receipt as HTML formatted string
Usage: echo $ta->ReceiptToHTML()
Parameters: None
Returns: An HTML formatted string

AddShipping Adds Shipping Fields to the Fields collection
Usage: $ta->AddShipping()
Parameters: None
Returns: N/A

AddField This method adds a new Field object to the Fields collection
Usage: $ta->AddField(string field,int sortorder,[bool required],[bool hidden],[string value][int row],[int col],[int section])
Parameters: string field – The name of the new field
int sortorder – The sort order of the new field
bool required – Optional - If the field is required. Default is False.
bool hidden – Optional – If the field is displayed as a hidden input type. Default is False.
string value – Optional – The initial value of the field
int row – Optional – in what section row will this field be placed
int col – Optional – in what section column will this field be placed
int section – Optional – in what section will this field be placed
Returns: N/A

AddForm This method creates a new Form object.  See below for a list of Form Methods and Properties.
Usage: $ta->AddForm(string name, [string id], [bool showsectionheaders])
Parameters: string name– The name of the new field.
int id – Optional - The id of the form. Default is the name value
bool showsectionheaders – Optional - If section headers are displayed. Default is True.

 

Returns: N/A

DisplayFieldInfo Display Field info in a formatted HTML table.
Usage: $ta->DisplayFieldInfo([bool showall], [bool showkeys])
Parameters: bool showall – Optional – Show all field information, or just names.
bool showkey – Optional – Show sensitive information as ****
Returns: A formatted HTML string.

DisplayResponseInfo Display Response info in a formatted HTML table.
Usage: $ta->DisplayResponseInfo()
Parameters: None
Returns: A formatted HTML string

GetFieldIndexByKey Returns the index of a field based on its key name.
Usage: $ta->GetFieldIndexByKey(string key)
Parameters: string key - the key (name) of the field.
Returns: An Integer number representing the index.

ChangeFieldOrder Changes the sort order of a field.
Usage: $ta->ChangeFieldOrder(int fieldindex, int newindex)
Parameters: int fieldindex - The index of the field you want to change.
int newindex - The new index where you want the field placed.
Returns: N/A

RemoveField Removes a Field from the Fields array.
Usage: $ta->RemoveElement(int fieldindex)
Parameters: int fieldindex - The index of thefield you want to remove.

Returns: N/A

HideAll Sets all Fields Hidden property to True.
Usage: $ta->HideAll()
Parameters: None

Returns: N/A

ShowAll Sets all Fields Hidden property to False.
Usage: $ta->ShowAll()
Parameters: None

Returns: N/A

 

Sim Object Properties:
APIMethod Get the transaction API method. Read Only
Usage: $ta->APIMethod()
Parameters: None – This property is read only and is set automatically when the AIM or SIM  object is instantiated.
Returns: The current API Method “AIM”, or “SIM”

APIVersion Set or Get the API version
Usage: $ta->APIVersion([sgl version])
Parameters: single version - Optional – 3.1, or 3.0. Default is 3.1.
Returns: The current API Version.

ClientIP Set or Get the client IP
Usage: $ta->ClientIP([string ip])
Parameters: string ip – Optional – A valid IP address string
Returns: The current Client IP address

Gateway Set or Get the Authorize.net gateway, and the gateway post URL
Usage: $ta->Gateway([int gateway])
Parameters: int gateway - Optional - which gateway to use. Default is 0.

 

Gateway Constants

AUTHORIZENET 0
PLANETPAYMENT 1
QUICKCOMMERCE 2

Note: This automatically sets the gateway post URL to the correct path (see GatewayURL).

Returns: The current gateway being used.

GatewayURL Set or Get the Authorize.net gateway post URL
Usage: $ta->GatewayURL([string url]}
Parameters: string url - Optional - Gateway URL to post transaction to.

 

Gateway URL Constants

AUTHORIZENET_PATH https://secure.authorize.net/gateway/transact.dll
PLANETPAY_PATH https://secure.planetpay.com/gateway/transact.dll
QUICKCOMMERCE_PATH https://secure.quickcommerce.com/gateway/transact.dll

 

Returns: The current gateway post URL.

Login Set or Get the Authorize.net account login id
Usage: $ta->Login([string id])
Parameters: string id – Optional – A valid Authorize.net account login id.
Returns: The current Authorize.net account login id.

ReqImagePath Set or Get the path to the Required Image file.
Usage: $ta->ReqImagePath([string path])
Parameters: string path – Optional – A valid system path.
Returns: The current Required Image path.

SecureSource Set or Get if this is a Wells Fargo / SecureSource transaction
Usage: $ta->SecureSource ([bool securesource])
Parameters: bool securesource - Optional – True or False. Default is False
Returns: True or False

TransID Set or Get ID of a transaction previously authorized by the gateway.
Usage: $ta->TransID ([int id])
Parameters: int id - Optional – A valid transaction ID.
Returns: The current Transaction ID.

TransMethod Set or Get the authorization method to use.
Usage: $ta->TransMethod([string method])
Parameters: string method – Optional – The transaction method to use. Default is ‘CC’.

 

Transaction Method Constants

CREDIT_CARD CC
E_CHECK ECHECK

 

Returns: The current transaction method.

UseLink Set or Get the if you want to use a hypertext link instead of a button.
Usage: $ta->UseLink([bool use])
Parameters: bool use – Optional – True or False.
 
Returns: True or False.

UseReqImage Set or Get the if you want to use a required Image file.
Usage: $ta->UseReqImage([bool use])
Parameters: bool use – Optional – True or False.
 
Returns: True or False.

AuthType Set or Get the authorization type to use.
Usage: $ta->AuthType([string type])
Parameters: string type – Optional – The type of authorization to use. Default is ‘AUTH_CAPTURE’.

 

Auth Type Constants

AUTH_CAPTURE
AUTH_ONLY
PRIOR_AUTH_CAPTURE
CREDIT
CAPTURE_ONLY
VOID

The values for these constants are the same as the constant names, so you can either use the constant without double quotes or with quotes. 

Returns: The current authorization type.

UseRelay This property is Write Only. It sets the url to return to for a relay response or not passed to not use
Usage: $ta->UseRelay([string url])
Parameters: string url - Optional - The url to relay the response to.
Returns: N/A

ShowPayForm Set or Get if merchant wants to display the Authorize.net payment form
Usage: $ta->ShowPayForm([bool showform])
Parameters: bool showform - Optional - True or False to Show the Authorizenet Payment Form. Default is False
Returns: The current property setting.

FieldCount Get the number of fields in the Fields collection
Usage: $fc = $ta->FieldsCount()

OR

for ($i=0;$i<=$ta->FieldCount();$i++)
{
}

Parameters: None
Returns: The number of fields in the Fields collection.

 

SIM Object Collections:
Fields This collection object is created automatically when you instantiate a new SIM object, and is initially filled with required fields from the config file, then with any request fields. This collection is accessed via a zero based index.

See below for a list of Field object Methods and Properties.

$ta->Fields[0]->Value()

OR

for ($i=0;$i<=sizeof($ta->Fields);$i++)
{
    echo $ta->Fields[i]->Value();
}

OR

foreach ($ta->Fields as $fld)
{
     echo $ta->$fld->Value();
}

FieldsKey Same as above only collection is accessed via the fields key (display name)
echo $ta->$FieldsKey[x_first_name]->Value();

Form Object

Form Object Methods
AddButton Add a button to the form’s Buttons collection.

Note:  When a new form is created, a default submit button is added automatically.

Usage: $ta->Form->AddButton(string name, string value, [string type], [string onclick])
Parameters: string name The name attribute of the button.
string value The value attribute of the button.
string type – Optional – The Type attribute of the button.
string onclick – Optional – An OnClick client side function name.
Returns: N/A

AddColumn Add a column to the form’s Columns collection.
Usage: $ta->Form->AddColumn()
Parameters: None
Returns: N/A

AddRow Add a row to the forms Rows collection.
Usage: $ta->Form ->AddRow()
Parameters: None
Returns: N/A

AddSection Add a section to the forms Sections collection.
Usage: $ta->Form->AddSection(string name, [bool seplabel], [bool showheader],[int col],
[int row])
Parameters: string name – The name of the section used as the header.
bool seplabel – Optional – Indicates if the field labels should be placed next to the field, or on the next line. Default is False.
bool showheader – Optional – Indicates whether or not the section header should be displayed. Default is True.
int col – Optional – Indicates which form column the section will be rendered in. Default is 0.
int row – Optional – Indicates which form row the section will be rendered in. Default is 0.
Returns: N/A

AddElement Add an element to the form’s Elements collection.
Usage: $ta->Form->AddElement(string field, int sort, [bool required], [bool hidden],[string val],[int row], [int col], [int section])
Parameters: string field – The name of the new element.
int sort – The sort order of the new element.
bool required – Optional - If the element is required. Default is False.
bool hidden – Optional – If the element is displayed as a hidden input type. Default is False
string value – Optional – The initial value of the element.
int row – Optional – in what section row will this element be placed
int col – Optional – in what section column will this element be placed
int section – Optional – in what section will this element be placed
Returns: N/A

ListElements List all the elements associated with the form.
Usage: echo $ta->Form->ListElements()
Parameters: None
Returns: An HTML formatted string.

ChangeElementOrder Changes the sort order of a form element.
Usage: $ta->ChangeElementOrder(int elementindex, int newindex)
Parameters: int elementindex - The index of the field you want to change.
int newindex - The new index where you want the field placed.
Returns: N/A

RemoveElement Removes an Element from the forms Elements array.
Usage: $ta->RemoveElement(int elementindex)
Parameters: int elementindex - The index of the element you want to remove.

Returns: N/A

ToHTML Display the form.
Usage: echo $ta->Form->ToHTML()
Parameters: None
Returns: An HTML formatted string.

 

Form Object Properties
Name Set or Get the name of the form.
Usage: $ta->Form->Name([string name])
Parameters: string name – Optional – The name of the Form.
Returns: The current form name attribute.

Action Set or Get the action of the form.
Usage: $ta->Form->Action([string action])
Parameters: string action - Optional - Url to the action page attribute.
Returns: The current form action attribute.

Id Set or Get the id of the form.
Usage: $ta->Form->Id([string Id])
Parameters: string Id – Optional – The forms id attribute. Default is the name attribute.
Returns: The current form Id attribute.

Method Set or Get the method of the form.
Usage: $ta->Form->Method([string method])
Parameters: string method – Optional – The form method attribute. Default is ‘post’.
Returns: The current method attribute value of the form.

ShowHeaders Set or Get if the forms section headers should be rendered.
Usage: $ta->Form->ShowHeaders([bool>show])
Parameters: bool>show – Optional – Show section headers. Default is True.
Returns: True or False.

 


ReqImagePath Set or Get the path to the Required Image file.
Usage: $ta->Form->ReqImagePath([string path])
Parameters: string path – Optional – A valid system path.
Returns: The current Required Image path.

UseReqImage Set or Get the if you want to use a required Image file.
Usage: $ta->Form->UseReqImage([bool use])
Parameters: bool use – Optional – True or False.
 
Returns: True or False.

ValidateForm Set or Get if you want to generate client side validation code.
Usage: $ta->Form->ValidateForm([bool validate])
Parameters: bool validate – Optional – True or False.
 
Returns: True or False.
Form Object Collections
Columns

 

Holds the columns in the form. foreach ($ta->Form>Columns as $col)
{
     $col->Width (“50%”);
}
Rows

 

Holds the rows in the form. foreach ($ta->Form->Rows as $row)
{
     $row->Height(“50%”);
}
Sections

 

Holds the sections in the form. foreach ($ta->Form->Sections as $section)
{
     echo $section->Name();
}
Elements Holds the elements in the form. foreach ($ta->Form->Elements as $element)
{
    echo  $element->Value() ;
}
Buttons Holds the buttons in the form. foreach ($ta->Form->Buttons as $btn)
{
    echo  $btn->Type();
}

Field Object

Field Object Methods
SetControl Sets the control type of a field.
Usage: $ta->Fields[x]->SetControl (string type, [object conn], [string sql])
Parameters: string type – The type of control. Valid types are 'select', 'textbox', 'textarea', 'radio', 'checkbox', 'label', and 'cc_expire'.
object conn – Optional – A valid connection object. Used only for Select control.
string sql – Optional – SQL string used to fill options. Used only for Select control.
Returns: N/A

ToHTML Create field as HTML formatted string.
Usage: echo $ta->Fields[x]->ToHTML()
Parameters: None
Returns: An HTML formatted string.

 

Field Object Properties
Name Get or Set the name attribute of the field.
Usage: $ta->Fields[x]->Name([string name])
Parameters: string name – Optional – The text used as the name of the field.
Returns: The current name attribute of the field.

Label Get or Set the text used as the field label.
Usage: $ta->Fields[x]->Label ([string label])
Parameters: string label – Optional – The text used for the field label. Default is the name set to proper case.
Returns: The current label of the field.

LabeColor Set or Get the color of the field label.
Usage: $ta->Fields[x]->LabelColor([string color])
Parameters: string color – Optional – A string containing a valid HTML color or equivalent color code (#FFFFFF).
Returns: The current Label Color.

LabelWeight Set or Get if the text used as the field label is bold or normal.
Usage: $ta->Fields[x]->LabelWeight ([var weight])
Parameters: var weight – Optional – A var representing the Label weight. Valid values are (0,1,normal,bold)
Returns: The current label weight.

Type Get the type attribute of the field. Read Only
Usage: $ta->Fields[x]->Type ()
Parameters: None
Returns: The current type attribute of the field.

Value Set or Get the Value of the field.
Usage: $ta->Fields[x]->Value ([string value])
Parameters: string value – Optional – The field value.
Returns: The current value of the field.

Sort Get or Set the sort order of the field.
Usage: $ta->Fields[x]->Sort ([int sort])
Parameters: int sort – Optional – An integer to indicate the sort position of the field.  If a number higher then the number of fields is passed, the next highest number is used. For example, if you use 100, and there are only 5 fields, 6 will be used.
Returns: The current sort order of the field.

Required Gets or Sets if the field is a required field.
Usage: $ta->Fields[x]->Required([bool required])
Parameters: bool required – Optional – 0 No, 1 Yes.  Default is False
Returns: True or False

Visible Gets or Sets whether the field will be used in the form.
Usage: $ta->Fields[x]->Visible([bool visible])
Parameters: bool visible – Optional – 0 No, 1 Yes. Default is True.
Returns: True or False

Hidden Gets or Sets whether the field is rendered as a hidden field.
Usage: $ta->Fields[x]->Hidden([bool hidden])
Parameters: bool hidden – Optional – 0 False, 1 True. Default is False.
Returns: True or False

SectionRow Gets or Sets the section row the field will be rendered in.
Usage: $ta->Fields[x]-> SectionRow([int row])
Parameters: int row – Optional – An integer to indicate which section row the field will be placed in. Default is 0.
Returns: The current section row number.

SectionCol Gets or Sets the section column the field will be rendered in.
Usage: $ta->Fields[x]-> SectionCol([int col])
Parameters: int col – Optional - An integer to indicate which section column the field will be placed in. Default is 0.
Returns: The current section column number.

Section Gets or Sets what section the field will be rendered in.
Usage: $ta->Fields[x]->Section([int section])
Parameters: int section – Optional – An integer to indicate which section the field will be placed in. Default is 0.
Returns: The current section number.

ReqImagePath Set or Get the path to the Required Image file.
Usage: $ta->Fields[x]->>ReqImagePath([string path])
Parameters: string path – Optional – A valid system path.
Returns: The current Required Image path.

UseReqImage Set or Get the if you want to use a required Image file.
Usage: $ta->Fields[x]->UseReqImage([bool use])
Parameters: bool use – Optional – True or False.
 
Returns: True or False.

Field Validate Object

Validate Object Properties
AllowFirstItem Set or Get if a select control should allow the first item. (Selectbox only)
Usage: $ta->Fields[x]->Validate->AllowFirstItem ([bool allow])
Parameters: bool allow – Optional - True or False. 
Returns: True or False.

AllowWhitespace Set or Get if the control should allow whitespace.
Usage: $ta->Fields[x]->Validate->AllowWhitespace([bool allow])
Parameters: bool allow – Optional - True or False.
Returns: True or False.

ControlType Get or Set the validation control type.
Usage: $ta->Fields[x]->Validate->ControlType([string type])
Parameters: string type - Optional - The name of a valid control type. See the list below. Default is Textbox.

Control Types

Textbox
Textarea
Select
Checkbox
Radio
CC_Expire
Returns: The current Control Type.

ControlName Get or Set the Control Name.
Usage: $ta->Fields[x]->Validate->ControlName([string name])
Parameters: string name - Optional - The name of the control.
Returns: The current control name.

Decimal Set or Get the decimal position if any.
Usage: $ta->Fields[x]->Validate->Decimal([int decimal])
Parameters: int decimal - Optional - The number of decimal points.
Returns: The currrent Decimal value.

DisplayName Get or Set the Display Name of the control used to alert client upon validation.
Usage: $ta->Fields[x]->Validate->DisplayName([string name])
Parameters: string name - Optional - A string containing the name you would like displayed to the client upon validation.
Returns: The current DisplayName value.

Group A character used to seperate or Group a number entry.
Usage: $ta->Fields[x]->Validate->Group([string group])
Parameters: string group - Optional - The char to use as the group seperator.
Returns: The current Group value.

MinLength The minimum length of the field entry.
Usage: $ta->Fields[x]->Validate->MinLength([int min])
Parameters: int min - Optional - An integer representing the minlength. 
Returns: The current MinLength value.

MaxLength The maximum length of the field entry.
Usage: $ta->Fields[x]->Validate->MaxLength([int max])
Parameters: int max - Optional - An integer representing the maxlength. 
Returns: The current MaxLength value.

Pattern Get or Set the string pattern to validate aginst.
Usage: $ta->Fields[x]->Validate->Pattern([string pattern])
Parameters: string pattern - Optional - A sequence of characters, digits, and other characters used to validate aginst.
Returns: The current pattern string.

Required Set or Get if the control is to be validated as required.
Usage: $ta->Fields[x]->Validate->Required([bool req])
Parameters: bool req - Optional - True or False.
Returns: True or False

ValidateType Get or Set the validation type of the control. See the table below for a list of valid types. Setting this will also set the Pattern property.
Usage: $ta->Fields[x]->Validate->ValidateType([string type])
Parameters: string type - Optional - A string containing a valid validation type.

Validate Types

alphanumeric
alpha
email
numeric
cc_expire
Returns: The current validation type.

 

Control Object

Control Object Methods
AddOption Add an Option to the referenced Select control.(Select Only)
Usage: $ta->Fields[x]->Control->AddOption(string text, string value)
Parameters: string text - The option text.
string value - The option value.
Returns: N/A

Bind Bind the Select control to the database and populate options. The control is automatically bound when it is created, so if you  add any options you must Bind the control again.
(Select Only)
Usage: $ta->Fields[x]->Control->Bind ([object conn], [string sql])
Parameters: object conn - Optional - A valid database connection object.
string sql – Optional - A valid SQL statement.
Returns: N/A.

 

Control Object Properties
Name Set or Get the Name attribute of the control.
Usage: $ta->Fields[x]->Control->Name ([string name])
Parameters: string name – The Name attribute of the control.
Returns: The current Size of the control.

ID Set or Get the ID attribute of the control.
Usage: $ta->Fields[x]->Control->ID ([int id])
Parameters: int id – an integer repersenting the ID attribute of the control.
Returns: The current ID of the control.

Size Set or Get the Size attribute of the control.
Usage: $ta->Fields[x]->Control->Size ([int size])
Parameters: int size – an integer repersenting the Size attribute of the control.
Returns: The current Size of the control.

Font Set or Get the Font style of the control.
Usage: $ta->Fields[x]->Control->Font([string font])
Parameters: string font - The font to use.
Returns: The current Font.

FontSize Set or Get the Fontsize style of the control.
Usage: $ta->Fields[x]->Control->FontSize([string size])
Parameters: string size - An integer representing the fontsize in pt.
Returns: The current Fontsize.

FontWeight Set or Get the Fontweight style of the control.
Usage: $ta->Fields[x]->Control->FontSize([var weight])
Parameters: string weight - A var representing the Fontweight. Valid values are (0,1,normal,bold)
Returns: The current Fontweight.

MaxSize Set or Get the Maxsize attribute of the control. (TextBox Only)
Usage: $ta->Fields[x]->Control->MaxSize([string msize])
Parameters: string msize - An integer representing the maxsize attribute of the control.
Returns: The current Maxsize.

Type Get the Type of control. (Read Only)
Usage: $ta->Fields[x]->Control->Type()
Parameters: None
Returns: The current control Type.

Disabled Set or Get if the control is disabled.
Usage: $ta->Fields[x]->Control->Disabled([bool disabled])
Parameters: bool disabled - Optional - True or False
Returns: True or False.

Rows Set or Get the number of Rows attribute. (Textarea Only)
Usage: $ta->Fields[x]->Control->Rows([int rows])
Parameters: int rows - Optional - Number of rows to display.
Returns: The current number of Rows.

Cols Set or Get the number of Cols attribute. (Textarea Only)
Usage: $ta->Fields[x]->Control->Cols([int cols])
Parameters: int cols - Optional - Number of rows to display.
Returns: The current control Type.

Connection Set a valid database connection object. (Write Only) (Select Only)
Usage: $ta->Fields[x]->Control->Connection(object conn)
Parameters: object conn - A valid database connection object.
Returns: N/A

SQL Set or Get a valid SQL statement used to populate a Select control.
(Select Only)
Usage: $ta->Fields[x]->Control->SQL ([string sql])
Parameters: string sql – A valid SQL statement.
Returns: The current SQL statement.

SelectedIndex Set or Get a valid SQL statement used to populate a Select control.
(Select Only)
Usage: $ta->Fields[x]->Control->SQL ([string sql])
Parameters: string sql – A valid SQL statement.
Returns: The current SQL statement.

OnChange Set or Get the client side function to run when a onChange event occurs.
Usage: $ta->Fields[x]->Control->OnChange([string function])
Parameters: string function - Optional - A valid client side function name with parameters. Example: 'checkControl(this)'
Returns: The current OnChange value.

 

Response Object

Response Object Properties
ValidHash If the MD5 Hash is used, is it valid.
Usage: $ta->Response->ValidHash()
Parameters: None
Returns: True or False

Successful If the Response was successful.
Usage: $ta->Response->Successful()
Parameters: None
Returns: True or False

Code The Response Code returned by the gateway.
Usage: $ta->Response->Code()
Parameters: None
Returns: A number indicating the status of the approval.

 

Gateway Approval Constants

AUTH_APPROVED 1
AUTH_DECLINED 2
AUTH_ERROR 3

 


SubCode The Response Sub Code returned by the gateway.
Usage: $ta->Response->SubCode()
Parameters: None
Returns: A numeric code indicating the SubCode  returned by the gateway.

ReasonCode The Response Reason Code returned by the gateway.
Usage: $ta->Response->ReasonCode()
Parameters: None
Returns: A numeric code indicating the Reason Code  returned by the gateway.

ReasonText The Response Reason Text returned by the gateway.
Usage: $ta->Response->ReasonText()
Parameters: None
Returns: A text string containing the Response Reason Text returned by the gateway.

ReasonNote Additional  Response Reason Notes from the Authorizenet Integration Guides.
Usage: $ta->Response->ReasonNote()
Parameters: None
Returns: A text string containing the Response Reason Note.

AuthCode The Authorization Code returned by the gateway.
Usage: $ta->Response->AuthCode()
Parameters: None
Returns: A 6 digit code indicating the Authorization Code  returned by the gateway.

CardCode The Card Code returned by the gateway.
Usage: $ta->Response->CardCode()
Parameters: None
Returns: A letter indicating the status of the Card Code check.

 

Card Code Constants

CC_MATCH M
CC_NO_MATCH N
CC_NOT_PROCESSED P
CC_SHOULD_BE_PRESENT S
CC_UNABLE_TO_PROCESS U

 


CardCodeText The text associated with the Card Code returned by the gateway.
Usage: $ta->Response->CardCodeText()
Parameters: None
Returns: A string containing the text associated with the Card Code  returned by the gateway.

AVSCode The AVS Code returned by the gateway.
Usage: $ta->Response->AVSCode()
Parameters: None
Returns: A letter indicating the status of the AVS match.

 

AVS Code Constants

AVS_ADDRESS_MATCH_ONLY A
AVS_ADDRESS_NOT_PROVIDED B
AVS_ERROR E
AVS_NON_US_ISSUING_BANK G
AVS_NO_MATCH N
AVS_NOT_APPLICABLE P
AVS_RETRY_UNAVAIL R
AVS_SERVICE_NOT_SUPPORTED S
AVS_ADDRESS_INFO_UNAVAIL U
AVS_5ZIP_MATCH_ONLY Z
AVS_9ZIP_MATCH_ONLY W
AVS_5ZIP_MATCH Y
AVS_9ZIP_MATCH X

 


AVSText The text associated with the AVS Code returned by the gateway.
Usage: $ta->Response->AVSText()
Parameters: None
Returns: A string containing the text associated with the AVS Code  returned by the gateway.