SYNOPSIS

  use Business::OnlinePayment;

  my $tx = new Business::OnlinePayment(
      'PayflowPro',
      'vendor'  => 'your_vendor',
      'partner' => 'your_partner',
      'client_certification_id' => 'GuidUpTo32Chars',
  );

  # 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          => '[email protected]',
      card_number    => '4111111111111111',
      expiration     => '12/09',
      cvv2           => '123',
      order_number   => 'string',
      request_id     => 'unique_identifier_for_transaction',
  );

  $tx->submit();

  if ( $tx->is_success() ) {
      print(
          "Card processed successfully: ", $tx->authorization, "\n",
          "order number: ",                $tx->order_number,  "\n",
          "CVV2 response: ",               $tx->cvv2_response, "\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.

Standard methods

set_defaults()

This method sets the 'server' attribute to 'payflowpro.paypal.com' and the port attribute to '443'. This method also sets up the \*(L"Module specific methods\*(R" described below.

submit()

Unofficial methods

This module provides the following methods which are not officially part of the standard Business::OnlinePayment interface (as of 3.00_06) but are nevertheless supported by multiple gateways modules and expected to be standardized soon:

order_number()
avs_code()
cvv2_response()

Module specific methods

This module provides the following methods which are not currently part of the standard Business::OnlinePayment interface:

\fIclient_certification_id()\fP

This gets/sets the X-VPS-VITCLIENTCERTIFICATION-ID which is \s-1REQUIRED\s0 and defaults to \*(L"ClientCertificationIdNotSet\*(R". This is described in Website Payments Pro \s-1HTTPS\s0 Interface Developer's Guide as follows:

"A random globally unique identifier (\s-1GUID\s0) that is currently required. This requirement will be removed in the future. At this time, you can send any alpha-numeric \s-1ID\s0 up to 32 characters in length.

\s-1NOTE:\s0 Once you have created this \s-1ID\s0, do not change it. Use the same \s-1ID\s0 for every transaction."

\fIclient_timeout()\fP

Timeout value, in seconds, after which this transaction should be aborted. Defaults to 45, the value recommended by the Website Payments Pro \s-1HTTPS\s0 Interface Developer's Guide.

\fIdebug()\fP

Enable or disble debugging. The value specified here will also set $Business::OnlinePayment::HTTPS::DEBUG in submit() to aid in troubleshooting problems.

\fIexpdate_mmyy()\fP

The expdate_mmyy() method takes a single scalar argument (typically the value in $content{expiration}) and attempts to parse and format and put the date in \s-1MMYY\s0 format as required by PayflowPro specification. If unable to parse the expiration date simply leave it as is and let the PayflowPro system attempt to handle it as-is.

\fIrequest_id()\fP

It is recommended that you specify your own unique request_id for each transaction in %content. A request_id is \s-1REQUIRED\s0 by the PayflowPro processor. If a request_id is not set, then Digest::MD5 is used to attempt to generate a request_id for a transaction.

Deprecated methods

The following methods are deprecated and may be removed in a future release. Values for vendor and partner should now be set as arguments to Business::OnlinePayment->new(). The value for cert_path was used to support passing a path to PFProAPI.pm (a Perl module/SDK from Verisign/Paypal) which is no longer used.

vendor()
partner()
cert_path()
cvv2_code()

Settings

The following default settings exist:

server

payflowpro.paypal.com or pilot-payflowpro.paypal.com if test_transaction() is \s-1TRUE\s0

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, \s-1JCB\s0, 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',

# As of 8/18/2009: CUSTCODE appears to be cut off at 18 # characters and isn't currently reportable. Consider storing # local customer ids in the COMMENT1/2 fields as a workaround. CUSTCODE => 'customer_id',

SHIPTOFIRSTNAME => 'ship_first_name', SHIPTOLASTNAME => 'ship_last_name', SHIPTOSTREET => 'ship_address', SHIPTOCITY => 'ship_city', SHIPTOSTATE => 'ship_state', SHIPTOZIP => 'ship_zip', SHIPTOCOUNTRY => 'ship_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:

\fIorder_number()\fP

This order_number() method returns the \s-1PNREF\s0 field, also known as the PayPal Reference \s-1ID\s0, which is a unique number that identifies the transaction.

\fIresult_code()\fP

The result_code() method returns the \s-1RESULT\s0 field, which is the numeric return code indicating the outcome of the attempted transaction.

A \s-1RESULT\s0 of 0 (zero) indicates the transaction was approved and is_success() will return '1' (one/TRUE). Any other \s-1RESULT\s0 value indicates a decline or error and is_success() will return '0' (zero/FALSE).

\fIerror_message()\fP

The error_message() method returns the \s-1RESPMSG\s0 field, which is a response message returned with the transaction result.

\fIauthorization()\fP

The authorization() method returns the \s-1AUTHCODE\s0 field, which is the approval code obtained from the processing network.

\fIavs_code()\fP

The avs_code() method returns a combination of the \s-1AVSADDR\s0 and \s-1AVSZIP\s0 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

\fIcvv2_response()\fP

The cvv2_response() method returns the \s-1CVV2MATCH\s0 field, which is a response message returned with the transaction result.

COMPATIBILITY

As of 0.07, this module communicates with the Payflow gateway directly and no longer requires the Payflow Pro \s-1SDK\s0 or other download. Thanks to Phil Lobbes for this great work and Josh Rosenbaum for additional enhancements and bug fixes.

AUTHORS

Ivan Kohler <[email protected]>

Phil Lobbes <phil at perkpartners.com>

Based on Business::OnlinePayment::AuthorizeNet written by Jason Kohles.

RELATED TO Business::OnlinePayment::PayflowPro…

perl\|(1), Business::OnlinePayment, Carp, and the PayPal Integration Center Payflow Pro resources at <https://www.paypal.com/IntegrationCenter/ic_payflowpro.html>