Skip to content

Commit

Permalink
Created an error message if keys are not defined issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mossey committed Oct 16, 2017
1 parent 5155b6c commit 220323e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Mpesa.php
Expand Up @@ -21,6 +21,9 @@ class Mpesa
public static function generateToken(){
$consumer_key=env("consumer_key");
$consumer_secret=env("consumer_secret");
if(!isset($consumer_key)||!isset($consumer_secret)){
die("please declare the consumer key and consumer secret as defined in the documentation");
}
$url = 'https://sandbox.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
Expand Down

0 comments on commit 220323e

Please sign in to comment.