- Make sure you have installed this package
- You have read the configuration guidelines specific to Lipa na mpesa and taken the necessary steps.
- You have successfully acquired production credentials from safaricom. If not you can go ahead and use the sandbox credentials that comes preconfigured on installation.
- Your system initiates a payment request to you on behalf of client and sends it to safaricom.
- Safaricom sends the request to the client requesting them to authorize the transaction by entering their M-PESA PIN.
- If client enters their correct M-PESA PIN, safaricom respond to your system with details regarding the transaction. This is made possible by sending an internet accessible URL via a CallBackUrl.
Note this package allows you to override preconfigured parameters for this endpoint. For all supported options check the docs here https://developer.safaricom.co.ke/lipa-na-m-pesa-online/apis/post/stkpush/v1/processrequest
use STKPush;
class CheckoutController{
public function checkout(){
STKPush::submit([
'amount' => 20,
'phoneNumber' => '254722000000',
'accountReference' => 'INVOICEID',
'transactionDesc' => 'Payment for my service'
]);
}
}
- There exists some SIM cards that are not yet supported by this. All your requests to such SIM Cards will fail with
[STK DS timeout]
. - Making multiple subsequent requests to the same phone number causes the initial request to timeout and the STK Prompt to user not to respond to safaricom even though the user entered the correct M-PESA pin.