additionpayment-gatewayomnipay

Omnipay how to add new gateway


Does anyone know how I could add a new payment gateway to Omnipay?

I read the blog https://groups.google.com/forum/#!topic/omnipay/j7OeQQSB95A

I followed the following steps:

  1. Cloned the Omnipay repository using composer
  2. Inside the vendor/Omnipay/ directory, added the new directory layout as per the stripe example

Now when am now trying to include my gateway, I see the following error:

SCREAM: Error suppression ignored for
( ! ) Fatal error: Class '\Omnipay\Mygateway\Gateway' not found in 
C:\wamp\www\root\omnipay\vendor\omnipay\common\src\Omnipay\Common\GatewayFactory.php on line 79

Solution

  • You don't need to change anything inside the vendor/ directory.

    Just create a class \Omnipay\MyGateway\Gateway in your regular src/lib directory, and make sure it can be autoloaded by composer. Then you can use Omnipay\Omnipay::create('MyGateway') to create an instance of the class (or simply call new \Omnipay\MyGateway\Gateway()).