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.
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') ) );
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.
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:-
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.
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.
This function set element value like plugin name, Description and image also status for standard follow.
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.