In the tech Namshi team, as you probably know, we fully support the open source movement, that’s why we try to release open source software as soon as we can, in the full “give back to the community” mindset. You can check all our project on github
Lots of e-commerce companies and service providers have online payments for their customers. So do we.
Innovate payment gateway accepts all types of credit card payments.
You can easily integrate the Innovate library in your project via composer:
Using this library is easy, here is what you need:
- initialize the Innovate client
We used OOP to cover all the data we need to send to Innovate:
$client is a model that contains the Innovate account info.
$transaction represents a detailed transaction where we pass as many arguments as Innovate needs.
$card represents the required card details to perform the payment.
$customer represents the customer details.
$address represents the customer address details.
$billing represents the customer billing address and contact details.
$browser represents detailed browser info, including the User-Agent.
$customUserAgent is the browser user agent header.
$requestAcceptHeader is the browser accept header.
How It Works
To perform the payment you need to create a request to Innovate and pass the previous created objects:
You will then get one of the following responses:
A normal transaction follows a very simple flow: It just requires authentication through Innovate, and the library then performs the payment.
3D secure transactions
A 3-D_Secure transaction requires two requests to Innovate and one request for 3D Secure in order to add an additional security layer while performing the payment. The first request is already sent to Innovate and if it is 3D Secure transaction you will need to redirect the user to the concerned party (primarily, the bank) to confirm the payment.
After that the process continues by sending another request to Innovate containing the extra validation values.
You can easily distinguish between the two possible types of payments, 3D Secure and Normal, by looking at the type of Innovate response received:
In case of normal Transactions, the library will perform the payment directly. In case of 3D Secure transactions you need to send another request with more details (related to the third security party) as follows:
The response object contains the values (‘targetUrl’, ‘session’, ‘paReq’) which are needed to build the form:
Then, the receiving the previous values will be used to build a form as hidden values.
The form will be sent to the
$targetUrl which is the 3D-secure service page as the following:
termUrl: the URL that we need to direct the user to, after the user submits the form.
See an example of an ACS (Access Control Server) Form
After the form is submitted, the user is redirected to a 3D Secure page which asks for extra credentials. Once the user submits the 3D Secure form, he/she gets redirected to the ‘termUrl’ page with two hidden values (‘PaRes’, ‘MD’) which are used to create the final request to Innovate:
Then we get the final response which can be checked for payment status – success or denied:
We added two types of tests; to run them you need to install the dev dependencies using composer and then run the test using PHPUnit
These test the library functionality without sending any real request to Innovate, just hit this on your terminal:
There are a couple of integration tests that verify that the library works flawlessly by creating real requests to the Innovate payment gateway. Just use valid test credentials, then create a file called .innovate.config in the project directory with four parameters:
After the setup, just run:
We hope that you enjoy using Namshi’s open source library. We’ve been using this library for almost a year and it’s working fine with no issues on our side. As always, any feedback and pull requests are welcome :)