Post Get Transaction Status by Tx (Transaction ID) API
Production: https://api.logisticprotrade.com/v1/statusByTx
Sandbox: https://dev.logisticprotrade.com/v1/statusByTx
REQUEST
Name | Details | |
api_key | Respective Api Key value | * required |
secret_key | Respective Secret Key value | * required |
merchant_id | Respective Merchant ID value | * required |
txid | Respective 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
Name | Details | |
status | Transaction Status | |
data | Transaction Data Node | |
– date_time | Transaction Date Time | |
– address | Respective Address Value returned on payment method | |
– status | Paid, Pending | |
– payment_amount | Amount send in destination currency | |
– total_payment | Amount of the transaction in the original currency | |
– txid | Transaction ID | |
– price | Current destination currency price at the moment | |
– currency | USD, CAD or EUR | |
– coin | BTC, 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 } } ?>