Please how can I pass a secret key as an authorization header in API call?
See the script below:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$postData = $_POST;
$publicKey = $postData['publicKey'];
$bvn_number = $postData['bvn'];
//initializing
$ch = curl_init();
//used to send the request to the Api endpoint
curl_setopt($ch, CURLOPT_URL, "https://api.paystack.co/bank/resolve_bvn".$bvn_number."?seckey=".$secretKey);
//return instead of outputing directly
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//whether to include the header in the output set to false here
curl_setopt($ch, CURLOPT_HEADER, 0);
//execute the response
$output = curl_exec($ch);
//check for errors
if($output === FALSE){
echo "Invalid bvn number:" . curl_error($ch);
}
//close and free up the handel
curl_close($ch);
//display the output
print_r($output);
?>
Error message:
Error: { "status": false, "message": "No Authorization Header was found" }