Download the PHP package namshi/innovate without Composer
On this page you can find all versions of the php package namshi/innovate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download namshi/innovate
More information about namshi/innovate
Files in namshi/innovate
Package innovate
Short Description A PHP client to perform payments with the Innovate payment gateway.
License MIT
Informations about the package innovate
NAMSHI | Innovate
This library provides support for the Innovate payment gateway using Guzzle.
Version
From the 3.0.0 version, the client constructor has been changed. Now it accepts two more parameters:
The added paramets are used when fetching the transactions related to a cart id (see below).
Installation
You can install this library via composer: have a look at the package on packagist.
Then include it into your composer.json
:
Pick major and minor version according to your needs.
Usage
To use the library you will need an instance of the Namshi\Innovate\Client
class.
This library will provide also helper classes that describe the data needed by the Innovate api.
If you want you can also inject your own Guzzle client instance (as long as it extendes \Guzzle\Service\Client
)
How It Works
There are two types of transactions:
- 3-D_Secure transaction
- Normal transaction
We do not have a way to understand which is which beforehand. The way we can understand if we are dealing with a 3-D_Secure transaction is by checking the response from Innovate.
Authorization Statuses
Any payment will perform an authorization request first and then the payment request.
If the authorization is denied, you will receive a response with a failure message and the 400 Bad Request status code .
Normal transaction
A normal transaction will follow only the authorization and payment steps already described.
On your end you will only need to check that the status code of the response is a 200
. The library will take care of the rest.
3D secure transaction
A 3D secure transaction requires an additional step compared to the normal transaction.
When the library requests the authorization for a 3D secure transaction, Innovate will answer with a url where the customer should be redirect. The redirection should be done by your application (as described below).
Once the customer is done with the 3D secure step, she'll be redirected back to the application and there you can use this library to perform the actual payment.
Note: The library will return an instance of 'Namshi\Innovate\Http\Response\Redirect' when the transaction is a 3D secure one.
The following example describes the code to perform a 3D secure payment:
The response object will contain the following values:
targetUrl
session
paReq
You will need those as hidden fields to perform the redirect to Innovate:
One simple way to redirect the customer with the right parameters is to build a form and add those values as hidden fields.
The must be sent to the targetUrl
:
Note: termUrl
is the url where Innovate will redirect the customer after the 3D secure step.
An example of this form is here: ACS (Access Control Server) Form
The easiest way to submit the form is with Javascript (without asking the customer to do it):
After the form is submitted the customer will be redirected to the 3D-Secure page which asks for extra credentials. From there she gets redirected to termUrl
with two values ('PaRes', 'MD'):
We can use this values to perfom the actual payment request:
The final response lets us check if the payment is successful or denied:
Fetching transaction related to a cart id
From 3.0.0 version there is a new method that let you fetch the transaction given the innovate cart id.
This method will return a object containing the answer from innovate or throw an exception ().
Tokenization of a credit card
With 4.0.0 version we add the ability to:
- request a token from a credit card
- issue a normal transaction using a token instead of a credit card
- issue a 3D Secure transaction using a token instead of a credit card
To request a token you should use the following method
To perform a normal transaction or a 3D Secure transaction with a token, the flow is the same described above, the only difference is:
- use an instrance of
Namshi\Innovate\Tokenized\Token
instead ofNamshi\Innovate\Payment\Card
- use an instrance of
Namshi\Innovate\Tokenized\CustomerInformation
instead ofNamshi\Innovate\Payment\BillingInformation
Tests
You can run the test suite by first installing the dependencies and then running PHPUnit:
There is an integration test that actually verify that the library works flawlessly.
To run it, you need to create a file called .innovate.config
in your your project directory with 4 parameters
and then run
All versions of innovate with dependencies
symfony/serializer Version ~2.3
symfony/http-foundation Version ~2.3