D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
www
/
Filename :
paymentstatus.php
back
Copy
<?php require_once "config.php"; require_once "common.php"; if(isset($_POST['merchantId']) && isset($_POST['transactionId']) && isset($_POST['amount']) ) { $merchantId=$_POST['merchantId']; $transactionId=$_POST['transactionId']; $amount=$_POST['amount']; session_start(); $name = $_SESSION['name'] ; $email = $_SESSION['email'] ; $mobile = $_SESSION['mobile'] ; if (API_STATUS == "LIVE") { $url = LIVESTATUSCHECKURL . $merchantId . "/" . $transactionId; $saltkey = SALTKEYLIVE; $saltindex = SALTINDEX; } else { $url = STATUSCHECKURL . $merchantId . "/" . $transactionId; $saltkey = SALTKEYUAT; $saltindex = SALTINDEX; } $st = "/pg/v1/status/" . $merchantId . "/" . $transactionId . $saltkey; $dataSha256 = hash("sha256", $st); $checksum = $dataSha256 . "###" . $saltindex; //GET API CALLING $headers = array( "Content-Type: application/json", "accept: application/json", "X-VERIFY: " . $checksum, "X-MERCHANT-ID:" . $merchantId ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, '0'); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, '0'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $resp = curl_exec($curl); curl_close($curl); $responsePayment = json_decode($resp, true); // echo "<pre>"; // print_r($responsePayment); // echo "</pre>"; $tran_id = $responsePayment['data']['transactionId']; $amount = $responsePayment['data']['amount']; if ($responsePayment['success'] && $responsePayment['code'] == "PAYMENT_SUCCESS") { header('Location:' . BASE_URL . "success.php?tid=" . $tran_id . "&amount=" . $amount); } else { header('Location:' . BASE_URL . "failure.php?tid=" . $tran_id . "&amount=" . $amount); } } ?>