0

I was trying to send 0.0001 bitcoins to external BTC address using coinbase php library. I have CodeIgniter based website and generating bitcoin addresses, retrieving balances are working fine. but somehow I cant seem to make coin withdrawal work. Below is my code.

$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);
}

In my log file, I get below error. I still unable to find this error even after searching.

422::Invalid amount

SMJ
  • 716
  • 1
  • 9
  • 23

1 Answers1

1

The minimum withdrawal amount is higher than 0.0001 BTC.

Luca Antonelli
  • 349
  • 1
  • 2
  • 21
  • What is the minimum withdrawal amount? could you please share a link about the same? – SMJ Dec 07 '18 at 10:33
  • If you search online, the result is that Coinbase change the minimum withdrawal amount dynamically. – Luca Antonelli Dec 07 '18 at 10:38
  • Now on my account it says 0.0001 as minimum withdraw, so i'm not right, could the error refer to comma instead of dot, or something else? – Luca Antonelli Dec 07 '18 at 10:40
  • actually iam just testing right now. That is why iam trying to send 0.0001 BTC. On coinbase where do you find these limits? – SMJ Dec 07 '18 at 10:49
  • 1
    I tried setting an import under 0.0001 on the website and it said "minimum required is 0.0001" – Luca Antonelli Dec 07 '18 at 10:50