Logo

theFactory auction API for 3rd party Payment Gateways integration.


Implementing a Payment Gateway requires PHP knowledge and is not part of support, this documentation is written for programmers. Already available Gateways can be seen here.


For your basic Payment Gateway you will need to create at least the following files:


  • manifest.xml - an installation manifest for the Gateway
  • form.xml - the administration settings for the Gateway in Joomla XML JForm format
  • controller.php - a PHP File containing the controller that extends TheFactoryPaymentGateway
  • logo.png - a logo for the payment gateway


You can download a sample Gateway here (a mockup)


The Manifest File


<extension folder="pay_example" type="gateway" method="upgrade"> 
<name>Example Payment Gateway</name> 
</extension>


The Folder value should match the name you plan to use for your extension. Do not use space or punctuation.


The Admin Settings Form


Use the Joomla Form XML Standards to set up witch fields you need the user to setup in order to post payments to the gateway. For instance you might need the Seller email:


<?xml version="1.0" encoding="UTF-8"?>
<form> 
  <fieldset> 
    <field default="change@me.com" required="true" size="30" class="inputbox" description="" label="Paypal Email" type="text" name="selleremail"/> 
  </fieldset> 
</form>


The Controller


defined('_JEXEC') or die('Restricted access');
 
require_once(realpath(dirname(__FILE__).DS.'..'.DS.'..'.DS.'..'.DS.'classes'.DS.'gateways.php'));
 
class Pay_Example extends TheFactoryPaymentGateway
{
    var $name='pay_paypal';
    var $fullname='Paypal Payment Gateway';
    function getPaymentForm($order,$items,$urls,$shipping=null,$tax=null)
    {
        $model=&JModel::getInstance('Gateways','JTheFactoryModel');
        $params=$model->loadGatewayParams($this->name);
 
        $result = 'your html for the form payment here';
 
        return $result;
    }
    function processIPN()
    {
        $model=&JModel::getInstance('Gateways','JTheFactoryModel');
        $params=$model->loadGatewayParams($this->name);
 
        $paylog=&JTable::getInstance('PaymentLogTable','JTheFactory');
        //paylog data here
 
        //validate IPN
 
        $paylog->store();
        return $paylog;
    }
}

Your Controller Class must be named exactly as the folder value in the Manifest File. This is why it is important to use only acceptable characters for a class name.


There are several functions you should/could implement:

function getPaymentForm - should return the HTML code for the payment gateway. This will be displayed when an user checks out an order using this particular gateway.


Parameters are:


  • $order → the Order Object
  • $items → an array of Items from this particular Order
  • $urls → an array of URLS specific to gateways -
    • $urls['return_url'] - the return url for a successful payment
    • $urls['cancel_url'] - the return url for a canceled or failed payment
    • $urls['notify_url'] - the instant notification url (is used by gateways similar to paypal)


function processIPN - is called when the Payment gateway has processed the payment (instant payment notification)


function processTask - function is called for the frontend task orderprocessor.gateway with your gateway as parameter. Used for instance in multi step processings check the Bankwire Gateway


for advanced usages you can implement these functions:


function getLogo - returns the url to the gateway logo (default is the logo.png in your gateway folder)

function saveAdminForm - called when the Admin setup form is saved

function showAdminForm - called when the Admin setup form is displayed


Installation


Pack all files needed into a zip archive (make sure manifest.xml is in the top folder). This will be the Installation zip.

In Administrator Backend go to Components>Auction Factory>Settings

Then click on "Payment Methods Config" and choose "Install New Item" from the toolbar.

Upload the gateway installation zip and then you should see it in the gateways list.