Skip links

Get Transaction Status by Tx

Post Get Transaction Status by Tx (Transaction ID) API

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


REQUEST

NameDetails
api_keyRespective Api Key value* required
secret_keyRespective Secret Key value* required
merchant_idRespective Merchant ID value* required
txidRespective Transaction ID returned on payment method* required

RAW JSON BODY

{

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

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

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

“txid”: “(respective transaction id returned on payment method)”

}

*All fields are required


RESPONSE

NameDetails
statusTransaction Status
dataTransaction Data Node
– date_timeTransaction Date Time
– addressRespective Address Value returned on payment method
– statusPaid, Pending
– payment_amountAmount send in destination currency
– total_paymentAmount of the transaction in the original currency
– txidTransaction ID
– priceCurrent destination currency price at the moment
– currencyUSD, CAD or EUR
– coinBTC, BCH, ETH, LTC

Example Successful Response

{

“status”: “success”,

“data”:

{

“date_time”: “2020-07-31T22:10:21.000Z”,

“address”: “bchtest:qpggts6de95hnutg8wrxx55mh9z2dnxp2v64tuqn73”,

“status”: “Paid”, (Paid,Pending),

“payment_amount”: 0.01655245,

“total_payment”: 6.54,

“txid”: “0bd4d3c2ab491649bc5c7328aba8d46b2c2c856ca5cd8261d489a7e01c2a5f12”,

“price”: 395.23,

“currency”: “CAD”,

“coin”: “BCH”

}

}


PHP Example

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

	$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,
  "txid" => $txid
];
$mode = "stage" // stage & production;
$payload = json_encode($data);
$response = checkStatus($payload,$mode);
$response = json_decode($response);
$response_status = $response->response->status;
$responsetxid = $response->response->data->txid;
if($response_status == "error")
{
	//Pending payment
}
else
{
	$status_date_time = $response->response->data->date_time;
	$status_address = $response->response->data->address;
	$status_status = $response->response->data->status;
	$status_payment_amount = $response->response->data->payment_amount;
	$status_total_payment = $response->response->data->total_payment;
	$status_txid = $response->response->data->txid;
	$status_price = $response->response->data->price;
	$status_currency = $response->response->data->currency;
	$status_coin = $response->response->data->coin;
	$status_payment_amount = number_format($status_payment_amount, 6);
	if ($mode == "stage")
	{
		$network = "testnet";
		if ($status_coin == "ETH")
		{
			$network = "ropsten";
		}
	}
	else
	{
		$network = "mainnet"; 
	}

	if
	(
		($status_status == "Pending")
		||
		($status_status == "Paid")
	)
	{
		//Payment Completed
	}
}
?>

Powered by BetterDocs