2013-10-20 46 views
2

我試圖用Omnipay處理PIN支付交易,並有以下代碼(幾乎完全一樣的example on the Pin website,以及包含我的祕密API密鑰,而不是「關鍵」):使用Omnipay的引腳付款

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

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

並得到以下錯誤:

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

我需要一個合法的 'card_token'?這裏的一個來自網站的例子 - 我只是希望它仍然會在沙箱環境中處理事務。

+0

php對你說''Gateway'類沒有名爲'setApiKey'的方法 – zerkms

回答

3

看看Omnipay's Pin-gateway implementation顯示該方法實際上被稱爲setSecretKey()(不是setApiKey())。

所以$gateway->setSecretKey('key');應該做的伎倆。

+0

非常棒,謝謝堆!我正在尋找替代的方法名稱,但正在尋找使用「Api」的東西,而不是「關鍵」哈哈。再次感謝! – Ian

+0

不客氣,總是樂於幫助:)祝你好運! – Quasdunk