ColdFusion and authorize.net

132 views
Skip to first unread message

hofar...@houseoffusion.com

unread,
Jul 21, 2014, 3:03:20 PM7/21/14
to ColdFusion Technical Talk

ColdFusion 9
MS SQL Server 2012
authorize.net API

Hi. I need help with a problem, and am hoping someone here can guide me on the right path.

In brief: I need to populate an authorize.net payment page using information from a simple form that is processed in coldfusion.

Details: I need to do something fairly simple -- or, I am told it is simple. =) Here is what the client wants to happen:

After the user fills out and submits the simple registration form, she should then see the authorize.net payment page where she pays conference registration fees; the client would like the authorize.net payment page to already display the information (name, address, payment amount, and so on) that the user already typed in the ColdFusion form

I downloaded some sample code from authorize.net -- it is given below.

I would like the registrant to register her information -- name, address, conference fee -- then go to the authorize.net payment page and see all of her contact information, and the conference fee that she selected, already populated in the payment fields.

Has anyone here done this with ColdFusion? I am not clear how to integrate the cfhttp code with my existing, simple registration form.

Thank you for your advice.

Eric

<cfsetting enablecfoutputonly="true">
<cfoutput>
<!--
This sample code is designed to connect to Authorize.net using the AIM method.
For API documentation or additional sample code, please visit:
http://developer.authorize.net
-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML lang='en'>
<HEAD>
<TITLE> Sample AIM Implementation </TITLE>
</HEAD>
<BODY>
<P> This sample code is designed to generate a post using Authorize.net's
Advanced Integration Method (AIM) and display the results of this post to
the screen. </P>
<P> For details on how this is accomplished, please review the readme file,
the comments in the sample code, and the Authorize.net AIM API documentation
found at http://developer.authorize.net </P>
<HR />

</cfoutput>
<!--- ColdFusion's cfhttp object is specifically designed to create a post,
and retrieve the results. Those results are accessed in cfhttp.filecontent --->
<!--- By default, this sample code is designed to post to our test server
for developer accounts: https://test.authorize.net/gateway/transact.dll
for real accounts (even in test mode), please make sure that you are\posting to: https://secure.authorize.net/gateway/transact.dll --->
<cfhttp method="Post" url="https://test.authorize.net/gateway/transact.dll">
<!--- the API Login ID and Transaction Key must be replaced with valid values --->
<cfhttpparam type="Formfield" name="x_login" value="API_LOGIN_ID">
<cfhttpparam type="Formfield" name="x_tran_key" value="TRANSACTION_KEY">

<cfhttpparam type="Formfield" name="x_delim_data" value="TRUE">
<cfhttpparam type="Formfield" name="x_delim_char" value="|">
<cfhttpparam type="Formfield" name="x_relay_response" value="FALSE">

<cfhttpparam type="Formfield" name="x_type" value="AUTH_CAPTURE">
<cfhttpparam type="Formfield" name="x_method" value="CC">
<cfhttpparam type="Formfield" name="x_card_num" value="4111111111111111">
<cfhttpparam type="Formfield" name="x_exp_date" value="0115">

<cfhttpparam type="Formfield" name="x_amount" value="19.99">
<cfhttpparam type="Formfield" name="x_description" value="Sample Transaction">

<cfhttpparam type="Formfield" name="x_first_name" value="John">
<cfhttpparam type="Formfield" name="x_last_name" value="Doe">
<cfhttpparam type="Formfield" name="x_address" value="1234 Street">
<cfhttpparam type="Formfield" name="x_state" value="WA">
<cfhttpparam type="Formfield" name="x_zip" value="98004">
<!--- Additional fields can be added here as outlined in the AIM integration
guide at: http://developer.authorize.net --->
<!--- The following fields show an example of how to include line item details, they are commented out by default.
<cfhttpparam type="Formfield" name="x_line_item" value="item1<|>golf balls<|><|>2<|>18.95<|>Y">
<cfhttpparam type="Formfield" name="x_line_item" value="item2<|>golf bag<|>Wilson golf carry bag, red<|>1<|>39.99<|>Y">
<cfhttpparam type="Formfield" name="x_line_item" value="item3<|>book<|>Golf for Dummies<|>1<|>21.99<|>Y">
--->
</cfhttp>

<!--- Because coldfusion's ListToArray object ignores empty fields, we must
put a space in all empty fields to make sure that they are not skipped --->
<cfset post_response=Replace(cfhttp.filecontent,"||","| |", "all")>
<!--- the same command is run twice, because the first time it only adjusts
every other empty field --->
<cfset post_response=Replace(post_response,"||","| |", "all")>

<!--- now the ListToArray method can be used without skipping fields --->
<cfset response_array=ListToArray(post_response, "|")>

<!--- the results are output to the screen in the form of an html numbered list. --->
<cfoutput>
<OL>
<cfloop index="i" from="1" to="#arrayLen(response_array)#">
<LI>#response_array[i]# &nbsp;</LI>
</cfloop>
</OL>
<!--- individual elements of the array could be accessed to read certain
response fields. For example, response_array[1] would return the Response
Code, response_array[3] would return the Response Reason Code.
For a list of response fields, please review the AIM Implementation Guide --->

</BODY>
</HTML>
</cfoutput>





*******
Eric Bourland
Internet Project Development
Washington DC

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358931

hofar...@houseoffusion.com

unread,
Jul 21, 2014, 6:36:22 PM7/21/14
to ColdFusion Technical Talk

Hi Eric.

It sounds like you're a bit off on what you're looking for vs. what
you're trying to implement.

From the description of the process you want it sounds like you're
looking for Simple Checkout or Server Integration Method while the code
below is for Advanced Integration Method.

You can review the different approaches here:
http://developer.authorize.net/api/compare/

Simple Checkout and SIM let you collect the payment on the Authorize.net
site and then get a success/decline response back. Their docs should
help. Basically, what you do is link or post some basic information to
Auth.net, they do the charge and then redirect back to your
results/thankyou with the result in the query string, you then take that
and update your records.

Using AIM, the billing information is posted from your form to your
server and on the server side, you take that info and pass it to
Auth.net (using CFHTTP) and then parse the response and update your
records before redirecting to/displaying your receipt/thankyou page.

If you want to use AIM, the best way to do it is using:
http://cfpayment.riaforge.org/ It very nicely wraps and abstracts all
the payment processing trickiness into a standardized API. The same
interface works with a number of other processors so switching between
them simply involves specifying which gateway to use and providing the
necessary credentials. (I wrote the Authorize.net gateway used in
cfpayment.)

I haven't implemented Simple Checkout or SIM but would be willing to
take a look at what you've got once you read the docs and have some code
started.

(Here's the 15 minute setup for SIM:
http://developer.authorize.net/integration/fifteenminutes/#hosted in
PHP, but should be apparent how to translate it to CFML.)

Cheers,
.jonah
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358939

hofar...@houseoffusion.com

unread,
Jul 22, 2014, 10:22:53 AM7/22/14
to ColdFusion Technical Talk

Hi Eric

I use coldfusion and authorize.net and I am big into simple

Take a look at:
https://www.appreciativeway.com/secure/paymentPortal.cfm

If that is what you want I could help you off line.

Biggest challenge is maintaining the PCI compliance to which end you may want
to use their forms.

Rob
Robert J. Voyle, Psy.D.
Director, Clergy Leadership Institute
For Coaching and Training in Appreciative Inquiry
Author: Restoring Hope: Appreciative Strategies
to Resolve Grief and Resentment
http://www.appreciativeway.com/
503-647-2378 or 503-647-2382
> Subscription:
> http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
> Unsubscribe:
> http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358959
Reply all
Reply to author
Forward
0 new messages