Skip links

Current Price

Post Get Current Price API

Production: https://api.logisticprotrade.com/v1/currentPrice
Sandbox: https://dev.logisticprotrade.com/v1/currentPrice


REQUEST

NameDetails
api_keyRespective Api Key value* required
secret_keyRespective Secret Key value* required
merchant_idRespective Merchant ID value* required
coinBTC, BCH, ETH, LTC* required
currencyUSD, CAD or EUR* required

RAW JSON BODY

{

“api_key”: “(respective api key value)”,

“secret_key”: “(respective secret key value)”,

“merchant_id”: “(respective merchant id value)”,

“coin”: “(options BTC,BCH,ETH, LTC)”,

“currency”: “(options USD,CAD or EUR)”

}

*All fields are required


RESPONSE

NameDetails
statusTransaction Status
dataTransaction Data Node
– priceCurrent destination currency price at the moment
– coinBTC, BCH, ETH, LTC
– date_timeTransaction Date Time
– currencyUSD, CAD or EUR

Example Successful Response

{

“status”: “success”,

“data”:

{

“price”: “11314.69”,

“coin”: “BTC”,

“date_time”: “2020-08-28 11:04:02:460”,

“currency”: “USD”

}

}


PHP Example

<?php
function getCurrentPrice($payload,$mode)
{
	$url = "";
	if($mode == "stage")
	{
		$url = "https://dev.logisticprotrade.com/v1/";
	}
	elseif($mode == "production")
	{
		$url = "https://api.logisticprotrade.com/v1/";
	}
	$url .= "currentPrice";

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL,$url);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	$result = curl_exec($ch);
	if(curl_exec($ch) === false) {
		$result = 'Curl error: ' . curl_error($ch);
	} 
	
	curl_close ($ch);
	return $result;
}
$data = [
  "api_key" => $api_key,
  "secret_key" => $secret_key,
  "merchant_id" => $merchant_id,
  "coin" => $coin,
  "currency" => $currency
];
$mode = "stage"; // stage & production
$payload = json_encode($data);
$response = getCurrentPrice($payload,$mode);
$response = json_decode($response);
$response_status = $response->response->status;
$responsetxid = $response->response->data->txid;
if($response_status == "error")
{
	//error get data
}
else
{
	$currentPrice_price = $response->response->data->price;
	$currentPrice_coin = $response->response->data->coin;
	$currentPrice_date_time = $response->response->data->date_time;
	$currentPrice_currency = $response->response->data->currency;
}
?>

Powered by BetterDocs