mpesa-php-sdk
mpesa-php-sdk copied to clipboard
Wrong implementation of stk push function
The implementation of stk push function does not match the documentation in the developer portal
Timestamp parameter is missing and there is an added remarks parameter that does not exist in the documentation
this is what the documentation says: <?php
$curl_post_data = array( //Fill in the request parameters with valid values 'BusinessShortCode' => ' ', 'Password' => ' ', 'Timestamp' => ' ', 'TransactionType' => 'CustomerPayBillOnline', 'Amount"' => ' ', 'PartyA' => ' ', 'PartyB' => ' ', 'PhoneNumber' => ' ', 'CallBackURL' => 'https://ip_address:port/callback', 'AccountReference' => ' ', 'TransactionDesc' => ' ' );
$data_string = json_encode($curl_post_data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
$curl_response = curl_exec($curl); print_r($curl_response);
echo $curl_response; ?>
true it keeps throwing error when you add the remarks field
Was this one fixed?
Also, still on the function STKPushSimulation
while the TransactionDesc
is set in the function parameters, It's not being sent to the server, what is the point? But this line can easily be changed by developers. 'TransactionDesc' => $TransactionType
Another thing I don't understand is the timestamp generation: why the concatenation?
$timestamp='20'.date( "ymdhis");
@AustineGwa was it fixed?
@AustineGwa @StanleyMasinde @kyien Let me have a look into this and will update on the progress in a day.
@AustineGwa @StanleyMasinde @kyien Let me have a look into this and will update on the progress in a day.
@jaymoh , This concatenation is to generate time in the form of YYYYMMDDHHmmss
That's great @mossey. Thanks