Question

I am trying to use Omnipay to process Pin Payment transactions and have the following code (almost exactly the same as the example on the Pin website, and containing my secret API Key instead of 'key'):

require_once __DIR__.'/vendor/autoload.php';
use Omnipay\Common\GatewayFactory;

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

And get the following error:

Fatal error: Call to undefined method Omnipay\Pin\Gateway::setApiKey()

Do I need a legit 'card_token'? The one here is from the website's example - I was just hoping it would still process the transaction in the sandbox environment.

Was it helpful?

Solution

A look at Omnipay's Pin-gateway implementation shows that the method is actually called setSecretKey() (not setApiKey()).

So $gateway->setSecretKey('key'); should do the trick.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top