How to use Blockchain receive API without exchange rate?

0 votes

i have integrated blockchain recieve api for blockchain payment gateway. but when i go to pay enter amount to add balance it converts that amount into usd

i want to receive directly in BTC not in usd . when i remove below URL from my coding it gives error please help:

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 17, 2018 in Blockchain by sabby
• 4,050 points
21 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Your code contains the amount in USD in the first place. You can use the inverse of the original formula, like this:

const bitcoinrate;

function usd_to_btc($usd) {
    $btc = $usd * bitcoinrate;
}

Or maybe like the following line of code i found somehwere:

$one_usd_in_btc = https://blockchain.info/tobtc?currency=USD&value=1
$usd_to_btc     = $one_usd_in_btc * your_usd
answered Aug 20, 2018 by Perry
• 16,450 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,050 points
43 views
0 votes
1 answer
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
65 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
• 27,620 points
1,549 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
• 16,450 points
131 views
0 votes
1 answer

I want to use Blockchain receive API without exchange rate

You are not using receive API you are using Exchange ...READ MORE

answered Aug 1, 2018 in Blockchain by Perry
• 16,450 points
46 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
• 16,450 points
80 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.