Post Get Current Price API
Production: https://api.logisticprotrade.com/v1/currentPrice
Sandbox: https://dev.logisticprotrade.com/v1/currentPrice
REQUEST
Name | Details | |
api_key | Respective Api Key value | * required |
secret_key | Respective Secret Key value | * required |
merchant_id | Respective Merchant ID value | * required |
coin | BTC, BCH, ETH, LTC | * required |
currency | USD, 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
Name | Details | |
status | Transaction Status | |
data | Transaction Data Node | |
– price | Current destination currency price at the moment | |
– coin | BTC, BCH, ETH, LTC | |
– date_time | Transaction Date Time | |
– currency | USD, 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;
}
?>