Reputation: 11
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
Upvotes: 1
Views: 1984
Reputation: 13263
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();
}
Upvotes: 1