I'm trying to use the Omnipay API with the Pin gateway but having issues.
I've run composer.phar locally with this in the composer.json file:
{
"require": {
"omnipay/omnipay": "~2.0"
}
}
The composer "vendor" folder now resides at "classes/libs/vendor" on my site.
I have this payment class:
class Payment extends BasicClass {
public function charge() {
require "libs/vendor/autoload.php";
use Omnipay\Omnipay;
$gateway = GatewayFactory::create('Pin');
$gateway->setSecretKey($this->config->secretKey);
}
}
When calling:
$topup = new Payment();
$topup->charge();
I get a parse error, PHP takes issue with my use Omnipay\Omnipay
line.
Very confused as all Omnipay documentation seems to use this syntax.
I've tried the require and use lines outside the class, but that did not help.
Thanks for everyone's help.