Accounts Online



Accounts Online
User Management
Invoices & receipts
Custom Order Forms
Custom Fields
Protected Directories
Auto Accounts
API Functions
Handling Taxes
Shipping&Handling

We accept VISA and MasterCard



Accounts Online API (rel.2.72)


The API implemented as a Perl module (file aolapi.pm).

init($configfile)
init()

Initializes API. Returns false (0) on failure, true (non 0) upon success. $configfile must be set to full pathname to Accounts Online config file (in most cases config.cgi residing in Accounts Online executable files directory). If omitted (or set to undef), init() will try to locate config.cgi file in current directory.

error()
Returns plain ASCII text description of last error.

getvars()
Returns configuration variables as a hash array.

Example:

%varz = aolapi::getvars();

getaccnt($accid)
Returns account record with account id matching $accid. Always returns hash array, which is empty on failure.

Hash array fields
idaccount id
passwdaccount password
opendatedate, the account opened (in seconds since beginning of the epoch, as per Perl time() function)
openbalanceopening balance
namefirst name
lnamelast name
streetstreet address
citycity
statestate
zipzip, postal code
countrycountry
phonephone number
faxfax number
emailemail address
bizphonebusiness phone number
notesaccount notes
customNcustom field N (N is in the range 0-9)
vatVAT mode
gstSales tax mode
cctypecredit card type
ccnumbercredit card number
ccvalidcredit card expiry date
ccnamename on card
cczipzip or postal code as per bank statement
ccissueissue number (switch/solo cards)


Example:

$accid = $INPUT{'accid'};
$passwd = $INPUT{'passwd'};
%accnt = aolapi::getaccnt($accid);
if (!%accnt) {
  print "Error: " . aolapi::error();
} elsif ($passwd ne $accnt{'passwd'}) {
  print "Authentication failure";
} else {
  print "Hello, $accnt{'name'} $accnt{'lname'}";
}

addaccnt(%accnt)
Creates new account using account definition passed as hash array. Returns new account id on success, undef otherwise. See getaccnt() function for hash fields definition.

autoaccnt()
Creates new account using randomly generated account id and password. Returns new account id on success, undef otherwise.

updaccnt(%accnt)
Updates existing account using account definition passed as hash array. Returns the account id on success, undef otherwise. See getaccnt() function for hash fields definition.

balance($id)
Returns current balance as per Account Manager view for account, specified by $id. Returns undef on errors.

balancedue($id)
Returns current balance due as per Account Manager view for account, specified by $id. Returns undef on errors.

listproducts()
Returns array of product IDs available.

getproduct($prodid)
Returns product record with product id matching $prodid. Always returns hash array, which is empty on failure.

Hash array fields
idproduct id
descriptionproduct description
categoryproduct category
setupsetup (one time) price
maintenancerecurring (rebill) price
billcyclebilling cycle (values: WK - weekly, BW - biweekly, MM - monthly, QQ - quarterly, SA - semiannual, AA - annual)
billtypeproduct type (values: DB - receipt, N - invoice normal, P - invoice prorated)
dueindays setup invoice is due in
duein1days recurring invoice is due in
billdayday to issue recurring invoice (as offset from beginning of billing cycle)
notesproduct notes
dirpath to product directory
dirurlurl of product directory
ordurlurl of product order page
ibillaccntibill account number
rcptrelaypath to on receipt script
vatVAT mode
gstSales tax mode
infourlURL of product info page
custom0Custom field #0
custom1Custom field #1


Example:

@prodlist = aolapi::listproducts();

if (!@prodlist) {
  print "Error: " . aolapi::error();
} else {
  print "<form method=\"POST\" action=\"cart.pl\">\n" .
    "<input type=\"hidden\" name=\"cmd\" value=\"add\">\n" .
    "<select name=\"prodid\">\n";
  foreach $prodid (@prodlist) {
    %pr = aolapi::getproduct($prodid);
    if ($pr{'setup'} ne '*' && $pr{'setup'} ne undef) {
      print "<option value=\"$prodid\">$pr{'description'}\n";
    }
  }
  print "</select>\n" .
    "<input type=\"submit\" value=\"Add to cart\">\n" .
    "</form>\n";
}

vat($netprice, $accid, $prodid)
Calculates value added tax to be added to netprice for customer accid and product prodid.

gst($netprice, $accid, $prodid)
Calculates sales tax to be added to netprice for customer accid and product prodid.

listcats()
Returns array of category IDs available.

getcat($catid)
Returns category record with category id matching $catidid. Always returns hash array, which is empty on failure.

Hash array fields
idcategory id
descriptioncategory description

addtxn($accid, $prodid, $amount, $notes, $mmddyyyy, $duein_ref, $user, $addtax)
Posts a transaction to account $accid using product definition as per $prodid. Only $accid and $prodid are required fields.
$amount used to set transaction amount for variable price products, ignored otherwise. Please note, that $amount is always non negative number.
$duein_ref used to set transaction days due terms for variable due products of invoice type, ignored otherwise. For products of receipt type this optional parameter conveys reference number/id.
$mmddyyy optional transaction date in mm/dd/yyyy format. If undefined current date will be used
$notes optional transaction notes
$user optional id of the user, which posted the transaction
$addtax if defined and non zero, applicable taxes will be added to total amount
The function returns amount posted, undef on failure.

payform($prodid, $amount, $accid)
Returns html code for payment form for account $accid using product definition as per $prodid. Transaction amount $amount must be defined if product referenced by $prodid has variable (*) setup price.



Copyright © 1999-2010 Rush Project Inc. All rights reserved.

Offshore software development by CGI Research.
jonhdoe@eastwright.com