Download the PHP package academe/omnipay-datatrans without Composer

On this page you can find all versions of the php package academe/omnipay-datatrans. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package omnipay-datatrans

Omnipay: Datatrans

Datatrans Gateway for the Omnipay PHP payment processing library.

Build Status Latest Stable Version Latest Unstable Version License

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 7.1+.

This is for Omnipay 3.x with a minimum PHP version of 5.6.

Table of Contents

This Gateway implements offsite payments via Datatrans. Purchase and Authorization are available, capturing an authorized payment has to be performed via Datatrans XML backend.

Installation

Omnipay can be installed using Composer. Installation instructions.

Run the following command to install omnipay and the datatrans gateway:

composer require academe/omnipay-datatrans:~3.0

While this is in development - before it is released on packagist - you will need this entry in your composer.json:

Basic (Minimal) Usage

Payment requests to the Datatrans Gateway must at least supply the following parameters:

Note: this minimal example does not actually sign or encrypt your request. See below for details of settings for a more secure approach.

All data should be in UTF-8 encoding. The gateway API supports ISO extended-ASCII encoding, but that is not enabled for this Omnipay driver.

Optional Gateway and Authorize Parameters

Signing Requests

It is recommended the requests are signed with a pre-shared key. The SHA256 key is set in the gateway account and is set in the gateway:

The same key will be used for checking the signing of response messages, if set on the gateway when handling responses. The response can optionally be signed by a different key, which is set using $gateway->setHmacKey2(), and that is documented later.

Getting A Card Reference

If enabled on the gateway account, a reusable card reference can be created. To trigger this behaviour, set the createCard parameter to true while making a purchase or authorization:

The card reference will be available in the notification server request or the complete response:

If you just want the card reference without making a purchase, then set a zero amount. Alternatively use $gateway->createCard() to create a card reference.

Optional Parameters

Additional parameters change the behaviour of the gateway. They can be set in the purchase() parameter array, or via setters setParamName().

Complete Response

The results can be read on the user returning to the merchant site:

Note: If the returnUrl ends with ".htm", then no data will not be returned with the user to the merchant site. The site must then use the notification handler to get the result.

Notification

The notification handler provides all the same data and methods as completeResponse.

To check the notification is correction signed, the send() method is used.

The notification handler supports all the data delivery modes: GET, POST, XML in header or XML in body. The signing check supports key1 and the extended key2 (a different key used for responses as for the original request).

This will return $notify, but will throw an exception if the signing checks fail.

Void

Capture

Up to the original authotization amount can be captured.

Get Transaction

A previous transaction can be fetched given either its transactionId or transactionReference. The transactionReference is preferred. This includes transactions that were cancelled by the user.

Please note that (for now) the isSuccessful() method on the response refers to the success of getting the transaction, and not the success of the authorization. This is likely to change.

The transactino status is given by the numeric value of $response->getResponseCode() and the values can be found in the Datatrans documentation. Some work is needed to map these ~20 codes to a simple success/failed/pending/cancelled status.

The response will, by default, contain the extended transaction details, which include any cardReference that was requested, and masked card numbers and expiry dates.

Offline Authorization

Some payment methods support offline authorization using a cardReference.

First a cardReference must be obtained using authorize, purchase or createCard. If this is done for a PayPal (PAP) payment method, then PayPal will create an order which can have a series of amounts authorized up to the maximum of the original order. The PayPal order ID is returned as the cardReference and is used just like the cardReference in other opayment methods.

A separate gateway is used to do offline payments, initialized using the same parameters as the redirect gateway, but like this:

If the cardReference was for a credit card, then the expiry date must be supplied with that reference. This is done using the Omnipsy CreditCard class:

For non-credit card payment methods, the CreditCard object is not needed since there will be no expiry date. Just the previously saved cardReference is passed in. The cardReference is a generic term used for a number of card and non-card payment methods.

Redirect Mode

This is the standard mode for authorizing a payment, where the user will be taken to a remote payment form and returned when they have finished.

The redirect can be either a POST or a GET redirect, defaulting to POST. The setRedirectmethod() parameter takes either "GET" or "POST" to set the redirection mode.

iframe Mode/Inline Mode

By putting the redirect mode into GET mode, the URL for the iframe becomes the redirect URL: $response->getRedirectUrl()

The iframe content is put into a simplified theme by setting $request->setInline(true)

The iframe mode appears to require exactly one payment method, making the payment method mandatory.

Lightbox Mode

Lightbox mode uses JavaScript to display the payment form in an iframe in the merchant site, with the merchant site behind a darkened mask. It appears to the user that they are remaining on the merchant site, but the form is remotely supplied by the gateway.

This is supported by getting the redirect data in a lightbox-mode format. To use lightbox mode, please see the DataTrans documentation for the genral HTML needed. The form attributes are then supplied by this driver through the getLightboxHtmlAttributes() method of the redirect response:

Set up the gateway as you would for a redirect payment.

If you prefer to build your own HTML attributes, the data for the attributes is available using $resquest->getLightboxData(). It is similar to redirectData() but uses different keys.

One thing lightbox mode offers that other modes do not, is the ability to select multiple payment methods. These are set as a comma-separated list of values. For example, to offer both Visa and PayPal as options in the lightbox, set the paymentMethod to "VIS,PAP". Or you can leave the paymentMethod blank and the lightbox will offer all available payment methods available to the account.

Hidden Mode

This mode requires credit card details to be passed through your merchant application. It is not supported by this release of the driver drue to the PCI requirements involved.

ItemBag/Basket

The standard Omnipay Itembag is supported for the PayPal (PAP) mayment method. Some notes, since the ItemBag can be inflexible and a little ambiguous:

TODO

Additional Parameters (for various payment methods)

Functionality


All versions of omnipay-datatrans with dependencies

PHP Build Version
Package Version
Requires omnipay/common Version ^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package academe/omnipay-datatrans contains the following files

Loading the files please wait ....