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');
Most settings are gateway specific. If you need to query a gateway to get a list of available settings, you can call
$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 );
Generally most payment gateways can be classified as one of two types:
- Off-site gateways such as PayPal Express, where the customer is redirected to a third party site to enter payment details
- On-site (merchant-hosted) gateways such as PayPal Pro, where the customer enters their credit card details on your site
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).