perldoc > Business::OnlinePayment

๐Ÿ“› NAME

Business::OnlinePayment - Perl extension for online payment processing ๐Ÿ’ณ

๐Ÿš€ Quick Reference

Use CaseCommandDescription
Create processor objectmy $tx = new Business::OnlinePayment($processor, %options);Instantiate gateway
Set transaction details$tx->content(type => 'CC', amount => '49.95', โ€ฆ);Define payment info
Enable test mode$tx->test_transaction(1);No real charges
Require AVS$tx->require_avs(1);Address verification
Submit payment$tx->submit();Process transaction
Check success$tx->is_success();True if approved
Get error$tx->error_message();Human-friendly decline reason
Authorization code$tx->authorization();Gateway approval code
Order number$tx->order_number();Gateway-generated order ID
Partial auth amount$tx->partial_auth_amount();Amount if less than requested
Fraud score$tx->fraud_score();From fraud detection plugin

๐Ÿ“‹ SYNOPSIS

use Business::OnlinePayment;

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

eval { $transaction->submit(); };

if ( $@ ) {
  print "$processor error: $@\n";
} else {
  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.

๐Ÿ—๏ธ CONSTRUCTOR

๐Ÿญ new($processor, %processor_options)

Create a new Business::OnlinePayment object. $processor is required and defines the online processor to use. Optional processor options are Server, Port, and Path, which specify how to reach the processor (https://server:port/path). Individual processor modules supply reasonable defaults; override only if absolutely necessary (especially path), as the processor module was written with a specific target script in mind.

โš™๏ธ TRANSACTION SETUP METHODS

๐Ÿ“ฆ content(%content)

The information necessary for the transaction. This varies by processor; a system of defined frontend fields maps to the correct backend fields.

๐Ÿ”‘ PROCESSOR FIELDS

โœ… REQUIRED TRANSACTION FIELDS

๐Ÿ“‹ OPTIONAL TRANSACTION FIELDS

๐Ÿ‘ค CUSTOMER INFO FIELDS

๐Ÿ’ณ CREDIT CARD FIELDS

๐Ÿฆ ELECTRONIC CHECK FIELDS

๐Ÿ” FOLLOWโ€‘UP TRANSACTION FIELDS

Used in Post Authorization, Reverse Authorization, Void, Credit transactions:

๐Ÿ”‚ RECURRING BILLING FIELDS

๐Ÿงช test_transaction()

Most processors provide a test mode where submitted transactions are not actually charged. Call with a true argument to enable (if supported); otherwise a fatal error is thrown to prevent accidental real charges.

๐Ÿ“ require_avs()

Provide a true argument to turn on Address Verification (if the processor supports it).

๐Ÿ“ค TRANSACTION SUBMISSION METHOD

๐Ÿ“จ submit()

Submit the transaction to the processor for completion. If a gateway communication error or other "meta" issue occurs, submit throws a fatal exception (catch with eval {}).

๐Ÿ“Š TRANSACTION RESULT METHODS

โœ… is_success()

Returns true if the transaction was approved by the gateway, false if submitted but not approved, or undef if not yet submitted.

๐Ÿช™ partial_auth_amount()

If the transaction was a partial authorization (successful but less than the requested amount), returns the actual amount processed. Empty or 0 when is_success is true indicates a normal full authorization.

โŒ error_message()

If the transaction was submitted but not accepted, returns the processorโ€‘provided error message (if any).

๐Ÿšซ failure_status()

If the transaction failed, may return a normalized failure status (not gatewayโ€‘specific). Currently defined: "expired", "nsf" (nonโ€‘sufficient funds), "stolen", "pickup", "blacklisted", "declined" (card/transaction declines only). Not all processors support this, and it may not be set for all declines.

๐Ÿ†” authorization()

If submitted and accepted, returns the authorization code from the processor. Store this for later inquiries or refunds.

๐Ÿ“‹ order_number()

The unique order number for the transaction generated by the gateway. Store for later inquiries or refunds.

๐ŸŽซ card_token()

If supported by your gateway, a card_token that can be used in a subsequent transaction in place of a full card number.

๐Ÿ“… txn_date()

Transaction date as returned by the gateway. Required by some gateways for followโ€‘up transactions.

๐Ÿ•ต๏ธ fraud_score()

Retrieve or change the fraud score from any Business::FraudDetect plugin.

๐Ÿ†” fraud_transaction_id()

Retrieve or change the transaction id from any Business::FraudDetect plugin.

๐Ÿ“ก response_code() / response_headers() / response_page()

Set by some processors (especially HTTPS) when a transaction fails at the communication level. response_code is the HTTP response code and message (e.g. "500 Internal Server Error"), response_headers is a hash reference of response headers, response_page is the raw content.

๐Ÿ”ข result_code()

Returns the precise result code from the processor (often oneโ€‘letter codes). Use only if you understand the protocol.

๐Ÿ” avs_code() / cvv2_response()

Address verification and CVV2 response values, as returned by the gateway.

๐Ÿ”ง MISCELLANEOUS INTERNAL METHODS

๐Ÿท๏ธ transaction_type()

Retrieve the transaction type (the type argument to contents()). Generally used internally.

๐ŸŒ server() / port() / path()

Retrieve or change the processor submission server address, port, or path. CHANGE AT YOUR OWN RISK.

๐Ÿ› ๏ธ HELPER METHODS FOR GATEWAY MODULE AUTHORS

๐Ÿ”จ build_subs(@sub_names)

Build setter/getter subroutines for new return values.

๐Ÿ“ฅ get_fields(@fields)

Get the named fields if they are defined.

๐Ÿ—บ๏ธ remap_fields(%map)

Remap field content (and stuff it back into content).

โš ๏ธ required_fields(@fields)

Croaks if any of the required fields are not present.

๐Ÿ“„ dump_contents

Dump the current contents (debugging aid).

๐Ÿ”˜ silly_bool($value)

Returns 1 if the value starts with y, Y, t, or T; 0 if it starts with n, N, f, or F; otherwise the value itself. Use for handling boolean content like tax_exempt.

๐Ÿง‘โ€๐Ÿ’ป AUTHORS

(v2 series) Jason Kohles, email AT jasonkohles.com
(v3 rewrite) Ivan Kohler <ivan-business-onlinepayment AT 420.am>
Phil Lobbes <phil at perkpartners dot com>

ยฉ๏ธ COPYRIGHT

Copyright (c) 1999-2004 Jason Kohles
Copyright (c) 2004 Ivan Kohler
Copyright (c) 2007-2018 Freeside Internet Services, Inc.
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

๐ŸŒ HOMEPAGE

Homepage: http://perl.business/onlinepayment
Development: http://perl.business/onlinepayment/ng.html

๐Ÿ“ง MAILING LIST

Direct development questions, patches, etc. to: http://mail.freeside.biz/cgi-bin/mailman/listinfo/bop-devel/

๐Ÿ“ฆ REPOSITORY

Code available from public git:

git clone git://git.freeside.biz/Business-OnlinePayment.git

Or on the web:

Many processor plugins are also available in the same repository:

โš ๏ธ 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

http://perl.business/onlinepayment

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

Business::OnlinePayment
๐Ÿ“› NAME ๐Ÿš€ Quick Reference ๐Ÿ“‹ SYNOPSIS ๐Ÿ“– DESCRIPTION ๐Ÿ—๏ธ CONSTRUCTOR
๐Ÿญ new($processor, %processor_options)
โš™๏ธ TRANSACTION SETUP METHODS
๐Ÿ“ฆ content(%content) ๐Ÿงช test_transaction() ๐Ÿ“ require_avs()
๐Ÿ“ค TRANSACTION SUBMISSION METHOD
๐Ÿ“จ submit()
๐Ÿ“Š TRANSACTION RESULT METHODS
โœ… is_success() ๐Ÿช™ partial_auth_amount() โŒ error_message() ๐Ÿšซ failure_status() ๐Ÿ†” authorization() ๐Ÿ“‹ order_number() ๐ŸŽซ card_token() ๐Ÿ“… txn_date() ๐Ÿ•ต๏ธ fraud_score() ๐Ÿ†” fraud_transaction_id() ๐Ÿ“ก response_code() / response_headers() / response_page() ๐Ÿ”ข result_code() ๐Ÿ” avs_code() / cvv2_response()
๐Ÿ”ง MISCELLANEOUS INTERNAL METHODS
๐Ÿท๏ธ transaction_type() ๐ŸŒ server() / port() / path()
๐Ÿ› ๏ธ HELPER METHODS FOR GATEWAY MODULE AUTHORS
๐Ÿ”จ build_subs(@sub_names) ๐Ÿ“ฅ get_fields(@fields) ๐Ÿ—บ๏ธ remap_fields(%map) โš ๏ธ required_fields(@fields) ๐Ÿ“„ dump_contents ๐Ÿ”˜ silly_bool($value)
๐Ÿง‘โ€๐Ÿ’ป AUTHORS ยฉ๏ธ COPYRIGHT ๐ŸŒ HOMEPAGE ๐Ÿ“ง MAILING LIST ๐Ÿ“ฆ REPOSITORY โš ๏ธ DISCLAIMER ๐Ÿ‘€ SEE ALSO

Generated by phpman v4.9.22-1-g1b0fcb4 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-05 16:29 @216.73.216.52
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-pro / taotoken.net / www.chedong.com - original format

^_top_^