I want to send btc using my account with api with php.
I tried coinbase api from github which is depreciated
https://github.com/coinbase/coinbase-php
and i am getting error when i tried this code
require_once( __DIR__ . '/requires/coinbase/vendor/autoload.php');
use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;
use Coinbase\Wallet\Enum\CurrencyCode;
use Coinbase\Wallet\Resource\Transaction;
use Coinbase\Wallet\Value\Money;
$configuration = Configuration::apiKey($apiKey, $apiSecret);
$client = Client::create($configuration);
$transaction = Transaction::send([
'toBitcoinAddress' => "$bticoin_address",
'amount' => new Money($amount, CurrencyCode::USD),
'description' => 'Your first bitcoin!',
'fee' => '0.0001' // only required for transactions under BTC0.0001
]);
try {
$transaction = $client->createAccountTransaction($account, $transaction);
}
catch(Exception $e) {
echo $e->getMessage();
}
and i am getting this error
<b>Fatal error</b>: Uncaught TypeError: Argument 1 passed to Coinbase\Wallet\Exception\HttpException::exceptionClass() must be an instance of Psr\Http\Message\ResponseInterface, null given, called in /home/fiberpay/public_html/owner/requires/coinbase/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 33 and defined in /home/fiberpay/public_html/owner/requires/coinbase/vendor/coinbase/coinbase/src/Exception/HttpException.php:98
Stack trace:
#0 /home/fiberpay/public_html/owner/requires/coinbase/vendor/coinbase/coinbase/src/Exception/HttpException.php(33): Coinbase\Wallet\Exception\HttpException::exceptionClass(NULL)
#1 /home/fiberpay/public_html/owner/requires/coinbase/vendor/coinbase/coinbase/src/HttpClient.php(137): Coinbase\Wallet\Exception\HttpException::wrap(Object(GuzzleHttp\Exception\RequestException))
#2 /home/fiberpay/public_html/owner/requires/coinbase/vendor/coinbase/coinbase/src/HttpClient.php(121): Coinbase\Wallet\HttpClient->send(Object(GuzzleHttp\Psr7\Request), Array)
#3 /home/fiberpay/public_html/owne in <b>/home/fiberpay/public_html/owner/requires/coinbase/vendor/coinbase/coinbase/src/Exception/HttpException.php</b> on line <b>98</b><br />
Is there anyway to do that ??
I spend much time to google it but still not found any solution that is i why i put that on there may be i got some good solution from there :)
Best Regars