2

我正在尝试使用Omnipay处理 Pin 支付交易并具有以下代码(与 Pin 网站上的示例几乎完全相同,并且包含我的秘密 API 密钥而不是“密钥”):

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();

并得到以下错误:

致命错误:调用未定义的方法 Omnipay\Pin\Gateway::setApiKey()

我需要合法的“card_token”吗?这里的一个来自网站的例子——我只是希望它仍然能在沙盒环境中处理交易。

4

1 回答 1

3

查看Omnipay 的 Pin-gateway 实现表明该方法实际上被调用setSecretKey()(不是setApiKey())。

所以$gateway->setSecretKey('key');应该做的伎俩。

于 2013-10-20T08:23:16.120 回答