Current Path : /var/www/html/api/ |
Current File : /var/www/html/api/paystack_trans_verification_handler.php |
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require_once('log4php/main/php/Logger.php'); Logger::configure('log4php/resources/appender_dailyfile.properties'); $logger = Logger::getLogger('paystack_trans_verification_handler'); $transRef = $_GET['transRef']; $headers = apache_request_headers(); $authToken = $headers['Authorization']; $url = "https://api.paystack.co/transaction/verify/$transRef"; $logger->debug("URL: $url"); //$secretKey=PAYSTACK_LIVE_SECRET_KEY; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt( $ch, CURLOPT_HTTPHEADER, [ "Authorization: $authToken"] ); $response = curl_exec($ch); $err = curl_error($ch); if ($err) { echo $err; exit; } $logger->debug("Response Data: $response"); echo $response; exit;