coinbase / coinbase-php

DEPRECATED — PHP wrapper for the Coinbase API
Apache License 2.0
297 stars 198 forks source link

Transaction::send(); gives 422::Invalid amount - error #188

Closed sunujacob closed 4 years ago

sunujacob commented 5 years ago
    $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);
    $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);
    }

This is code i use. I get below error.

422::Invalid amount

drewrothstein commented 4 years ago

Hi, we are closing out PRs + Issues as this project is being archived.