0

Folks, hope you all doing good.

I'm working on a project in PHP in which we have to integrate m-Pesa as payment gateway. I don't know how and why but "Lipa Na M-Pesa Online Payment" this API when called it gives an error

update failed9

in Sim Tool Kit push dialog box. Even though we are getting a positive response from the m-Pesa server that "Your Request is accepted for processing" and then after a while(10 mins or so) our callback URL gets called by the m-Pesa server with a response of request timed out.

Here is my Request Body:

{
"BusinessShortCode": "242599",
"Password": "MjQyNTk5YmZiMjc5ZjlhYTliZGJjZjE1OGU5N2RkNzFhNDY3Y2QyZTBjODkzMDU5YjEwZjc4ZTZiNzJhZGExZWQyYzkxOTIwMTkwNzEzMTI1NTMw",
"Timestamp": "20190713125530",
"TransactionType": "CustomerBuyGoodsOnline",
"Amount": "1000",
"PartyA": "254708374149",
"PartyB": "242599",
"PhoneNumber": "254721705529",
"CallBackURL": "http://961bb2f4.ngrok.io/hooks/mpesa",
"AccountReference": "account",
"TransactionDesc": "test" }

Here is the error screenshot

enter image description here

1 Answers1

1

Are you able to get the screen to enter your PIN? you can use that to tell if safaricom is able to initiate the API on your end.

sam
  • 110
  • 7
  • Thanks for replying. and about your question, I don't think that this is the case. I'm not I Kenya I'm outside Kenya. it is our project that is from Kenya, and we don't have any option to test this method here. and above Image is all we have from client to go with. – Ghost The Punisher Jul 30 '19 at 04:05
  • and is the lipa na mpesa failing in all phones, I know of a case where it does not work in feature phones, but works on smart phones. To get more assistance share on if you are getting any successful transaction at all, I have an experience in Mpesa integration and can happily answer you. – sam Jul 30 '19 at 08:04
  • No, I don't think that any of the transactions went successful, because the client was only telling that this is not working. That's it. – Ghost The Punisher Jul 30 '19 at 11:19
  • I wish you could have the ability to check the logs response you receive from Safaricom to be able to debug this easily. – sam Jul 30 '19 at 11:41
  • Hey, please tell me what happens if I want to use number A to make a payment but number A's shortcode is set to be business shortcode? Cause this might be the case here but I'm not sure. please also tell me what is this Shortcode and does it is connected with MSISDN/phone Number? – Ghost The Punisher Jul 30 '19 at 11:49
  • Here is how it works, it is an individual (Phone number/MSISDN)who is to pay to an organization through their mpesa account(Shortcode). Could you share the request body you use to trigger the Lipa na Mpesa on safaricom side?Then I can be of better assistance, or can you share your email for a faster response. – sam Jul 31 '19 at 07:49
  • Have you maanged to get the request body you are using? – sam Aug 01 '19 at 07:58
  • I've added request body in question. you can check it. – Ghost The Punisher Aug 02 '19 at 06:28
  • PartyA and PhoneNumber should be same value, I see in your case it's different, also ensure your callback is reachable over the internet and https – sam Aug 02 '19 at 13:52
  • It is the same in my code. this is just some random request body I was trying in postman. can you please test for the Business code in Request Body? – Ghost The Punisher Aug 05 '19 at 06:33
  • and your callback url is working fine?businesscode is your assigned c2b paybill number, are you not even receiving any error on your callback? is this also live or sandbox where you are testing the STKPUSH? – sam Aug 05 '19 at 07:48
  • It is in Sandbox, and I'm not getting any error in Callback URL, it just says that Request Timeout. – Ghost The Punisher Aug 05 '19 at 11:01
  • let me get working sandbox credentials on a code I implemented a while back , then share with you. I know sandbox credentials some times may fail to work for some strange reason and you have to get a set of working ones. i see your request format is correct. – sam Aug 08 '19 at 15:02
  • Hey I got the solution, there wasn't a problem at all the reason of this was that my client had to upgrade her sim card in order to user m-pesa. I'm glad that you helped me and did everything you could to solved my problem. – Ghost The Punisher Sep 23 '19 at 04:42
  • Hey, welcome ,am glad you were able to get a solution, yes some simcards usually have a problem processing the stk push, especially old simcards. What sort of system were you developing? – sam Sep 23 '19 at 13:30