Closed nellycheboi closed 6 years ago
Hey @nellycheboi12 please make sure that your Callback route is accessible from the internet. Callbacks are sent to applications on the sandbox too.
Make sure your call back route is a POST and not GET. Also ensure no CSRF validation as in some frameworks
You need to use a tool like ngrok to expose your routes to the outside world download it from here https://ngrok.com/ this tool will expose your app on the internet, therefore making it easy for MPesa to hit your callback endpoints properly
Hello what we put in under callback url
Php way have a look at https://3v4l.org/rYfdr
I have my callback on new cpanel host. Im dumping all request data to text file via global $_REQUEST. Im not receiving anything yet. @weddingjuma @here Kindly advice. Thanks.
Does the sandbox sometimes for no reason just refuse to push back to one's callback URL? Mine was working and now it seems it does not hit the endpoint at all.
$callbackJSONData=file_get_contents('php://input');
$callbackData=json_decode($callbackJSONData);
$resultCode=$callbackData->Body->stkCallback->ResultCode;
$resultDesc=$callbackData->Body->stkCallback->ResultDesc;
$merchantRequestID=$callbackData->Body->stkCallback->MerchantRequestID;
$checkoutRequestID=$callbackData->Body->stkCallback->CheckoutRequestID;
$amount=$callbackData->stkCallback->Body->CallbackMetadata->Item[0]->Value;
$mpesaReceiptNumber=$callbackData->Body->stkCallback->CallbackMetadata->Item[1]->Value;
$balance=$callbackData->stkCallback->Body->CallbackMetadata->Item[2]->Value;
$b2CUtilityAccountAvailableFunds=$callbackData->Body->stkCallback->CallbackMetadata->Item[3]->Value;
$transactionDate=$callbackData->Body->stkCallback->CallbackMetadata->Item[4]->Value;
$phoneNumber=$callbackData->Body->stkCallback->CallbackMetadata->Item[5]->Value;
$result=[
"resultDesc"=>$resultDesc,
"resultCode"=>$resultCode,
"merchantRequestID"=>$merchantRequestID,
"checkoutRequestID"=>$checkoutRequestID,
"amount"=>$amount,
"mpesaReceiptNumber"=>$mpesaReceiptNumber,
"balance"=>$balance,
"b2CUtilityAccountAvailableFunds"=>$b2CUtilityAccountAvailableFunds,
"transactionDate"=>$transactionDate,
"phoneNumber"=>$phoneNumber
];
return json_encode($result);
try this
Hello,
Much appreciated.
Regards, Mutunga
On Thu, Apr 22, 2021 at 1:02 AM Wesley Gichana @.***> wrote:
$callbackJSONData=file_get_contents('php://input'); $callbackData=json_decode($callbackJSONData); $resultCode=$callbackData->Body->stkCallback->ResultCode; $resultDesc=$callbackData->Body->stkCallback->ResultDesc; $merchantRequestID=$callbackData->Body->stkCallback->MerchantRequestID; $checkoutRequestID=$callbackData->Body->stkCallback->CheckoutRequestID; $amount=$callbackData->stkCallback->Body->CallbackMetadata->Item[0]->Value; $mpesaReceiptNumber=$callbackData->Body->stkCallback->CallbackMetadata->Item[1]->Value; $balance=$callbackData->stkCallback->Body->CallbackMetadata->Item[2]->Value; $b2CUtilityAccountAvailableFunds=$callbackData->Body->stkCallback->CallbackMetadata->Item[3]->Value; $transactionDate=$callbackData->Body->stkCallback->CallbackMetadata->Item[4]->Value; $phoneNumber=$callbackData->Body->stkCallback->CallbackMetadata->Item[5]->Value; $result=[ "resultDesc"=>$resultDesc, "resultCode"=>$resultCode, "merchantRequestID"=>$merchantRequestID, "checkoutRequestID"=>$checkoutRequestID, "amount"=>$amount, "mpesaReceiptNumber"=>$mpesaReceiptNumber, "balance"=>$balance, "b2CUtilityAccountAvailableFunds"=>$b2CUtilityAccountAvailableFunds, "transactionDate"=>$transactionDate, "phoneNumber"=>$phoneNumber ]; return json_encode($result);
try this
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/safaricom/mpesa-php-sdk/issues/17#issuecomment-824386862, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJZXCFWTA3NMQYGPHXTYDTTJ5DOFANCNFSM4EYQQAMA .
Your callback url should be accessible from the internet and should also be a https for you to be able to get a response from the safaricom api
Make sure you disable ufw firewall if you are using ubuntu. That work for me .sudo ufw disable
experiencing the same problem
I am implementing Lipa Na Mpesa STK push and I am not getting response at my callback url after transaction .
kindly Help !
@kalyangadgil ensure you are using HTTPS for your Callback URL. Sometimes this is the issue. You can use some tunneling software if you are testing on localhost -. I hope that helps
@jeffmuts
Yes . I am using HTTPS for my callback URL . right now I am using their test credentials .
AND in my callback function following is the code :
$yourJsonHere = file_get_contents('php://input');
$rooms = json_decode($yourJsonHere);
var_dump($rooms);
Query : 1) Do I need to make my app live to receive response from Lipa na Mpesa at my callback url ?
Thank you !
@kalyangadgil can you try to dump the contents into a file with
file_put_contents('mpesa_push.txt',json_encode( $yourJsonHere));
Since the async might not happen immediately. Just wild thought then you can check the contents of the file
i have the same problem call back url not working
same here, I am getting a successful registration for the Validation and Confirmation URLs but during simulation it does not redirect to the validation URL. Is this a problem with sandbox?
There has to be a problem with sandbox, i am not receiving any data either. Kindly let us know when any of you find a solution thanks.
What is your problem and how can i help you
On Fri, 17 Jun 2022 at 12:08, kiptalam25 @.***> wrote:
i have the same problem call back url not working
— Reply to this email directly, view it on GitHub https://github.com/safaricom/mpesa-php-sdk/issues/17#issuecomment-1158667335, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZFHSAYYIFCBGJZEZS6QPCDVPQ6BBANCNFSM4EYQQAMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hello,
I am having this problem too.
I have been working on an STK push integration on an API currently working on. The STK Push callback has been working well until 26th October 2022 when it just went silent.
What could be the issue?
How can it be solved?
Thanks in advance. Ogego
I am simulating a C2B transaction. The following are the steps I have taken:
All the above are successful.
However the callback URL is not getting any hits. It is not a UFW issue cause another STK callback script running (m-pesa live) is getting hits of the callback.
What could I be missing here?
Did anyone find a solution to this thread? Not getting the callback data from Mpesa Sandbox. Posting data using the same url path on postman gives data, but the sandbox callback data doesn't appear
Am getting the same issue yet i have i exposed the url on the internet
Read in there daraja forum, a number of developers are facing the same issue. I guess they could be having an issue with callbacks in there API
Am getting the same issue yet i have i exposed the url on the internet
Hello @Gloriahmutungi I have the same issue. Did you find a solution?
Warning: file_get_contents(D:\xampp\htdocs\login\investpage/mpesa_public_cert.cer): Failed to open stream: No such file or directory in D:\xampp\htdocs\login\investpage\status.php on line 48
Warning: openssl_public_encrypt(): key parameter is not a valid public key in D:\xampp\htdocs\login\investpage\status.php on line 49
Warning: Undefined property: stdClass::$ResponseCode in D:\xampp\htdocs\login\investpage\status.php on line 88
Transaction doesnt exist
kindly help
Am getting the same issue yet i have i exposed the url on the internet
Hello @Gloriahmutungi I have the same issue. Did you find a solution?
There is just an issue with sandbox callback so i used live credentials for test and the response is coming ..you may test with live credentials you know if the issue is with you code as well
Am getting the same issue yet i have i exposed the url on the internet
Hello @Gloriahmutungi I have the same issue. Did you find a solution?
There is just an issue with sandbox callback so i used live credentials for test and the response is coming ..you may test with live credentials you know if the issue is with you code as well
Okay. Thanks for replying.
Hello did anyone find solution to this since I am getting the same problem
inbox me for help, i had the same issue but i found a way around it
On Thu, 25 Jan 2024 at 04:58, Anonymous @.***> wrote:
Hello did anyone find solution to this since I am getting the same problem
— Reply to this email directly, view it on GitHub https://github.com/safaricom/mpesa-php-sdk/issues/17#issuecomment-1910168079, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWO2NAFLVOD2TUPKSTE5MQ3YQJJHVAVCNFSM4EYQQAMKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJRGAYTMOBQG44Q . You are receiving this because you commented.Message ID: @.***>
Hello did anyone find solution to this since I am getting the same problem
Yes i did find a solution, what language are you using?
inbox me for help, i had the same issue but i found a way around it … On Thu, 25 Jan 2024 at 04:58, Anonymous @.> wrote: Hello did anyone find solution to this since I am getting the same problem — Reply to this email directly, view it on GitHub <#17 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWO2NAFLVOD2TUPKSTE5MQ3YQJJHVAVCNFSM4EYQQAMKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJRGAYTMOBQG44Q . You are receiving this because you commented.Message ID: @.>
why dont you just share with the rest . why the inbox tena.
I can help what language are u using?
im using JS(Node js)
On Sat, Jan 27, 2024 at 1:13 AM davisbravinprograms < @.***> wrote:
I can help what language are u using?
— Reply to this email directly, view it on GitHub https://github.com/safaricom/mpesa-php-sdk/issues/17#issuecomment-1912764092, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3HNUSJ4FEQBNIIMO2CD6DYQQS7XAVCNFSM4EYQQAMKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJRGI3TMNBQHEZA . You are receiving this because you commented.Message ID: @.***>
im using JS(Node js) … On Sat, Jan 27, 2024 at 1:13 AM davisbravinprograms < @.> wrote: I can help what language are u using? — Reply to this email directly, view it on GitHub <#17 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3HNUSJ4FEQBNIIMO2CD6DYQQS7XAVCNFSM4EYQQAMKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJRGI3TMNBQHEZA . You are receiving this because you commented.Message ID: @.>
inbox me in the email, needs some explanations
i am getting the same issue i am using laravel.
Well someone can get the result of the test transaction by querying mpesa with the CheckoutRequestID (this is returned in the body of initial sdk ).One can make a post request to https://sandbox.safaricom.co.ke/mpesa/stkpushquery/v1/query. I found how to query by login->select APIs->click on query button in the M-Pesa Express card. Hope this helps those in test env but I would suggest one moves to production to avoid the many hustle of dealing with CheckoutRequestIDs
Yes moving to production solved my issue @samuelmaina
Yes moving to production solved my issue @samuelmaina
@jameskanyiri you got a real paybill from safaricom or you deployed your app?
Was getting the same issue, reached out to the support team and they resolved the issue in less than an hour and it's working fine.
I am interacting with the Mpesa Api test endpoint i.e https://sandbox.safaricom.co.ke/mpesa/b2b/v1/paymentrequest for B2B request. I am still not getting any data at my callback server. Do you send responses even tests or is it just for production/live purposes. I fully debugged my callback server. I am able to get pings/request just not from Mpesa.