问题
I am using GuzzleHttp 6.5.5
Setting up payment gateway AuthorizeNet.
Composer.json
file is
"require": {
"league/omnipay": "^3.0",
"academe/omnipay-authorizenetapi": " ~3.0",
"php-http/guzzle6-adapter": "1.1.1"
}
Payment Code:
require_once('assets/import/authorizenet/vendor/autoload.php');
$gateway = Omnipay\Omnipay::create('AuthorizeNetApi_Api');
$gateway->setAuthName($pt->config->anet_login_id);
$gateway->setTransactionKey($pt->config->anet_transaction_id);
$gateway->setTestMode(true);
$creditCard = new Omnipay\Common\CreditCard([
// Swiped tracks can be provided instead, if the card is present.
'number' => '4000123412341234',
'expiryMonth' => '12',
'expiryYear' => '2020',
'cvv' => '123',
// Billing and shipping details can be added here.
]);
if (!empty($_POST['pay_type']) && $_POST['pay_type'] == 'rent' && !empty($video->rent_price)) {
$final_amount = $amount = $video->rent_price;
}
else{
$final_amount = $amount = $video->sell_video;
}
$transactionId = rand(100000000, 999999999);
$billingData = [
'amount' => $final_amount,
'transactionId' => $transactionId,
'card'=>$creditCard,
'currency' => $pt->config->anet_currency,
];
$request = $gateway->authorize($billingData);
$response = $request->send();
$data = $response->getData();
When trying to send payment request got this error:
Error: Call to undefined method GuzzleHttp\Client::sendAsync() in ...authorizenet/vendor/php-http/guzzle6-adapter/src/Client.php on line 6
I didn't found any solution
What should I do to make it work?
来源:https://stackoverflow.com/questions/63287286/guzzlehttp-error-call-to-undefined-method-guzzlehttp-clientsendasync