-1

I need help regarding omnipay pin payments. i have no clue how to integrate this to cake php.

i tried this sample code but dint get success

$gateway = GatewayFactory::create('Pin');
$gateway->setSecretKey('your-secret-api-key');
$gateway->purchase([
  'email'       => 'customer@email.com',
  'description' => 'Widgets',
  'amount'      => '4999',
  'currency'    => 'USD',
  'card_token'  => 'card_nytGw7koRg23EEp9NTmz9w',
  'ip_address'  => '1.2.3.4'
])->send(); 

Fatal error: Class 'GatewayFactory'

Please help me . Thanks in advance

sismaster
  • 181
  • 1
  • 13
  • Are you including the Omnipay plugin in your code anywhere? You should have something like `use Omnipay\Common\GatewayFactory;`. – bigmike7801 Apr 11 '14 at 21:19

1 Answers1

1

You need to use Composer to install Omnipay. This is explained in the Omnipay Readme.

Make a file called composer.json in the root of your project directory:

{
    "require": {
        "omnipay/pin": "~2.0"
    }
}

Then run the following commands in a terminal window:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

This will download the Omnipay files into your vendor/ directory.

Next, you will need to put the following line at the top of your index.php file, to register the composer autoloader:

require 'vendor/autoload.php';

Finally, you can use Omnipay in your project to create the Pin gateway:

$gateway = Omnipay\Omnipay::create('Stripe');
Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70