NAME
Business::OnlinePayment::PayflowPro - Payflow Pro backend for Business::OnlinePayment
SYNOPSIS
use Business::OnlinePayment;
my $tx = new Business::OnlinePayment(
'PayflowPro',
'vendor' => 'your_vendor',
'partner' => 'your_partner',
'cert_path' => '/path/to/your/certificate/file/', # just the dir
);
# See the module documentation for details of content()
$tx->content(
type => 'VISA',
action => 'Normal Authorization',
description => 'Business::OnlinePayment::PayflowPro test',
amount => '49.95',
invoice_number => '100100',
customer_id => 'jsk',
name => 'Jason Kohles',
address => '123 Anystreet',
city => 'Anywhere',
state => 'GA',
zip => '30004',
email => 'ivan-payflowpro@420.am',
card_number => '4111111111111111',
expiration => '12/09',
cvv2 => '123',
order_number => 'string',
);
$tx->submit();
if ( $tx->is_success() ) {
print(
"Card processed successfully: ", $tx->authorization, "\n",
"order number: ", $tx->order_number, "\n",
"CVV2 code: ", $tx->cvv2_code, "\n",
"AVS code: ", $tx->avs_code, "\n",
);
}
else {
my $info = "";
$info = " (CVV2 mismatch)" if ( $tx->result_code == 114 );
print(
"Card was rejected: ", $tx->error_message, $info, "\n",
"order number: ", $tx->order_number, "\n",
);
}
DESCRIPTION
This module is a back end driver that implements the interface specified by Business::OnlinePayment to support payment handling via the PayPal's Payflow Pro Internet payment solution.
See Business::OnlinePayment for details on the interface this modules supports.
Module specific methods
This module provides the following methods which are not currently part of the standard Business::OnlinePayment interface:
- vendor()
- partner()
- cert_path()
- order_number()
- avs_code()
- cvv2_code()
Settings
The following default settings exist:
- server
-
payflow.verisign.com or test-payflow.verisign.com if test_transaction() is TRUE
- port
-
443
Handling of content(%content)
The following rules apply to content(%content) data:
action
If 'action' matches one of the following keys it is replaced by the right hand side value:
'normal authorization' => 'S', # Sale transaction
'credit' => 'C', # Credit (refund)
'authorization only' => 'A', # Authorization
'post authorization' => 'D', # Delayed Capture
'void' => 'V',
If 'action' is 'C', 'D' or 'V' and 'order_number' is not set then 'amount', 'card_number' and 'expiration' must be set.
type
If 'type' matches one of the following keys it is replaced by the right hand side value:
'visa' => 'C',
'mastercard' => 'C',
'american express' => 'C',
'discover' => 'C',
'cc' => 'C',
The value of 'type' is used to set transaction_type(). Currently this module only supports a transaction_type() of 'C' any other values will cause Carp::croak() to be called in submit().
Note: Payflow Pro supports multiple credit card types, including: American Express/Optima, Diners Club, Discover/Novus, Enroute, JCB, MasterCard and Visa.
Setting Payflow Pro parameters from content(%content)
The following rules are applied to map data to Payflow Pro parameters from content(%content):
# PFP param => $content{<key>}
VENDOR => $self->vendor ? \( $self->vendor ) : 'login',
PARTNER => \( $self->partner ),
USER => 'login',
PWD => 'password',
TRXTYPE => 'action',
TENDER => 'type',
ORIGID => 'order_number',
COMMENT1 => 'description',
COMMENT2 => 'invoice_number',
ACCT => 'card_number',
CVV2 => 'cvv2',
EXPDATE => \( $month.$year ), # MM/YY from 'expiration'
AMT => 'amount',
FIRSTNAME => 'first_name',
LASTNAME => 'last_name',
NAME => 'name',
EMAIL => 'email',
COMPANYNAME => 'company',
STREET => 'address',
CITY => 'city',
STATE => 'state',
ZIP => \$zip, # 'zip' with non-alphanumerics removed
COUNTRY => 'country',
The required Payflow Pro parameters for credit card transactions are:
TRXTYPE TENDER PARTNER VENDOR USER PWD ORIGID
Mapping Payflow Pro transaction responses to object methods
The following methods provides access to the transaction response data resulting from a Payflow Pro request (after submit()) is called:
order_number()
This order_number() method returns the PNREF field, also known as the PayPal Reference ID, which is a unique number that identifies the transaction.
result_code()
The result_code() method returns the RESULT field, which is the numeric return code indicating the outcome of the attempted transaction.
A RESULT of 0 (zero) indicates the transaction was approved and is_success() will return '1' (one/TRUE). Any other RESULT value indicates a decline or error and is_success() will return '0' (zero/FALSE).
error_message()
The error_message() method returns the RESPMSG field, which is a response message returned with the transaction result.
authorization()
The authorization() method returns the AUTHCODE field, which is the approval code obtained from the processing network.
avs_code()
The avs_code() method returns a combination of the AVSADDR and AVSZIP fields from the transaction result. The value in avs_code is as follows:
Y - Address and ZIP match
A - Address matches but not ZIP
Z - ZIP matches but not address
N - no match
undef - AVS values not available
cvv2_code()
The cvv2_code() method returns the CVV2MATCH field, which is a response message returned with the transaction result.
COMPATIBILITY
This module implements an interface to the Payflow Pro Perl API, which can be downloaded at https://manager.paypal.com/ with a valid login.
AUTHORS
Ivan Kohler <ivan-payflowpro@420.am>
Phil Lobbes <phil at perkpartners.com>
Based on Business::OnlinePayment::AuthorizeNet written by Jason Kohles.
SEE ALSO
perl(1), Business::OnlinePayment, Carp, and the PayPal Integration Center Payflow Pro resources at https://www.paypal.com/IntegrationCenter/ic_payflowpro.html