How to use Coinbase send money API

0 votes
https://coinbase.com/api/v1/transactions/send_money?api_key=xxx

I have that URL but after the api_key parameter what comes next (I blocked out my API Key so people can't access my BTC). How to use send_money API?

Sep 12, 2018 in Blockchain by digger
• 26,740 points

retagged Nov 22, 2018 by Priyaj 1,871 views

1 answer to this question.

0 votes
<?php
require_once(dirname(__FILE__) . '/../lib/Coinbase.php');

// Create an application at https://coinbase.com/oauth/applications and set these  values accordingly
$_CLIENT_ID = "83a481f96bf28ea4bed1ee8bdc49ba4265609efa40d40477c2a57e913c479065";
$_CLIENT_SECRET = "a8dda20b94d09e84e8fefa5e7560133d9c5af9da93ec1d3e79ad0843d2920bbb";

// Note: your redirect URL should use HTTPS.
$_REDIRECT_URL = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];

$coinbaseOauth = new Coinbase_OAuth($_CLIENT_ID, $_CLIENT_SECRET, $_REDIRECT_URL);

if(isset($_GET['code'])) {

  // Request tokens
  $tokens = $coinbaseOauth->getTokens($_GET['code']);

  // The user is now authenticated! Access and refresh tokens are in $tokens
  // Store these tokens safely, and use them to make Coinbase API requests in the future.
  // For example:
  $coinbase = new Coinbase($coinbaseOauth, $tokens);

  try {
    echo 'Balance: ' . $coinbase->sendMoney($to, $amount, $notes=null, $userFee=null, $amountCurrency=null) . '<br>';
    echo $coinbase->createButton("Alpaca socks", "10.00", "CAD")->embedHtml;
  } catch (Coinbase_TokensExpiredException $e) {
    $newTokens = $coinbaseOauth->refreshTokens($tokens);
    // Store $newTokens and retry request
  }
} else {

  // Redirect to Coinbase authorization page
  // The provided parameters specify the access your application will have to the
  // user's account; for a full list, see https://coinbase.com/docs/api/overview
  // You can pass as many scopes as you would like
  echo "<a href=\"" . $coinbaseOauth->createAuthorizeUrl("balance", "buttons") . "\">Connect with Coinbase</a>";
}

Here is the send money code

public function sendMoney($to, $amount, $notes=null, $userFee=null, $amountCurrency=null)
{
    $params = array( "transaction[to]" => $to );

    if($amountCurrency !== null) {
        $params["transaction[amount_string]"] = $amount;
        $params["transaction[amount_currency_iso]"] = $amountCurrency;
    } else {
        $params["transaction[amount]"] = $amount;
    }

    if($notes !== null) {
        $params["transaction[notes]"] = $notes;
    }

    if($userFee !== null) {
        $params["transaction[user_fee]"] = $userFee;
    }

    return $this->post("transactions/send_money", $params);
}
answered Sep 12, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

0 votes
1 answer

How to use Blockchain receive API without exchange rate?

Your code contains the amount in USD ...READ MORE

answered Aug 21, 2018 in Blockchain by Perry
• 17,100 points
888 views
0 votes
1 answer

How to get property of non object in Coinbase API

First, your sendMoney() call is stored into ...READ MORE

answered Aug 31, 2018 in Blockchain by digger
• 26,740 points
755 views
0 votes
2 answers

how to integrate coinbase api in php for transfer bitcoine

Here the code for php please have ...READ MORE

answered Sep 17, 2018 in Blockchain by Suresh
3,135 views
0 votes
1 answer

How to get historic Bitcoin Price Index using coinbase or any other open source API?

I would recommend you to use the ...READ MORE

answered Apr 7, 2022 in Blockchain by Rahul
• 9,680 points
1,345 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,922 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,427 views
0 votes
1 answer

How to Track Payment API in Coinbase

Use the callback_url option as described in the API. ...READ MORE

answered Sep 5, 2018 in Blockchain by slayer
• 29,370 points
812 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP