Git Product home page Git Product logo

Comments (40)

jeffmuts avatar jeffmuts commented on July 17, 2024 11

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.

from mpesa-php-sdk.

SmartGuyCodes avatar SmartGuyCodes commented on July 17, 2024 2

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

from mpesa-php-sdk.

AMABK avatar AMABK commented on July 17, 2024 1

Make sure your call back route is a POST and not GET. Also ensure no CSRF validation as in some frameworks

from mpesa-php-sdk.

boratechlife avatar boratechlife commented on July 17, 2024 1

Make sure you disable ufw firewall if you are using ubuntu. That work for me .sudo ufw disable

from mpesa-php-sdk.

mossey avatar mossey commented on July 17, 2024

Hey @nellycheboi12 please make sure that your Callback route is accessible from the internet. Callbacks are sent to applications on the sandbox too.

from mpesa-php-sdk.

henimmans avatar henimmans commented on July 17, 2024

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

from mpesa-php-sdk.

ABHISHEK8973 avatar ABHISHEK8973 commented on July 17, 2024

Hello
what we put in under callback url

from mpesa-php-sdk.

weddingjuma avatar weddingjuma commented on July 17, 2024

Php way have a look at https://3v4l.org/rYfdr

from mpesa-php-sdk.

gondwe avatar gondwe commented on July 17, 2024

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.

from mpesa-php-sdk.

WesleyGichana avatar WesleyGichana commented on July 17, 2024
    $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

from mpesa-php-sdk.

jeffmuts avatar jeffmuts commented on July 17, 2024

from mpesa-php-sdk.

Abdullahi254 avatar Abdullahi254 commented on July 17, 2024

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

from mpesa-php-sdk.

Kaburumwenda avatar Kaburumwenda commented on July 17, 2024

experiencing the same problem

from mpesa-php-sdk.

kalyangadgil avatar kalyangadgil commented on July 17, 2024

I am implementing Lipa Na Mpesa STK push and I am not getting response at my callback url after transaction .

kindly Help !

from mpesa-php-sdk.

jeffmuts avatar jeffmuts commented on July 17, 2024

@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

from mpesa-php-sdk.

kalyangadgil avatar kalyangadgil commented on July 17, 2024

@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 !

from mpesa-php-sdk.

jeffmuts avatar jeffmuts commented on July 17, 2024

@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

from mpesa-php-sdk.

kiptalam25 avatar kiptalam25 commented on July 17, 2024

i have the same problem call back url not working

from mpesa-php-sdk.

seffu avatar seffu commented on July 17, 2024

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?

from mpesa-php-sdk.

davisbravinprograms avatar davisbravinprograms commented on July 17, 2024

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.

from mpesa-php-sdk.

oluoch12 avatar oluoch12 commented on July 17, 2024

from mpesa-php-sdk.

em-manuel avatar em-manuel commented on July 17, 2024

I am simulating a C2B transaction. The following are the steps I have taken:

  1. Get auth token.
  2. Register Callback URLs
  3. Simulate payment.

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?

from mpesa-php-sdk.

Gareba308 avatar Gareba308 commented on July 17, 2024

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

from mpesa-php-sdk.

Gloriahmutungi avatar Gloriahmutungi commented on July 17, 2024

Am getting the same issue yet i have i exposed the url on the internet

from mpesa-php-sdk.

Gareba308 avatar Gareba308 commented on July 17, 2024

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

from mpesa-php-sdk.

GidieLegacy avatar GidieLegacy commented on July 17, 2024

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?

from mpesa-php-sdk.

Chepsain avatar Chepsain commented on July 17, 2024

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

from mpesa-php-sdk.

Gloriahmutungi avatar Gloriahmutungi commented on July 17, 2024

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

from mpesa-php-sdk.

GidieLegacy avatar GidieLegacy commented on July 17, 2024

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.

from mpesa-php-sdk.

Developer-felix avatar Developer-felix commented on July 17, 2024

Hello did anyone find solution to this since I am getting the same problem

from mpesa-php-sdk.

davisbravinprograms avatar davisbravinprograms commented on July 17, 2024

from mpesa-php-sdk.

davisbravinprograms avatar davisbravinprograms commented on July 17, 2024

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?

from mpesa-php-sdk.

alvomade avatar alvomade commented on July 17, 2024

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.

from mpesa-php-sdk.

davisbravinprograms avatar davisbravinprograms commented on July 17, 2024

I can help what language are u using?

from mpesa-php-sdk.

alvomade avatar alvomade commented on July 17, 2024

from mpesa-php-sdk.

davisbravinprograms avatar davisbravinprograms commented on July 17, 2024

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

from mpesa-php-sdk.

jameskanyiri avatar jameskanyiri commented on July 17, 2024

i am getting the same issue i am using laravel.

from mpesa-php-sdk.

samuelmaina avatar samuelmaina commented on July 17, 2024

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

from mpesa-php-sdk.

jameskanyiri avatar jameskanyiri commented on July 17, 2024

Yes moving to production solved my issue @samuelmaina

from mpesa-php-sdk.

bulej93 avatar bulej93 commented on July 17, 2024

Yes moving to production solved my issue @samuelmaina

@jameskanyiri you got a real paybill from safaricom or you deployed your app?

from mpesa-php-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.