The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Getting Started

Gateways

API

Configuring gateways

All payment gateways must implement GatewayInterface, and will usually extend AbstractGateway for basic functionality.

Initialize a gateway

Gateways are created and initialized like so:

use Omnipay\Omnipay;

$gateway = Omnipay::create('PayPal_Express');
$gateway->setUsername('adrian');
$gateway->setPassword('12345');

Alternatively, multiple parameters can be initialized at once, directly from data:

...
$gateway->initialize([
    'username' => 'adrian',
    'password' => '12345',
]);

Setting parameters this way will start by taking the default parameters as a base, and then merging your supplied parameters over the top.

Gateway settings

Most settings are gateway specific. If you need to query a gateway to get a list of available settings, you can call getDefaultParameters():

$settings = $gateway->getDefaultParameters();
// default settings array format:
array(
    'username' => '', // string variable
    'testMode' => false, // boolean variable
    'landingPage' => array('billing', 'login'), // enum variable, first item should be treated as default
);

Gateway types

Generally most payment gateways can be classified as one of two types:

However, there are some gateways such as Sage Pay Direct, where you take credit card details on site, then optionally redirect if the customer’s card supports 3D Secure authentication. Therefore, there is no point differentiating between the two types of gateway (other than by the methods they support).