[ic] Authorize.Net integration instructions

Jud Harris jud-lists@copernica.com
Wed, 14 Mar 2001 15:35:15 -0600


Hey folks -

Here's how to get authorize.net processing into Interchange.  Please note that
my understanding of the ins and outs of IC is limited, I just know our store is
working well so far with authorize.net.  This should work out-of-the-box with
the included demo construct store.  We're using a slightly modified
pages/ord/checkout.html page for orders, but none of the processing variables
were changed.

First off...

With the newer version(s) of IC, an authorizenet module is included in the
[src/interchange]/eg/globalsub/authorizenet

*copy this* file to your installed ../interchange/globalsub directory -

NOTE: don't attempt to perl -d the file or run it to check its functionality, as
it is made to be embedded into interchange when it starts.  If you make
modifications to it, remove everything except the section beginning with "sub
authorizenet .. {" and ending with "}"

After copying the file, take a look at it.  It should tell you to add the
following lines to your catalog's catalog.cfg file:

Variable MV_PAYMENT_ID           [YourAuthorizeNetID]
Variable MV_PAYMENT_SECRET    [YourAuthorizeNetPassword]
Variable MV_PAYMENT_MODE       custom authorizenet
Variable MV_PAYMENT_REFERER
[http://www.yourstore.com/cgi-bin/yourICbinary.cgi/process.html]

Restart the interchange server - note: you won't see any textual notification
that the authorizenet module is successfully included, but if there's an error
in the file, it will report it.

**NOTE:  Be sure your authorize.net account is in TEST MODE before running any
transactions, or at least be ready to void transactions and incur transaction
fees.

Now you *should* be able to order an item using a valid credit card.  You'll
notice that authorize.net won't notice any of your test transactions in its
Transactions section, so there's no way for you to know if the customer data
(other than the credit card num and expiration) are being transmitted
successfully.

In fact, by default, they aren't.  You'll notice the authorizenet module only
processes a minimum amount of information with each transcation.  For instance,
if an order has different billing and shipping addresses, the billing first name
and last name, address, city, state, zip, etc, .. are transmitted to
authorize.net as the shipping information as well.  You'll also probably notice
that all other fields except first name, last name, city, state, and zip are NOT
transmitted to authorize.net.  This is because the variable names in the
authorizenet module do not correspond to the variable names in the checkout.html
file.  You can easily adjust the code to account for other variable names.
Refer to the Appendix B of the developer section of the authorize.net interface
for a mapping of their field names (such as x_Ship_To_First_Name).

Here's some code from my slightly modified authorizenet file.  Now my
transactions are logging the correct address data, but I still can't get the
phone or email to appear at all.  (Anyone have clues?)

---

# if the billing section of checkout.html appears to be blank,
    # copy the customer shipping info to the billing vars

    if (($actual{b_address1} eq "") ||
        ($actual{b_zip} eq "")) {

        $actual{b_fname}    = $actual{fname};
        $actual{b_lname}    = $actual{lname};
        $actual{b_company}  = $actual{company};
        $actual{b_address1} = $actual{address1};
        $actual{b_address2} = $actual{address2};
        $actual{b_city}     = $actual{city};
        $actual{b_state}    = $actual{state};
        $actual{b_zip}      = $actual{zip};
        $actual{b_country}  = $actual{country};
    }


    # concatenate the two addresses into one if a second address line exists

    if ($actual{address2} ne "") {
        $actual{address} = "$actual{address1}" . ", " . "$actual{address2}";
    } else {
        $actual{address} = $actual{address1};
    }

    if ($actual{b_address2} ne "") {
        $actual{b_address} = "$actual{b_address1}" . ", " .
"$actual{b_address2}";
    } else {
        $actual{b_address} = $actual{b_address1};
    }


 my %query = (
                    x_Method        => 'CC',
                    x_Type          => $actual{mv_payment_mode},
                    x_Card_Num      => $actual{mv_credit_card_number},
                    x_Exp_Date      => $exp,
                    x_Amount        => $amount,
                    x_First_Name    => $actual{b_fname},
                    x_Last_Name     => $actual{b_lname},
                    x_Company       => $actual{company},
                    x_Address       => $actual{b_address},
                    x_City          => $actual{b_city},
                    x_State         => $actual{b_state},
                    x_Zip           => $actual{b_zip},
                    x_Country       => $actual{b_country},
                    x_Ship_To_First_Name    => $actual{fname},
                    x_Ship_To_Last_Name     => $actual{lname},
                    x_Ship_To_Company       => $actual{company},
                    x_Ship_To_Address       => $actual{address},
                    x_Ship_To_City          => $actual{city},
                    x_Ship_To_State         => $actual{state},
                    x_Ship_To_Zip           => $actual{zip},
                    x_Ship_To_Country       => $actual{country},
                    x_Email                 => $actual{email},
                    x_Invoice_Num   => $actual{mv_order_number},
                    x_Phone         => $actual{phone_day},
                    x_Password      => $secret,
                    x_Login         => $user,
                    x_Version       => '3.0',
                    x_ADC_URL       => 'FALSE',
                    x_ADC_Delim_Data => 'TRUE',
    );

---

So... give the default code a try first and let me know how it goes.  I really
sympathize with authorize.net folks because of the lack of documentation and
scattered mailing list archive contents.

Good luck!
-Jud