Create Payment Wallet Address
Post Create Wallet Address API
Production: https://api.logisticprotrade.com/v1/payment
Sandbox: https://dev.logisticprotrade.com/v1/payment
REQUEST
Name | Details | |
api_key | Respective API KEY value | * required |
secret_key | Respective SECRET KEY value | * required |
merchant_id | Respective MERCHANT ID value | * required |
ref_id | User unique reference/invoice id per client | * required |
currency | USD, CAD or EUR | * required |
cryptoCurrency | BTC, BCH, ETH, LTC | * required |
amount | The amount of the transaction in the original currency | * required if checkout_url is going to be used |
ipn_url | URL for your IPN callbacks | |
cancel_url | Sets a URL to go to if the buyer does not complete payment. (Only if you use the returned ‘checkout_url‘, no effect/need if designing your own checkout page.) | |
success_url | Sets a URL to go to if the buyer does complete payment. (Only if you use the returned ‘checkout_url’, no effect/need if designing your own checkout page.) |
RAW JSON BODY
{
“api_key”: “(respective api key value)”,
“secret_key”: “(respective secret key value)”,
“merchant_id”: “(respective merchant id value)”,
“ref_id”: “(user unique reference/invoice id per client)”,
“currency”:”USD”,
“cryptoCurrency”:”BTC”,
“amount”: “2.99”,
“ipn_url”: “https://www.domain.com/ipnurl”,
“cancel_url”: “https://www.domain.com/cancelurl”,
“success_url”: “https://www.domain.com/successurl”
}
RESPONSE
Name | Detalils | |
error | * optional | |
ref_id | User unique reference/invoice id per client | |
price | Current destination currency price at the moment | |
address | The address the buyer needs to send the coins to | |
coin | BTC, BCH, ETH, LTC | |
expires | How long the buyer has to send the coins and have them be confirmed. | |
total | The amount for the buyer to send in the destination currency | |
checkout_url * | While normally you would be designing the full checkout experience on your site you can use this URL to provide the final payment page to the buyer * | * Hosted Checkout |
Example Successful Response
{
“ref_id”: “cor121121”,
“price”: “8632.59”,
“address”: “moep287CANJhZoyssrigoHtkMwBiz6uhDt”,
“coin”: “BTC”,
“expires”: “2020-05-04 14:32:46.480”,
“total”: 0.00006331825342421516,
“checkout_url”: “https://wallet.propaymentz.com/checkout.php?h=[respective hash value]”
}
Example Failed Response
{
“error”: “error”,
“message”: “Access Invalid”
}
Or
{
“error”: “error”,
“message”: ” Could Not Create Address”
}
PHP Example
<?php function post_and_get_response( $payload, $mode ) { $url = ""; if($mode == "stage") { $url = "https://dev.logisticprotrade.com/v1/payment"; } elseif($mode == "production"){ $url = "https://api.logisticprotrade.com:5000/v1/payment"; } $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" => $apikey, "secret_key" => $secretkey, "merchant_id" => $merchantid, "ref_id" => $order->id, "currency" => $currency, "cryptoCurrency" => $cryptocurrency, "amount" => $order->order_total, "ipn_url" => $ipn_url, "cancel_url" => $cancel_url, "success_url" => $success_url ]; $payload = json_encode($data); $mode = "stage"; //stage & production $response = post_and_get_response( $payload, $mode ); $result = json_decode($response); // Response Reference ID: $result->ref_id; // Response Price: $result->price; // Response Address: $result->address; // Response Coin: $result->coin; // Response Expire Date: $result->expires; // Response Total: $result->total; // Response Checkout URL: $result->checkout_url; ?>
Payment Webhook Call Back Notification
Instant Payment Notifications (IPNs) are sent every confirmed status change. IPNs are POSTed to your webhook URL specified in “ipn_url” value on Create Wallet Address API.
Note: This functionality applies to both Sandbox and Live accounts.
Webhook URL (IPN) Post
Form Post Body
“secret_key”:(respective secret key value)
“ref_id”:”wm_123323″
“price”:8550.26
“amount”:0.0006
“total”:5.13
“date_time”:”1588354319000″
“transaction_id”:”c3c2920e4705cc37c57d0937576d6346c27ca81f2b9e507fd47a1de113b7bba9″
“coin”:”BTC”
“network”:”testnet”
“currency”:”USD”
Webhook PHP Example
<?php function check_ipn_response() { $postedData = ""; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $postedData = json_decode(file_get_contents('php://input'), true); if (!is_array($postedData)) { $postedData = $_POST; } } else { $postedData = $_GET; } handle_ipn_request( $postedData ); header( 'HTTP/1.0 200 OK' ); flush(); } function handle_ipn_request( $data ) { if (isset($data["ref_id"])) { $secret_key = ""; //Fill it with your respective secret_key value $this_secret_key = $secret_key; $secret_key = $data["secret_key"]; $ref_id = $data["ref_id"]; $price = $data["price"]; $amount = $data["amount"]; $total = $data["total"]; $date_time = $data["date_time"]; $transaction_id = $data["transaction_id"]; $coin = $data["coin"]; $network = $data["network"]; $currency = $data["currency"]; if ($secret_key == $this_secret_key) { if ( ($ref_id != "") && ($price != "") && ($amount != "") && ($total != "") && ($date_time != "") && ($transaction_id != "") && ($coin != "") && ($network != "") && ($currency != "") ) { // Success handle_ipn_payment_complete( $data ); } } } } function handle_ipn_payment_complete( $data ) { $order_id = ""; //Fill it with your respective order_id value //Complete order on your side } check_ipn_response(); ?>