我試圖用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'?這裏的一個來自網站的例子 - 我只是希望它仍然會在沙箱環境中處理事務。
php對你說''Gateway'類沒有名爲'setApiKey'的方法 – zerkms