Recommend this page to a friend! |
Classes of Samuel Adeshina | PHP Authorize.net SIM | sdk/doc/AIM.markdown | Download |
|
DownloadAdvanced Integration MethodBasic OverviewThe AuthorizeNetAIM class creates a request object for submitting transactions to the AuthorizeNetAIM API. To use, create an instance of the class, set the fields for your transaction, call the method you want to use (Authorize Only, Authorize & Capture, etc.) and you'll receive an AuthorizeNetAIM response object providing easy access to the results of the transaction. Autoloading
Setting Merchant CredentialsThe easiest way to set credentials is to define constants which the SDK uses:
You can also set credentials manually per request like so:
Setting the Transaction Post LocationTo post transactions to the live Authorize.Net gateway:
To post transactions to the Authorize.Net test server:
You can also set the location manually per request:
Setting FieldsAn Authorize.Net AIM request is simply a set of name/value pairs. The PHP SDK allows you to set these fields in a few different ways depending on your preference. Note: to make things easier on the developer, the "x_" prefix attached to each
field in the AIM API has been removed. Thus, instead of setting 1.) By Setting Fields Directly:
2.) By Setting Multiple Fields at Once:
3.) By Setting Special Items To add line items or set custom fields use the respective functions: Line Items:
Custom Fields:
4.) By Passing in Objects Each property will be copied from the object to the AIM request.
Submitting TransactionsTo submit a transaction call one of the 7 methods:
Each method has optional parameters which highlight the fields required by the Authorize.Net API for that transaction type. eCheckTo submit an electronic check transaction you can set the required fields individually or simply use the setECheck method:
Partial Authorization TransactionsTo enable partial authorization transactions set the partial_auth flag to true:
You should receive a split tender id in the response if a partial auth is made:
Itemized Order InformationTo add itemized order information use the addLineItem method:
Merchant Defined FieldsYou can use the setCustomField method to set any custom merchant defined field(s):
Transaction ResponseWhen you submit an AIM transaction you receive an AuthorizeNetAIM_Response object in return. You can access each name/value pair in the response as you would normally expect:
|