使用Coinbase PHP库向外部发送比特币返回422 :: Invalid amount

时间:2018-12-07 10:19:44

标签: php codeigniter coinbase-api coinbase-php

我试图使用coinbase php库将0.0001比特币发送到外部BTC地址。我有基于CodeIgniter的网站并生成比特币地址,检索余额工作正常。但是我似乎无法以某种方式使硬币提取工作。下面是我的代码。

$configuration = \Coinbase\Wallet\Configuration::apiKey($apiKey, $apiSecret);
$client = Coinbase\Wallet\Client::create($configuration);
$accountId = $this->getCoinbaseAccountid($coinid);
$account = $client->getAccount($accountId);
$coinsymbol = $this->CI->common_library->getCoinSymbol($coinid);//returns BTC
$withdrawAmount = new Coinbase\Wallet\Value\Money($amountTosend, $coinsymbol);
$transaction = Coinbase\Wallet\Resource\Transaction::send([
  'toBitcoinAddress' => $sendtoAddress,
  'amount' => $withdrawAmount,
  'description' => $comment,
  'fee' => '0.00005' // only required for transactions under BTC0.0001
]);
try {
  $response = $client->createAccountTransaction($account, $transaction);
} catch (Coinbase\Wallet\Exception\HttpException $ex) {
  $error = $ex->getResponse()->getStatusCode() . '::' . $ex->getError();
  $errorcase = 1;
  $this->log_ipn_results(FALSE, $error);
}

在我的日志文件中,出现以下错误。即使在searching之后,我仍然找不到此错误。

  

422 ::无效金额

1 个答案:

答案 0 :(得分:1)

最低提款金额高于0.0001 BTC。