NAME
Business::OnlinePayment::CyberSource - CyberSource backend for Business::OnlinePayment
SYNOPSIS
use Business::OnlinePayment;
####
# One step transaction, the simple case.
####
my $tx = new Business::OnlinePayment("CyberSource",
conf_file => '/path/to/cybs.ini'");
$tx->content(
type => 'VISA',
action => 'Normal Authorization',
invoice_number => '00000001',
items => [{'number' => 0,
'name' => 'Test 1',
'quantity' => 1,
'unit_price' => '25.00'},
{'number' => 1,
'name' => 'Test 2',
'quantity' => 1,
'unit_price' => '50.00'},
],
first_name => 'Peter',
last_name => 'Bowen',
address => '123 Anystreet',
city => 'Orem',
state => 'UT',
zip => '84097',
country => 'US',
email => 'foo@bar.net',
card_number => '4111 1111 1111 1111',
expiration => '0906',
cvv2 => '1234', #optional
referer => 'http://valid.referer.url/',
user => 'cybesource_user',
fraud_check => 'true',
fraud_threshold => '90',
);
$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("CyberSource",
conf_file => '/path/to/cybs.ini'");
$tx->content(
type => 'VISA',
action => 'Authorization Only',
invoice_number => '00000001',
items => [{'number' => 0,
'name' => 'iPod Mini',
'quantity' => 1,
'unit_price' => '25.00'},
{'number' => 1,
'name' => 'Extended Warranty',
'quantity' => 1,
'unit_price' => '50.00'},
],
first_name => 'Peter',
last_name => 'Bowen',
address => '123 Anystreet',
city => 'Orem',
state => 'UT',
zip => '84097',
country => 'US',
email => 'foo@bar.net',
card_number => '4111 1111 1111 1111',
expiration => '0906',
cvv2 => '1234', #optional
referer => 'http://valid.referer.url/',
user => 'cybesource_user',
fraud_check => 'true',
fraud_threshold => '90',
);
$tx->submit();
if($tx->is_success()) {
# get information about authorization
$authorization = $tx->authorization
$order_number = $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("CyberSource");
$capture->content(
action => 'Post Authorization',
order_number => $order_number,
merchant_descriptor => 'IPOD MINI',
amount => '75.00',
);
$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
Visa, MasterCard, American Express, Discover
Content required: type, login, action, amount, first_name, last_name, card_number, expiration.
TODO - Checks
DESCRIPTION
For detailed information see Business::OnlinePayment.
NOTE
The cybs.ini default home is /etc/cybs.ini - if you would prefer it to live someplace else specify that in the new.
Unlike Business::OnlinePayment, Business::OnlinePayment::CyberSource requires separate first_name and last_name fields.
To settle an authorization-only transaction (where you set action to 'Authorization Only'), submit the request 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.
COMPATIBILITY
This module implements the Simple Order API 1.0 from Cybersource.
AUTHOR
Peter Bowen peter-cybersource@bowenfamily.org
Based on Business::OnlinePayment::AuthorizeNet
THANK YOU
Jason Kohles - For writing BOP - I didn't have to create my own framework.
Ivan Kohler - Tested the first pre-release version and fixed a number of bugs. He also encouraged me to add better error reporting for system errors.
SEE ALSO
perl(1). Business::OnlinePayment.
TODO
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 557:
=over without closing =back