Home > Developers: Integration Overview > Transparent Database Engine > Perl: Transparent Database Engine

Notice

Use of this integration method requires intermediate to advanced programming skills.

eProcessing Network offers the following sample Perl source code to assist developers in integrating the eProcessing Network Transparent Database Engine Template for payment processing.

Please note the following:

  • The sample source code shown below uses hard-coded values. You, as a programmer, must replace these hard-coded values with the values you prompt customers for.

  • The hard-coded test account number can be used if you do not yet have an eProcessing Network account. A test transaction can be run at anytime by simply using the merchant's eProcessing Network account number as the credit card number, regardless of whether you are using a test account number or a live account number.

  • ExpMonth and ExpYear must both be in two-digit format or you will very definitely achieve unexpected results because of the different ways issuing banks process transactions.

The required format of the variable names to pass to TDBE are as follows:

ePNAccount, CardNo, ExpMonth, ExpYear, Total, Address, Zip, CVV2Type, CVV2, HTML, RestrictKey

CVV2Type, related values and sample HTML are documented here.

This Perl source requires Perl modules/libraries that are widely available. It is assumed here that the programmer understands the importance of these modules/libraries, and knows how to install them.

Sample perl code:


#!/usr/bin/perl -w
use strict;


use LWP::UserAgent;
use Crypt::SSLeay;


my $ua         = new LWP::UserAgent;
my $remote_url = 'https://www.eprocessingnetwork.com/cgi-bin/tdbe/transact.pl';
my $request    = new HTTP::Request( 'POST', $remote_url );
$request->content_type('application/x-www-form-urlencoded/');

my $stg =
  "ePNAccount=080880&CardNo=4111111111111111&ExpMonth=10&ExpYear=19&Total=14.96&Address=123 Main St.
  &Zip=33543&CVV2Type=1&CVV2=123&HTML=No&RestrictKey=yFqqXJh9Pqnugfr";

my $response = "";
my $approval = "";

$request->content($stg);
$response = $ua->request($request);

my @response = split( /,/, $response->content ); # split into array

$approval = substr $response[0], 1, 1;

if ( $approval eq 'Y' ) {
print "Your transaction has been approved with the following response: \n\n\t"
. substr( $response[0], 1, 16 ) . "\n";
print "\tAVS Response: " . $response[1] . "\n";
print "\tCVV2 Response: " . $response[2] . "\n";
}
elsif ( $approval eq 'N' ) {
print "Your transaction has been declined with the following response: "
. substr( $response[0], 1 ) . "\n";
}
else {
print
"The processor was unable to handle your transaction, having returned the following response: "
. substr( $response[0], 1 ) . "\n";
}


By default, the eProcessing Network Transparent Database Engine Template outputs its' response in HTML format, i.e. wrapped in <html> and <body> tags, which can often aid in testing. Sending the additional variable HTML set to No causes the template to output the response without the HTML tags.

After the transaction has been processed, the banks' response to the transaction, as well as the Address Verification System and CVV2 responses, are output as follows:

With HTML parameter set to "No":

Your transaction has been approved with the following response:

YAPPROVED 416376
AVS Response: "AVS Match 9 Digit Zip and Address (X)"
CVV2 Response: "CVV2 Match (M)"

The response is essentially three quoted, comma-delimited strings. The first string always starts with a Y (Yes, approved), an N (No, declined) or a U (No, unable), and is followed by up to 16 characters describing the response. The second string is the Address Verification Systems' response to the street address and Zip code supplied. The third string is the processors response to the CVV2 information supplied.

 

For support, questions, suggestions or special requests, email us at devutils@eprocessingnetwork.com.

Facebook   LinkedIn   YouTube
Copyright 2014 eProcessing Network, LLC. All Rights Reserved.