AuthorizeNet_AIM_9 - Payment processing tag for Lasso Professional 9 and the Authorize.Net AIM v3.1 payment processing gateway
The project AuthorizeNet_AIM_9 and its source files are hosted on GitHub.
This method is a conversion of the AuthorizeNet_AIM payment processing method from Lasso 8 to Lasso 9.
This method has one required parameter, -AIMParams, and two optional parameters, -testdeveloper and -testrequest.
-AIMParams is an unnamed map of name/value pairs representing the parameters to be passed to Authorize.Net.
-testdeveloper is a boolean that when TRUE submits a test transaction to Authorize.Net's "test" URL. Default is FALSE.
-testrequest is a boolean that when TRUE submits a test transaction request to the designated URL ("test" or "secure") as set in the method configuration or by the -testdeveloper keyword parameter. Default is FALSE.
This method returns a value which is either a string or a map.
- If the returned value is a string, the string is a plain text error message returned by Authorize.Net indicating that you have not properly configured the Authorize.Net Merchant Interface or this method's settings.
- If the returned value is a map, it contains the key/value pairs of non-empty parameters in the response returned by the Authorize.Net gateway.
Support Free and Open Source Software Contributions¶
If you like this method or documentation, or think I need to spend less time at the computer and take my wife out on a date night, then consider sending either a recurring donation via GitTip for as small as 25¢ per week, or a one-time donation via PayPal.
Duke accepts donations of biscuits and cabbages. woof.
It is highly recommend to store the AuthorizeNet_AIM_9 type in a location on your web server that cannot be served, preferably outside of your web root. You do not want your login or transaction key to be served as a plain text file.
- configuring the Authorize.Net website Merchant Interface,
- setting values in this method, and
- passing values into this method as a map of key/values.
Setting values in this method or by passing in parameters¶
You can choose to either set configuration values in this method below, or pass them in as values in the map of AIM parameters. Any values passed into this method will override their corresponding values entered below.
In your page that calls [AuthorizeNet_AIM_9], build a map of parameters to send to the method.
1 2 3 4 5
var('AIMParams') = map( 'x_first_name' = $first_name, 'x_last_name' = $last_name, 'x_amount' = $amount, ... and so on...)
2. Set a variable to the method¶
When calling [AuthorizeNet_AIM_9], store the results in a variable. This will allow you to easily code logic in your page to take appropriate action based on the results (Response Code, etc.) from Authorize.Net.
var('aim_results') = AuthorizeNet_AIM_9($AIMParams)
Optionally, use the following following parameters.
-testdeveloper=TRUE submits a test transaction to Authorize.Net's "test" URL. Default is FALSE.
-testrequest=TRUE submits a test transaction request to the designated URL ("test" or "secure") as set in the method configuration or by the -testdeveloper keyword parameter. Default is FALSE.
The following sends a map of parameters to the method, which posts the parameters to Authorize.Net's test server as a test transaction request.
1 2 3 4
var('aim_results') = AuthorizeNet_AIM_9( $AIMParams, -testdeveloper=TRUE, -testrequest=TRUE)
3. Sample page logic¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// evaluate results and make appropriate decisions if($aim_results->find('x_response_code') == '1') // transaction approved else // transaction failed select($aim_results->find('x_response_code')) case('2') // declined case('3') // transaction processing error case('4') // held for review case // undefined error /select /if
4. Sample message¶
I recommend displaying a simple error message "Your request could not be processed. Please contact us at _____ during normal business hours." Don't encourage users to try again because it will just frustrate them, or possibly cause much worse problems (multiple payments, trigger an over limit event, trigger a fraud alert with the card issuer, etc.). And in the case of actual fraud, you don't want to tip off the fraudster of why the transaction was declined.
1 2 3
$sample_msg->append('Thank you, ' + $aim_results->find('x_first_name') + '! You have personally enriched me by $' + $aim_results->find('x_amount') + '.')
5. Custom labels¶
You can add merchant-defined results labels to #aimresultlabels, and access them after they are echoed by Authorize.Net.
Here is a code sample that sends an authorize-only transaction to the Authorize.Net test server.
1 2 3 4 5 6 7 8 9 10 11 12
[ var('AIMParams') = map( 'x_login'='ENTER_YOUR_LOGIN', 'x_tran_key'='ENTER_YOUR_TRANSACTION_KEY', 'x_type'='auth_only', 'x_card_num'='5424000000000015', // dummy CC# 'x_exp_date'='1220', // December 2020 'x_amount'='0.01') var('results') = AuthorizeNet_AIM_9($AIMParams, -testdeveloper=true) $results ]
See the comments embedded in the method's code for proper configuration.
For rapid testing:
- Copy the files AuthorizeNet_AIM_9.inc and AuthorizeNet_AIM_9.lasso to your web server.
- Configure settings in both files accordingly. The settings in the latter override the former.
- Save and load AuthorizeNet_AIM_9.lasso to see the results.
Additional eCommerce Resources¶
The following information does not constitute an endorsement, warranty or guarantee of service. This information is provided for the sake of comparison. These are the lowest fees I have found over the years.
For further information on developing for AIM, download the AIM Guide.
In addition to this method, the following are requirements.
- Dedicated IP for SSL (~$10/month).
- Secure certificate (starting at $10/year from NameCheap.com)
- Merchant account that accepts payments over the Internet. Some brick and mortar retailers already have a merchant account, so sometimes it is easier to add this feature to their existing merchant account. If you need a merchant account, you can support the continued development of the AuthorizeNet_AIM_9 method using my referral link. As of May 28, 2014, the merchant account costs $8.95/month (for a statement fee), plus 2.14% of the transaction amount and 24¢ per transaction. Everything else is free.
- payment gateway (an Authorize.Net account, for example). I am an Authorize.Net account reseller. You can support the continued development of the AuthorizeNet_AIM_9 method by following my reseller link. As of May 28, 2014, the cost is $17.95/month, plus $99.00 account setup, plus $0.10 per transaction.
I am available as a consultant for ecommerce solutions. Please visit Services for more information.
Notes and Acknowledgments¶
This version has not been tested against an actual Authorize.Net gateway account. It has been tested against a developer test account only. Please let me know if you perform any tests against an actual Authorize.Net gateway account and the results of your tests.
Did you like this article? Please send me a Gratipay, as little as 25¢ per week!
Updates, suggestions and comments regarding this article may be sent to Steve Piercy, [email protected] or comment using Disqus.