Send Money not work in php - Transaction::send();
My Code is
use Coinbase\Wallet\Enum\Param; use Coinbase\Wallet\Exception\TwoFactorRequiredException; use Coinbase\Wallet\Enum\CurrencyCode; use Coinbase\Wallet\Resource\Transaction; use Coinbase\Wallet\Value\Money;
$transaction = Transaction::send(); $transaction->setToBitcoinAddress('39yUNcGWf2gXfonMt1p1r1oP54VLQqpx4U'); $transaction->setAmount(new Money(5, CurrencyCode::USD)); $transaction->setDescription('For being awesome!');
$client->createAccountTransaction($account, $transaction);
Error
[31-Dec-2017 07:55:18 UTC] PHP Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: POST https://api.coinbase.com/v2/accounts/093c28e1-3128-5953-92ac-cae32bbf29c9/transactions resulted in a 422 Unprocessable Entity response in /home/bitcoinpower/public_html/coinbaseapi/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /home/bitcoinpower/public_html/coinbaseapi/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 /home/bitcoinpower/public_html/coinbaseapi/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /home/bitcoinpower/public_html/coinbaseapi/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#3 /home/bitcoinpower/public_html/coinbaseapi/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\P in /home/bitcoinpower/public_html/coinbaseapi/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 37
Try this..
$transaction = Transaction::send([
'to' => new BitcoinAddress($_GET['to']),
'amount' => Money::btc($_GET['amount'])
]);