safaricom / mpesa-php-sdk

A PHP sdk for the new Mpesa RESTful APIs
188 stars 219 forks source link

mpesa payment b2c #7

Closed himanshupatel95 closed 5 years ago

himanshupatel95 commented 6 years ago

Fatal error: Call to undefined function Safaricom\Mpesa\env() in env() error.

mossey commented 6 years ago

Hi @himanshupatel95. What were you trying to achieve when you encountered this? Have you defined your environmental variables? If not you need to define them.

KipchirchirIan commented 6 years ago

Encountered the same issue as well.

mpesa-err-1

The code:


$stkPushSimulation = $mpesa->STKPushSimulation(
   "174379",
   "bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919",
   "CustomerPayBillOnline",
   "10",
   "254720123123",
   "174379",
   "254720123123",
   "https://example.com/callback.php",
   "Abc 123",
   "Testing Mpesa API",
   "MPesa API");

echo $mpesa->getDataFromCallback();```
mossey commented 6 years ago

Hey @KipchirchirIan Currently the sdk works well with Laravel. The env function works well with PHP. Just realized This. I will make provisions so that It can work with all the other frameworks soon