<?php

use Illuminate\Support\Facades\Http;

function paystack_public_key()
{
    return "pk_live_9f4199dfe95f1a625297b6b33abe4cfede9707fd";
}

function paystack_secret_key()
{
    return "sk_live_844cbf8f39725de1ce3c431a9a516c1e0bd543e1"; 
}

function verify_paystack_payment( $ref_number )
{
        $curl = curl_init();
  
        curl_setopt_array($curl, array(
          CURLOPT_URL => "https://api.paystack.co/transaction/verify/".$ref_number,
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "GET",
          CURLOPT_HTTPHEADER => array(
            "Authorization: Bearer ".paystack_secret_key(),
            "Cache-Control: no-cache",
          ),
        ));
        
        $response = json_decode( curl_exec($curl) );
        $err = curl_error($curl);
        curl_close($curl);
        return $response;
}
