• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Authorize.net CIM form and API

New Here ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

Has anyone built the forms and code for this API in CF?  I don't have a specific problem - I'm just looking for some shared code so that I can perhaps save some coding time.

Thanks!

Shane

TOPICS
Advanced techniques

Views

991

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Oct 06, 2009 Oct 06, 2009

Copy link to clipboard

Copied

You might check for an Authorize.net project at RIA Forge.

http://www.riaforge.org

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 06, 2009 Oct 06, 2009

Copy link to clipboard

Copied

LATEST

Shane,

It's pretty basic (from a 2007 site!) but here's an old Authorize.net payment script I had. Any form will do and, based on the CFHTTP I have below, you just replace your form field variables where I have session.cart.get____(). I included the snippet of code that pulled out the response from the Authorize.net returned data. Like I said, it's pretty basic but I hope it gets you started in terms of submitting payments to Authorize.net.

<!--- 4111-1111-1111-1111 (fake visa number) ---> <!--- https://secure.authorize.net/gateway/transact.dll ---> <!--- https://test.authorize.net/gateway/transact.dll --->

<cfhttp method="post" url="https://secure.authorize.net/gateway/transact.dll">      <cfhttpparam name="x_login" type="formfield" value="YOUR LOGON">      <cfhttpparam name="x_tran_key" type="formfield" value="YOUR TRANSACTION KEY">      <cfhttpparam name="x_method" type="formfield" value="CC">      <cfhttpparam name="x_type" type="formfield" value="AUTH_CAPTURE">      <cfhttpparam name="x_amount" type="formfield" value="#Trim(session.cart.getPayment().getTotal())#">      <cfhttpparam name="x_delim_data" type="formfield" value="TRUE">      <cfhttpparam name="x_delim_char" type="formfield" value="|">      <cfhttpparam name="x_relay_response" type="formfield" value="FALSE">      <cfhttpparam name="x_card_num" type="formfield" value="#Trim(session.cart.getPayment().getCardNumber())#">      <cfhttpparam name="x_exp_date" type="formfield" value="#session.cart.getPayment().getCardExpiration()#">      <cfhttpparam name="x_version" type="formfield" value="3.1">      <cfhttpparam name="x_invoice_num" type="formfield" value="#session.orderNumber#">      <cfhttpparam name="x_description" type="formfield" value="Order #DateFormat(Now(),'mm-dd-yyyy hh:mm')#">      <cfhttpparam name="x_first_name" type="formfield" value="#Trim(session.cart.getCustomer().getFirstName())#">      <cfhttpparam name="x_last_name" type="formfield" value="#Trim(session.cart.getCustomer().getLastname())#">      <cfhttpparam name="x_email" type="formfield" value="#Trim(session.cart.getCustomer().getEmail())#">      <cfhttpparam name="x_address" type="formfield" value="#Trim(session.cart.getCustomer().getAddress())#">      <cfhttpparam name="x_city" type="formfield" value="#Trim(session.cart.getCustomer().getCity())#">      <cfhttpparam name="x_state" type="formfield" value="#Trim(session.cart.getCustomer().getState())#">      <cfhttpparam name="x_zip" type="formfield" value="#Trim(session.cart.getCustomer().getZipCode())#">      <cfhttpparam name="x_email_customer" type="formfield" value="true">      <cfhttpparam name="x_merchant_email" type="formfield" value="EMAIL"> </cfhttp> <cfset api_response=cfhttp.fileContent />

<!--- check the response headers to ensure that payment was good ---> <cfscript>      aryApiResponse = ListToArray(api_response, "|"); </cfscript> <cfif IsDefined("aryApiResponse") and ArrayLen(aryApiResponse) and Trim(aryApiResponse[1]) is not 1>      <cfset paymentReceived = false />      <cfif ArrayLen(aryApiResponse) gte 4>      <cfloop from="1" to="4" index="j">           <cfscript>

               tmpError = "<em>Payment Error</em> " & aryApiResponse & ".";

               ArrayAppend(session.aryCartErrors,tmpError);           </cfscript>      </cfloop>      </cfif>

<cfelse>

     <!--- we're good --->

</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation