NAME
iTransact::Lite - A simple interface to the iTransact payment gateway.
SYNOPSIS
use iTransact::Lite;
my $itransact = iTransact::Lite->new(
gateway_id => 99999,
api_key => 'xxxxxxx',
api_username => 'mycoolsite',
);
my $response = $itransact->submit({
AuthTransaction => {
CustomerData => {
Email => 'user@example.com',
BillingAddress => {
Address1 => '123 Main St',
FirstName => 'John',
LastName => 'Doe',
City => 'Anytown',
State => 'WI',
Zip => '00000',
Country => 'US',
Phone => '608-555-1212',
},
CustId => $customer_id,
},
Total => sprintf('%.2f', $amount),
Description => 'Space Sneakers',
AccountInfo => {
CardAccount => {
AccountNumber => $credit_card_number,
ExpirationMonth => '07',
ExpirationYear => '2019',
CVVNumber => '999',
},
},
TransactionControl => {
SendCustomerEmail => 'FALSE',
SendMerchantEmail => 'FALSE',
TestMode => 'TRUE',
},
},
});
if ($response->{GatewayInterface}{TransactionResponse}{TransactionResult}{Status} eq 'ok') {
say "Success! Transaction ID: ". $response->{GatewayInterface}{TransactionResponse}{TransactionResult}{XID};
}
else {
die $response->{GatewayInterface}{TransactionResponse}{TransactionResult}{ErrorMessage};
}
DESCRIPTION
This module provides a simple wrapper around the iTransact XML Connection API (http://www.itransact.com/support/toolkit/xml-connection/api/). It does the hard work of signing, serializing, and submitting the request for you, but you still have to give it the data the web service API is expecting.
METHODS
new
Constructor.
- gateway_id
-
The gateway id number supplied by iTransact for your account.
- api_key
-
The API Key supplied by iTransact for your account after you enable web services.
- api_username
-
The API Username suppplied by iTransact for your account after you enable web services.
submit
Use this method to submit your requests. You may use this method multipled times on the same object with new payloads each time.
- payload
-
A hash reference of the data you wish to submit. This should not include the outer
GatewayInterface
wrapper or theAPICredentials
section as those will be auto generated.
EXCEPTIONS
If this module is unable to connect to iTransact for any reason it will throw an Ouch exception with the exception code of 504
.
PREREQS
The following modules are required:
Ouch LWP LWP::Protocol::https XML::Hash::LX Digest::HMAC_SHA1 Any::Moose
TODO
Someday I should probably make a full featured version of this module that hides all of the web service's data structures, and does some more advanced response handling.
SUPPORT
AUTHOR
JT Smith <rizen@cpan.org>
LEGAL
iTransact::Lite is Copyright 2012 Plain Black Corporation (http://www.plainblack.com) and is licensed under the same terms as Perl itself.