5

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
Prashant
  • 2,005
  • 3
  • 17
  • 24

1 Answers1

1

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()).

Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70
  • " make sure it can be autoloaded by composer." How can we map it with autoload of composer – Sandeep J Patel Feb 10 '17 at 06:54
  • Hey, can you please be more specific? I'm working on another gateway. Could you please write couple steps for creation? I added require to composer.json file and run composer update. – aleXela Mar 06 '17 at 20:48