1

I am using codeigniter and would like to implement omnipay. My development environment is windows and i use wamp server. After much struggle i installed it downloading composer and then curl and then changing the access controls in httpd.conf.

Now i am having trouble using the functions of omnipay. I have created a gateway with this code

echo 'testing the omnipay';

require 'Vendor/autoload.php';

use Omnipay\Common\GatewayFactory;

$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername('some_username');
$gateway->setPassword('some_password');
$gateway->setSignature('some_signature');
$gateway->setTestMode(true);

I am not sure how to proceed furthur

I would like to know if there are any tutorials or online documentation for proper use of omnipay

regards, Nandakumar

Nandakumar
  • 11
  • 6
  • possible duplicate of [codigniter + omnipay installation](http://stackoverflow.com/questions/17081800/codigniter-omnipay-installation) – stormdrain Sep 12 '13 at 13:48
  • I need it two. The given example on github is not simple to understand !! – Alpha Sep 16 '13 at 15:13
  • I'm sure this is a wonderful package but without any visible documentation, it seems about useless. Arrgh! – mpemburn Nov 27 '13 at 20:22

1 Answers1

1

Once you have set created the gateway, you can make a purchase with it. The documentation is in the README which comes with Omnipay.

There is an example here: https://github.com/omnipay/omnipay#tldr

and here: https://github.com/omnipay/omnipay#gateway-methods

$response = $gateway->purchase(['amount' => '10.00', 'currency' => 'USD', 'card' => $formData])->send();

if ($response->isSuccessful()) {
    // payment was successful: update database
    print_r($response);
} elseif ($response->isRedirect()) {
    // redirect to offsite payment gateway
    $response->redirect();
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}
Stephen
  • 3,607
  • 1
  • 27
  • 30
Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70
  • It made me laugh that someone down voted this without commenting considering you are the author. This should be marked as correct as it is the right answer – Stephen May 23 '14 at 06:57