Você está na página 1de 2

Processor Integration

The AEC payment processor API is a flexible environment to install html-POST-based (for now) processors into
the subscription workflow.
A payment processor file always consists of the following parts:
class processor_namehere {
function processor_namehere () {

This is the constructor - if you need to load additional files, you should put this in here as the class will be called
whenever the processor is accessed. Note that the class needs to be called “processor_” plus the filename
of the processor integration file. So for paypal.php, you need to call the class “processor_paypal”!
function info () {
$info = array();
$info['longname'] = "PayPal";
$info['statement'] = "Make payments with PayPal - it's fast, free and
secure!";
$info['description'] = "description";
$info['currencies'] =
"USD,AUD,CAD,EUR,GBP,JPY,NZD,CHF,HKD,SGD,SEK,DKK,PLN,NOK,HUF,CZK";
$info['languages'] = "AU,DE,FR,IT,GB,ES,US";
$info['cc_list'] =
"visa,mastercard,discover,americanexpress,echeck,giropay";
$info['recurring'] = 0;

return $info;
}

Every processor needs to have a set of infos that will help the AEC understand the processor. The longname
and statement are for display to the user. The description is the text that will appear on the NotAllowed page.
The currency list is for use in the settings. Here, you can put in the ISO codes of the supported currencies. The
same for the languages.
The CC list is for display on the NotAllowed page as well, it will determine which of the small CC icons are
shown. The recurring setting will determine whether the processor is capable of handling recurring payments.
function settings () {
$settings = array();
$settings['variable'] = "content";

return $settings;
}

In the settings function, you can tell the AEC which variables it should store for this gateway. All these will be
stored in a parameter (text based) db field, so no linebreaks are allowed. Enter the default value as content.
function backend_settings () {
$settings = array();
$settings['variable'] = array("type", "name", "description");

return $settings;
}

The settings from above are filled into the backend settings, which is what you will see on the AEC settings

This documentation is licensed under the GNU Free Documentation License


in 2007 by David Deutsch (skore@skore.de, globalnerd.org)
get a copy of it right here: http://www.gnu.org/licenses/fdl.txt
page. The variable name of this and the settings variable names have to match of course. As for the types of
field, you can use “InputA”, “InputB” or “InputC” for a standard field of increasing size.
You can also use a select list. Either call it “list_yesno” for a standard yes/no selection, “list_language” for a
language list or “list_currency” for a currency selection list. You may also just call it “list” and create your own list
field that has to be specified in a field in your array, but that feature is not supported yet.
function createGatewayLink ( $int_var, $metaUser, $cfg ) {
global $mosConfig_live_site;

$var['post_url'] = "https://www.sandbox.paypal.com/cgi-
bin/webscr";

return $var;
}

This is the function that receives the invoice values and turns them into html POST fields. For $int_var, you
typically receive $int_var[’amount’] which is the amount value or the amount array if you support recurring
payments. $int_var[’invoice’] forwards the invoice number, $int_var[’params’] forward the parameters that a user
can append to his or her invoice and $metaUser is the metaUser object for this user.
function parseNotification ( $post, $cfg ) {

$response = array();
$response['invoice'] = "";
$response['valid'] = 0;

return $response;
}

When a payment arrives, the notification will be forwarded to this function so that it is parsed to be understood by
the AEC. Put the invoice number in the ‘invoice’ field of the response and if you verified the payment, set the
‘valid’ field to 1, or 0 if something went wrong.
You may also set a ‘pending’ field if you set valid to 0. If you also add a ‘pending_reason’ field, the AEC will add
these to the invoice for further reference and put this data into the log entry.
You can also set a ‘cancel’ field that will tell the AEC to flag the user as status=Cancelled which can be handy
with recurring subscriptions.

This documentation is licensed under the GNU Free Documentation License


in 2007 by David Deutsch (skore@skore.de, globalnerd.org)
get a copy of it right here: http://www.gnu.org/licenses/fdl.txt

Você também pode gostar