首页 > 解决方案 > 使用 coinbase php 库向外部发送比特币返回 422::Invalid amount

问题描述

我试图使用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);
}

在我的日志文件中,出现以下错误。即使搜索后我仍然无法找到此错误。

422::无效金额

标签: phpcodeignitercoinbase-apicoinbase-php

解决方案


最低提款金额高于0.0001 BTC。


推荐阅读