Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

Integrating With Authorize.net Using SIM

By Will Bontrager
2003-02-11


Using a Perl Program To Display the Form With Fingerprint Automatically Inserted

SIM.zip has a file named subroutine.cgi, which contains a subroutine named GenerateSIMhiddenFields. (The subroutine takes up the bottom half of the file.)

subroutine.cgi is intended to be used for modifying other scripts (see "Modifying Scripts To Create the Fingerprint" and "Detailed Instructions For Master Form" below), but can also be used as a program by itself.

To use it as a program by itself, first create an order verification form template page. The template page would have a [[SIMFIELDS]] placeholder where the SIM hidden fields are to be inserted and it might have one or more [[amount]] placeholders to be replaced with the total order amount. See file SIMexampleOrderVerification.html (part of SIM.zip) for an example.

Next, modify subroutine.cgi.

1. Decide whether your going to use the http://... URL
method to retrieve the template page or read the
page directly from your server. Remove the code that
you will not be using (the sections are marked).

2. Subroutine GenerateSIMhiddenFields has three places
requiring custom information:

i. Your Login ID.

ii. Your Transaction Key (obtained from
authorize.net according to their instructions).

iii. Whether or not to generate a certain hidden
field whenever a currency code is specified.

~~ If you do provide that hidden field on your
order verification form, specify No, and
the subroutine will not generate the hidden
field so you won't end up with a duplicate.

~~ If you don't provide that hidden field,
specify Yes, and the subroutine will
generate the hidden field as needed.

If you use the downloaded file
SIMexampleOrderVerification.html as your
order verification form, specify Yes so
subroutine.cgi will generate the hidden
field as needed.

Upload your order verification form template page and script subroutine.cgi into your cgi-bin as plain text files. Give subroutine.cgi 755 permissions.

Last, call subroutine.cgi with a form on the page prior to presenting the order verification form. This might be a shopping cart page or a product page.

The form that calls subroutine.cgi may have one or two fields. If one, the field must be named "amount". If two, the second field must be named "currency". Here is an example form:

<form method="POST" action="/cgi-bin/subroutine.cgi">
<input type="hidden" name="amount" value="24.95">
<input type="hidden" name="currency" value="USD">
<input type="submit" value="Click to verify your order">
</form>

When the above button is clicked, subroutine.cgi will

1. Retrieve the order verification form template page.

2. Insert the SIM hidden fields into the template page
in place of the [[SIMFIELDS]] placeholder.

3. Replace any [[amount]] placeholders with the value
of the name="amount" field submitted to the script.

4. Display the completed order verification form in
the customer's browser.


Tutorial Pages:
» Integrating With Authorize.net Using SIM
» How SIM Works
» The Order Verification Form
» Customizing the SIM.cgi Script
» Using SSI To Insert the Fingerprint
» Using JavaScript To Insert the Fingerprint
» Using a Perl Program To Display the Form With Fingerprint Automatically Inserted
» Modifying Scripts To Create the Fingerprint
» Detailed Instructions For Master Form
» The Order Verification Form Modification Step
» Uploading the Three Files To Your Server
» Testing
» Changing Transaction Keys


Copyright 2004 Bontrager Connection, LLC


 | Bookmark
Related Tutorials:
» Random subroutines in Perl
» Log Script Use
» Creating Perl Modules for Web Sites
» Bit Vector, Using Perl Vec
» Build a Perl/CGI Voting System
» Perl Range Operator

Ask A Question
characters left.