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();
Aug 1, 2018 in Blockchain by sabby
• 4,390 points
401 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,100 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 17, 2018 in Blockchain by Johnathon
• 9,090 points
914 views
0 votes
1 answer
+2 votes
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
1,804 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,705 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,740 points
43,989 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,100 points
1,579 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 21, 2018 in Blockchain by Perry
• 17,100 points
596 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,100 points
672 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