Skip to content

Processing Timeouts

Mauko Maunde edited this page Jan 8, 2021 · 1 revision

When a valid M-Pesa API request is received by the API Gateway, it is sent to M-Pesa where it is added to a queue. M-Pesa then processes the requests in the queue and sends a response to the API Gateway which then forwards the response to the URL registered in the CallBackURL or ResultURL request parameter. Whenever M-Pesa receives more requests than the queue can handle, M-Pesa responds by rejecting any more requests and the API Gateway sends a queue timeout response to the URL registered in the QueueTimeOutURL request parameter. Use the timeout() method to process this response.

C2B::timeout();

This function takes the data sent by Safaricom, and returns a response. You can pass an optional argument to process the data and return true.

C2B::timeout(function ($response){
    // Do something with $response
    return true;
});
Clone this wiki locally