Как изменить API тикера Bloclkchain.info?

Я хочу интегрировать блокчейн в мой веб, я разработал его от разработчика. Проблема в том, что блокчейн конвертирует введенное количество в usd. означает, что если я хочу внести 0,001 бтк на мой веб-счет, он показывает 0,00000006 бтк среднюю цену 0,001 долл. США. расскажите, пожалуйста, как решить проблему, чтобы она показала сумму в битах, а не конвертировала ее в usd. мой код preivew Blockchain указан ниже.

public function btcPreview(Request $request)
{
$data['amount'] = $request->amount;
$data['charge'] = $request->charge;
$data['transaction_id'] = $request->transaction_id;
$pay = Payment::first();
$tran = FundLog::whereTransaction_id($data['transaction_id'])->first();

$blockchain_root = "https://blockchain.info/";
$blockchain_receive_root = "https://api.blockchain.info/";
$mysite_root = url('/');
$secret = "ABIR";
$my_xpub = $pay->btc_xpub;
$my_api_key = $pay->btc_api;
$am = $data['amount'];
$invoice_id = $tran->transaction_id;

$callback_url = route('btc_ipn',['invoice_id'=>$invoice_id,'secret'=>$secret]);if ($tran->btc_acc == null){

$resp = file_get_contents($blockchain_receive_root . "v2/receive?key=" . $my_api_key . '&callback=' . urlencode($callback_url) . '&xpub=' . $my_xpub);

$response = json_decode($resp);

$sendto = $response->address;

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();
}else{
session()->flash('message', "SOME ISSUE WITH API");
Session::flash('type', 'warning');
return redirect()->back();
}
}else{
$usd = $tran->btc_amo;
$sendto = $tran->btc_acc;
}
/*$sendto = "1HoPiJqnHoqwM8NthJu86hhADR5oWN8qG7";
$usd =100;*/

/*if ($tran->btc_acc == null){

if (file_exists($blockchain_receive_root . "v2/receive?key=" . $my_api_key . '&callback=' . urlencode($callback_url) . '&xpub=' . $my_xpub)) {
$resp = file_get_contents($blockchain_receive_root . "v2/receive?key=" . $my_api_key . '&callback=' . urlencode($callback_url) . '&xpub=' . $my_xpub);

$response = json_decode($resp);

$sendto = $response->address;

$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();
}else{
session()->flash('message', 'BlockChain API or XPUB not Correct.');
Session::flash('type', 'warning');
Session::flash('title', 'Opps');
return redirect()->back();
}
}else{
$usd = $tran->btc_amo;
$sendto = $tran->btc_acc;
}*/
/*$sendto = "1HoPiJqnHoqwM8NthJu86hhADR5oWN8qG7";
$usd =100;*/
$var = "bitcoin:$sendto?amount=$usd";
$data['code'] =  "<img src=\"https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=$var&choe=UTF-8\" title='' style='width:300px;' />";
$data['general'] = GeneralSetting::first();
$data['site_title'] = $data['general']->title;
$data['basic'] = BasicSetting::first();
$data['page_title'] = "BTC Send Preview";
$data['payment_type'] = 3;
$data['payment'] = Payment::first();
$data['btc'] = $usd;

$data['add'] = $sendto;
$data['fund'] = $tran;
return view('user.btc-send',$data);
}

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector