Jason Kohles > Business-OnlinePayment-2.01 > Business::OnlinePayment

Download:
Business-OnlinePayment-2.01.tar.gz

Dependencies

Annotate this POD

Related Modules

Net::SSLeay
Data::Dumper
LWP::UserAgent
Catalyst::Base
Text::CSV
SQL::Abstract
HTML::Template
CGI::Application
Crypt::SSLeay
Text::CSV_XS
more...
By perlmonks.org

CPAN RT

Open  1
View/Report Bugs
Module Version: 2.01   Source   Latest Release: Business-OnlinePayment-3.03_02

NAME ^

Business::OnlinePayment - Perl extension for online payment processing

SYNOPSIS ^

  use Business::OnlinePayment;

  my $transaction = new Business::OnlinePayment($processor, %processor_info);
  $transaction->content(
                        type       => 'Visa',
                        amount     => '49.95',
                        cardnumber => '1234123412341238',
                        expiration => '0100',
                        name       => 'John Q Doe',
                       );
  $transaction->submit();

  if($transaction->is_success()) {
    print "Card processed successfully: ".$transaction->authorization()."\n";
  } else {
    print "Card was rejected: ".$transaction->error_message()."\n";
  }

DESCRIPTION ^

Business::OnlinePayment is a generic module for processing payments through online credit card processors, electronic cash systems, etc.

METHODS AND FUNCTIONS ^

new($processor, %processor_options);

Create a new Business::OnlinePayment object, $processor is required, and defines the online processor to use. If necessary, processor options can be specified, currently supported options are 'Server', 'Port', and 'Path', which specify how to find the online processor (https://server:port/path), but individual processor modules should supply reasonable defaults for this information, override the defaults only if absolutely necessary (especially path), as the processor module was probably written with a specific target script in mind.

content(%content);

The information necessary for the transaction, this tends to vary a little depending on the processor, so we have chosen to use a system which defines specific fields in the frontend which get mapped to the correct fields in the backend. The currently defined fields are:

submit();

Submit the transaction to the processor for completion

is_success();

Returns true if the transaction was submitted successfully, false if it failed (or undef if it has not been submitted yet).

result_code();

Returns the precise result code that the processor returned, these are normally one letter codes that don't mean much unless you understand the protocol they speak, you probably don't need this, but it's there just in case.

test_transaction();

Most processors provide a test mode, where submitted transactions will not actually be charged or added to your batch, calling this function with a true argument will turn that mode on if the processor supports it, or generate a fatal error if the processor does not support a test mode (which is probably better than accidentally making real charges).

require_avs();

Providing a true argument to this module will turn on address verification (if the processor supports it).

transaction_type();

Retrieve the transaction type (the 'type' argument to contents();). Generally only used internally, but provided in case it is useful.

error_message();

If the transaction has been submitted but was not accepted, this function will return the provided error message (if any) that the processor returned.

authorization();

If the transaction has been submitted and accepted, this function will provide you with the authorization code that the processor returned.

server();

Retrieve or change the processor submission server address (CHANGE AT YOUR OWN RISK).

port();

Retrieve or change the processor submission port (CHANGE AT YOUR OWN RISK).

path();

Retrieve or change the processor submission path (CHANGE AT YOUR OWN RISK).

AUTHOR ^

Jason Kohles, email@jasonkohles.com

DISCLAIMER ^

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO ^

For verification of credit card checksums, see Business::CreditCard.

syntax highlighting: