1 minute reading time (291 words)

Developing a Payment Plugin For HikaShop

Developing-a-Payment-Plugin-For-HikaShop

Recently, we had a chance to develop a Payment gateway plugin for HikaShop. We thought this would be a good chance to share a small overview with everyone!

Let's Get started. 

Declare the configuration

First, we need to declare the plugin configuration. This function will set plugin parameters of the backend, like public, private key payment mode etc.

var $pluginConfig = array(
        'public_key' => array('PUBLIC_KEY', 'input'),
        'private_key' => array('PRIVATE_KEY', 'input'),
        'payment_mode' => array('ENABLE_PAYMENT_MODE', 'list',array(
            'true' => 'Test',
            'false' => 'Live')
        )
    );

Catch Order Value & Currency

The payment gateway we are currently working with needs Cart Amount & Currency. This isn't available in the standard triggers. So we will use the "onAfterCartProductsLoad" trigger to catch this information. In our case, this is specifically needed for Credit Card 3DS to create the token.

Get Additional Information needed for Payment gateway

Hikashop first creates the cart object & then processes for credit card validation and after that order is being placed. The Payment gateway we are working with needs some additional feeds in addition to the data provided by HIka. So we extend the form with our own custom HTMLNeedCC:-

onBeforeOrderCreate

Before creating an order, we validate the card against token, and also we pass amount, currency, token and description to the payment gateway. In return, the gateway sends back the response to this function, by sending error message or success message. On success, it modifies the order while in case of failure it only displays the error message.

onAfterOrderConfirm

In this function store The Payment Gateway order id in this variable for access order values on thanks page. After that return to thanks page.

getPaymentDefaultValues

This function set element value like plugin name, Description and image also status for standard follow.

4
Using Joomla logging to easily debug MySQL issues
Join us for a Webinar about SocialAds @CloudAccess...

Related Posts