man Business::OnlinePayment::AuthorizeNet () - AuthorizeNet backend for Business::OnlinePayment

NAME

Business::OnlinePayment::AuthorizeNet - AuthorizeNet backend for Business::OnlinePayment

SYNOPSIS

  use Business::OnlinePayment;

  ####
  # One step transaction, the simple case.
  ####

  my $tx = new Business::OnlinePayment("AuthorizeNet");
  $tx->content(
      type           => 'VISA',
      login          => 'testdrive',
      password       => '',
      action         => 'Normal Authorization',
      description    => 'Business::OnlinePayment test',
      amount         => '49.95',
      invoice_number => '100100',
      customer_id    => 'jsk',
      first_name     => 'Jason',
      last_name      => 'Kohles',
      address        => '123 Anystreet',
      city           => 'Anywhere',
      state          => 'UT',
      zip            => '84058',
      card_number    => '4007000000027',
      expiration     => '09/02',
      cvv2           => '1234', #optional
      referer        => 'http://valid.referer.url/',
  );
  $tx->submit();

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

  ####
  # Two step transaction, authorization and capture.
  # If you don't need to review order before capture, you can
  # process in one step as above.
  ####

  my $tx = new Business::OnlinePayment("AuthorizeNet");
  $tx->content(
      type           => 'VISA',
      login          => 'testdrive',
      password       => '',
      action         => 'Authorization Only',
      description    => 'Business::OnlinePayment test',
      amount         => '49.95',
      invoice_number => '100100',
      customer_id    => 'jsk',
      first_name     => 'Jason',
      last_name      => 'Kohles',
      address        => '123 Anystreet',
      city           => 'Anywhere',
      state          => 'UT',
      zip            => '84058',
      card_number    => '4007000000027',
      expiration     => '09/02',
      cvv2           => '1234', #optional
      referer        => 'http://valid.referer.url/',
  );
  $tx->submit();

  if($tx->is_success()) {
      # get information about authorization
      $authorization = $tx->authorization
      $ordernum = $tx->order_number;
      $avs_code = $tx->avs_code; # AVS Response Code
      $cvv2_response = $tx->cvv2_response; # CVV2/CVC2/CID Response Code
      $cavv_response = $tx->cavv_response; # Cardholder Authentication
                                           # Verification Value (CAVV) Response
                                           # Code

      # now capture transaction
      my $capture = new Business::OnlinePayment("AuthorizeNet");

      $capture->content(
          type           => 'CC',
          action         => 'Post Authorization',
          login          => 'YOURLOGIN
          password       => 'YOURPASSWORD',
          order_number   => $ordernum,
          amount         => '49.95',
      );

      $capture->submit();

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

  } else {
      print "Card was rejected: ".$tx->error_message."\n";
  }

SUPPORTED TRANSACTION TYPES

CC, Visa, MasterCard, American Express, Discover

Content required: type, login, password|transaction_key, action, amount, first_name, last_name, card_number, expiration.

Check

Content required: type, login, password|transaction_key, action, amount, first_name, last_name, account_number, routing_code, bank_name.

DESCRIPTION

For detailed information see Business::OnlinePayment.

NOTE

Unlike Business::OnlinePayment or pre-3.0 verisons of Business::OnlinePayment::AuthorizeNet, 3.1 requires separate first_name and last_name fields.

Business::OnlinePayment::AuthorizeNet uses Authorize.Net's Advanced Integration Method (AIM) (formerly known as ADC direct response), sending a username and transaction_key or password with every transaction. Therefore, Authorize.Net's referrer security is not necessary. In your Authorize.Net interface at https://secure.authorize.net/ make sure the list of allowable referers is blank. Alternatively, set the referer field in the transaction content.

To settle an authorization-only transaction (where you set action to 'Authorization Only'), submit the nine-digit transaction id code in the field order_number with the action set to Post Authorization. You can get the transaction id from the authorization by calling the order_number method on the object returned from the authorization. You must also submit the amount field with a value less than or equal to the amount specified in the original authorization.

Recently (February 2002), Authorize.Net has turned address verification on by default for all merchants. If you do not have valid address information for your customer (such as in an IVR application), you must disable address verification in the Merchant Menu page at https://secure.authorize.net/ so that the transactions aren't denied due to a lack of address information.

COMPATIBILITY

This module implements Authorize.Net's API verison 3.1 using the ADC Direct Response method. See https://secure.authorize.net/docs/developersguide.pml for details.

AUTHOR

Jason Kohles, jason@mediabang.com

Ivan Kohler <ivan-authorizenet@420.am> updated it for Authorize.Net protocol 3.0/3.1 and is the current maintainer. Please send patches as unified diffs (diff -u).

Jason Spence <jspence@lightconsulting.com> contributed support for separate Authorization Only and Post Authorization steps and wrote some docs. OST <services@ostel.com> paid for it.

T.J. Mather <tjmather@maxmind.com> sent a number of CVV2 patches.

Mike Barry <mbarry@cos.com> sent in a patch for the referer field.

Yuri V. Mkrtumyan <yuramk@novosoft.ru> sent in a patch to add the void action.

Paul Zimmer <AuthorizeNetpm@pzimmer.box.bepress.com> sent in a patch for card-less post authorizations.

Daemmon Hughes <daemmon@daemmonhughes.com> sent in a patch for transaction key authentication as well support for the recurring_billing flag and the md5' method that returns the MD5 hash which is returned by the gateway.

SEE ALSO

perl(1). Business::OnlinePayment.