I want to use Blockchain receive API without exchange rate

0 votes

I have integrated Blockchain recieve API for a Blockchain Payment Gateway but when I try to enter an amount to add balance it converts that amount into USD. How do I get it in BTC?

Trying to remove the below URL from my code but not helping:

if ($sendto!="") {
                $api = "https://blockchain.info/tobtc?currency=USD&value=".$data['amount'];

                $usd = file_get_contents($api );
                $tran->btc_amo = $usd;
                $tran->btc_acc = $sendto;
                $tran->save();
Jul 31, 2018 in Blockchain by sabby
• 4,350 points
67 views

1 answer to this question.

0 votes

You are not using receive API you are using Exchange Rates API which  needs currency and 

Read here: blockchain.info/api/exchange_rates_api

If you need USD to BTC, you can try this:

$one_usd_in_btc = https://blockchain.info/tobtc?currency=USD&value=1
$usd_to_btc     = $one_usd_in_btc * your_usd
answered Aug 1, 2018 by Perry
• 17,020 points

Related Questions In Blockchain

0 votes
1 answer

How do I use hyperledger fabric blockchain to build my own application?

To use fabric I would recommend you ...READ MORE

answered May 16, 2018 in Blockchain by Johnathon
• 9,080 points
92 views
0 votes
1 answer
+1 vote
1 answer

Blockchain declining my API key and I cannot understand why.

It's quite easy. Request the API key using ...READ MORE

answered Apr 3, 2018 in Blockchain by Christine
• 15,790 points
232 views
+1 vote
1 answer

I would like to create a blockchain network which will stay at the same level of complexity, is it possible?

You can very easily create a cryptocurrency having a ...READ MORE

answered Apr 4, 2018 in Blockchain by Christine
• 15,790 points
52 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
155 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,550 points
3,642 views
0 votes
1 answer

Send Payment error in Blockchain API

The following code should help: $address = null; try ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,020 points
241 views
0 votes
1 answer

How to use Blockchain receive API without exchange rate?

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

answered Aug 20, 2018 in Blockchain by Perry
• 17,020 points
34 views
+1 vote
1 answer

Hyperledger - How can I use transaction certificates to enforce privacy?

The transaction certificates don't actually address privacy ...READ MORE

answered Apr 17, 2018 in Blockchain by Perry
• 17,020 points
127 views