NAME

Business::NETeller::Direct - Simple NEReller direct payment client

SYNOPSIS

use Business::NETeller::Direct;
my $netdirect = new Business::NETeller::Direct();
$netdirect->post(%vars) or die $netdirect->errstr;

my $response = $netdirect->response_vars()

DESCRIPTION

If you need to integrate your subscription/payment forms with NETeller's DIRECT payment system, Business::NETeller::Direct is for you. It's a simple Perl class to post payment details to NETeller gateway. It also gives you simple access to variables returned as XML.

Business::NETeller::Direct is based on "NETeller DIRECT v3.0" manual.

PROGRAMMING STYLE

This section shows a general programming style with Business::NETeller::Direct. We expect you to be somewhat familiar with NETeller DIRECT manual before proceeding any further.

CREATING NETDIRECT OBJECT

Before you do anything, you need to create a NetDirect object. You can do so by creating an object of either Business::NETeller::Direct class, or its alias NetDirect class:

$netdir = new Business::NETeller::Direct();
$netdir = new NetDirect();

Optionally you could pass key/value pair while creating the object:

$netdir = new NetDirect(merchant_id=>'1234', merchant_id=>'12345');

Note: for the list of all the request variables (variables to be POSTed to remote gateway) refer to your NETeller DIRECT manual.

Once you have $netdir object handy, you can post() now. If you specified all the request variables while creating the object, you can simply say:

$netdir->post();

Otherwise, you can also pass key/value pairs to post(). Variables passed to post() this way will override those set while creating the object:

$netdir->post(amount=>10, merchant_id=>10);

On success post() returns true, undef otherwise. Static class method errstr() returns the reason of the error. For a more verbose definition of the error message call errcode() instead, which returns numeric error code returned from the response. You can then lookup full description of the error code from your NETeller DIRECT manual.

$netdir->post() or die $netdir->errstr;

READING RESPONSE VARIABLES

Once transaction is successful (i.e. once post() returns true), NETeller server returns certain variables. The list of these variables are well documented in your NETellet DIRECT manual.

You can access these values by calling response_vars() method. response_vars() returns a hashref:

$vars = $netdir->response_vars();
$transaction_id = $vars->{trans_id};

TESTING

While testing, you can set the value of $Business::NETeller::Direct::GTW global variable to a URL of the test server.

AUTHOR

Sherzod Ruzmetov <sherzodr@cpan.org> http://author.handalak.com/

SEE ALSO

perl.