Your IP : 18.221.69.38


Current Path : /var/www/html/api/
Upload File :
Current File : /var/www/html/api/paystack_trans_init_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_init_handler');

$data = file_get_contents("php://input");

$path=parse_str($data,$params);

$logger->debug("Request Data: $data");




$headers = apache_request_headers();
$authToken = $headers['Authorization'];

$curl = curl_init();



curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.paystack.co/transaction/initialize",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYPEER => true,
    //CURLOPT_SSL_VERIFYPEER
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode($params),
    CURLOPT_HTTPHEADER => [
        "Authorization: $authToken",
        "content-type: application/json",
        "cache-control: no-cache"
    ],
));

$response = curl_exec($curl);
$err = curl_error($curl);
if ($err) {
    echo $err;
    exit;
}
$logger->debug("Response : $response");

echo $response;

exit;