Search Knowledge Base:
  Examples: "merchant account", "AVS", or "Batch"

LIVE CHAT

NOTE: The code provided below is only a sample.   This code has been tested on Windows NT 4.0 servers running IIS 4.0 with Active Server Pages and Perl5. This can be used but will need to be modified to perform the necessary database operations and any customer invoice notifications.  If any of the code is cut and pasted into a file, their will be formatting characters that will cause errors due to this being an HTML document. All leading spaces must be deleted and re-spaced in your text editor of choice.

Sample Perl Script to Receive the Transaction Results

#! /perl5/bin
######################################################################
# Program : Sample Receipt.cgi
# Subject : This program will parse all the GET method data.
######################################################################
push (@INC, "perl5/lib");
print "Content-type: text/HTML \n\n";

$FORM_DATA = $ENV{'QUERY_STRING'};
foreach (split(/&/, $FORM_DATA))
{
($NAME, $VALUE) = split(/=/, $_);
$NAME =~ s/\+/ /g;
$NAME =~ s/%(A-F{2})/pack(C,hex($1))/eg;
$VALUE =~ s/\+/ /g;
$VALUE =~ s/%(A-F{2})/pack(C,hex($1))/eg;

# Find unique Variable Name for every variable coming in from the form input

$NUM = 0;
while ($MYVARS{$NAME} ne "")
    {
    $NUM++;
    $NAME =~ s/\.(0-9+$)|$/\.$NUM/;
    }

# Store Variable NAME=Variable VALUE pair

$MYVARS{$NAME} = $VALUE;
}

$Success = "$MYVARS{'Status'}";
$OrderID = "$MYVARS{'OrderID'}";
## You can receive the rest of the documented key=value pairs by following the code above.  #

print <<"HTML";
<HTML><HEAD><TITLE>SAMPLE RECEIPT.CGI</TITLE></HEAD>
<BODY>
HTML

if ($Success == 1)
    {
    print "Transaction was a success!<br>\n";
    #  Do your order fulfillment here.  Any emails to customer, merchant and database processing.  #
    }
elsif ($Success == 0)
    {
    print "Transaction was not successful!<br>\n";
    #  Remove the current order information from your database based on the OrderID.  #
    }

print <<"HTML_END";
</BODY>
</HTML>
HTML_END



Sample ASP (Active Server Page) script to receive the Transaction Results.

<%
' Sample Receipt.asp
Success = Request.QueryString("Status")
OrderID = Request.QueryString("OrderID")
' The rest of the key=value pairs can be received by following the code above.
%>
<HTML><HEAD><TITLE>SAMPLE RECEIPT.ASP</TITLE></HEAD>
<BODY>
<%
If Success = "1" then
    Response.Write "Transaction was a success!<br>"
    '  Do your order fulfillment here.  Any emails to customer, merchant and database processing.
Else
    Response.Write "Transaction was not successful!<br>"
    '  Remove the current order information from your database based on the OrderID.
End If
%>
</BODY>
</HTML>

All Content © Copyright 2005, GoEmerchant.com. All Rights Reserved.

Privacy Policy Terms & Conditions Site Map