我尝试了AcceptSuite,并收到如下错误消息
在AcceptSuite \ create-an-accept-payment-transaction.php中找不到类'net \ authorize \ api \ contract \ v1 \ MerchantAuthenticationType'
我刚刚克隆(git clone https://github.com/AuthorizeNet/sample-code-php.git)存储库并运行composer更新。 我正在尝试使用AcceptSuite进行交易。
下面是我的代码
require '../vendor/autoload.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
define("AUTHORIZENET_LOG_FILE", "phplog.txt");
function createAnAcceptPaymentTransaction($request, $session)
{
// Create a merchantAuthenticationType object with authentication details
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName($authnet_loginid);
$merchantAuthentication->setTransactionKey($authnet_transaction_key);
}
下面是composer.json中的代码
{
"require": {
"php": ">=5.6",
"ext-curl": "*",
"phpunit/phpunit": "~4.8||~6.0",
"authorizenet/authorizenet": ">=1.9.9 || <2.0"
}
}
答案 0 :(得分:0)
如果您未使用laravel之类的框架,则需要输入sdk文件夹的确切路径。
require 'publics/plugins/sdk-php/autoload.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
define("AUTHORIZENET_LOG_FILE", "phplog");
否则,如果您使用的是框架,则可以按照以下步骤安装授权
https://codescompanion.com/authorize-net-payment-gateway-integration-with-laravel/