<p>You are using the old, version 1, blockchain wallet API which was deprecated earlier this year.  None of the calls you are trying will work. </p>

<p>The new, version 2, API requires you to run a local nodeJS service to handle the calls. This will require you to have root access to your webserver so you will need to use a VPS instead of a basic shared web host. </p>

<p>You will need to request an API key here <a href="https://blockchain.info/api/api_create_code" rel="nofollow">https://blockchain.info/api/api_create_code</a></p>

<p>Install nodeJS<br>
Install NPM<br>
Install blockchain-wallet <code>npm install -g blockchain-wallet-service</code><br>
It should install to usr/local/bin<br>
Run the service <code>node blockchain-wallet-service start --port 3030</code><br>
Now it's running, but you still need to complete the handshake with blockchain's server. We can do that with a cURL request in a PHP file.</p>

<p><strong>some_file.php</strong>    </p>

<pre><code>//replace with your GUID, password and API key
 $url = "http://127.0.0.1:3030/merchant/YOUR-GUID/login?password=YOUR-PASSWORD&amp;api_code=YOUR-API-CODE";
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_URL, $url);
 $ccc = curl_exec($ch);
 $json = json_decode($ccc, true);
 var_dump($json);
</code></pre>

<p>Save the above and run it on your server. The file should keep spinning and loading since blockchain doesn't recognize the IP address. Wait for it to timeout about 60 seconds, and then check your email. Blockchain should have sent you an API access attempt showing what IP tried to connect. Follow the link and authorize the attempt, also the IP address from the email and whitelist it in your wallet account settings. </p>

<p>Now try running the file again. 
If you did everything correctly you should see a response that lists your GUID followed by Success TRUE </p>

<p>Now you're connected and you can start sending requests with your wallet. </p>

<p>Check their API documentation for example calls once you're set up. <a href="https://blockchain.info/api/blockchain_wallet_api" rel="nofollow">https://blockchain.info/api/blockchain_wallet_api</a></p>

CC BY-SA 3.0
2016-07-29T00:32:51.010Z
2016-07-29T00:32:51.010Z
m1xolyd1an
<p>I tried below code and gave valid credentials, but we could not get the response of balance check. What would be the solution?</p>

<pre><code>&lt;?php

$guid="xxxxxxxxx";
$main_password="xxxxxxxxx";

$json_url = "https://blockchain.info/merchant/$guid/balance?password=$main_password";

$json_data = file_get_contents($json_url);

$json_feed = json_decode($json_data);

$balance = $json_feed-&gt;balance;

echo $balance;
</code></pre>

CC BY-SA 3.0
2016-07-28T12:01:57.387Z
It would be helpfull if you showed us the response blockchain gives
Web Weave
CC BY-SA 3.0
2016-07-29T00:34:57.773Z
He will receive no response since he's using an old deprecated version of their wallet service. See my response posted below.
m1xolyd1an
<blockchain><wallet><api><php><balance>
Cannot check balance with blockchain.info API
Ramesh Inovies
# Cannot check balance with blockchain.info API

(Asked by: username_0 on 2016-07-28)

I tried below code and gave valid credentials, but we could not get the response of balance check. What would be the solution?

```
<?php

$guid="xxxxxxxxx";
$main_password="xxxxxxxxx";

$json_url = "https://blockchain.info/merchant/$guid/balance?password=$main_password";

$json_data = file_get_contents($json_url);

$json_feed = json_decode($json_data);

$balance = $json_feed->balance;

echo $balance;

```

**Tags:** blockchain, wallet, api, php, balance

> **Comments:**
> **username_1**: It would be helpfull if you showed us the response blockchain gives  
> **username_2**: He will receive no response since he's using an old deprecated version of their wallet service. See my response posted below.  

---

## 1 answers

### Answer by username_2 on 2016-07-29. Score: 1

You are using the old, version 1, blockchain wallet API which was deprecated earlier this year. None of the calls you are trying will work.

The new, version 2, API requires you to run a local nodeJS service to handle the calls. This will require you to have root access to your webserver so you will need to use a VPS instead of a basic shared web host.

You will need to request an API key here <https://blockchain.info/api/api_create_code>

Install nodeJS  
Install NPM  
Install blockchain-wallet `npm install -g blockchain-wallet-service`  
It should install to usr/local/bin  
Run the service `node blockchain-wallet-service start --port 3030`  
Now it's running, but you still need to complete the handshake with blockchain's server. We can do that with a cURL request in a PHP file.

**some\_file.php**

```
//replace with your GUID, password and API key
 $url = "http://127.0.0.1:3030/merchant/YOUR-GUID/login?password=YOUR-PASSWORD&api_code=YOUR-API-CODE";
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_URL, $url);
 $ccc = curl_exec($ch);
 $json = json_decode($ccc, true);
 var_dump($json);

```

Save the above and run it on your server. The file should keep spinning and loading since blockchain doesn't recognize the IP address. Wait for it to timeout about 60 seconds, and then check your email. Blockchain should have sent you an API access attempt showing what IP tried to connect. Follow the link and authorize the attempt, also the IP address from the email and whitelist it in your wallet account settings.

Now try running the file again.
If you did everything correctly you should see a response that lists your GUID followed by Success TRUE

Now you're connected and you can start sending requests with your wallet.

Check their API documentation for example calls once you're set up. <https://blockchain.info/api/blockchain_wallet_api>


---

